1.3 - Stack and Queue
使用Stack製作Queue演算法、使用Queue製作Stack演算法
1. 使用2個Stack製作Queue(Linklist)
概念示意圖:

1.1 Stack的pop()
1.2 Stack的push()
1.3 Queue的enqueue()
1.4 Queue的enqueue()
1.5 執行結果:
完整程式碼: https://github.com/gary30404/Data-Structure/blob/master/1/1.4/queue_by_stack_in_linklist.c
2. 使用1個Queue製作Stack(Linklist)
概念示意圖:

2.1 Queue的dequeue()
和用Linklist做的Queue相同。
2.2 Queue的enqueue()
和用Linklist做的Queue相同。
2.3 Stack的pop()
2.4 Stack的push()
2.5 執行結果:
完整程式碼: https://github.com/gary30404/Data-Structure/blob/master/1/1.4/stack_by_queue_in_linklist.c
Last updated