Data Structures and Algorithm Xiaoqing Zheng Zhengxq@fudan.edu.cn
Data Structures and Algorithm Xiaoqing Zheng zhengxq@fudan.edu.cn
What is data structure? a data structure is a way to store and organize data in order to facilitate access and modifications
What is data structure? A data structure is a way to store and organize data in order to facilitate access and modifications
Elementary data structures 口 Stacks a Queues a inked lists a Trees
Elementary data structures Stacks Queues Linked lists Trees
Stacks tops=0
Stacks S top[S] = 0
Stacks PUSH 15 1opS=1→15
Stacks 15 S top[S] = 1 PUSH 15
Stacks PUsh 6 top5]=2→6 15
Stacks 6 15 top[S] = 2 S PUSH 6
Stacks PUSH 2 top[s=3 2 6 15
Stacks 6 15 2 S top[S] = 3 PUSH 2
Stacks POP 2 top5]=2→6 15
Stacks 6 15 top[S] = 2 S POP 2
Stacks PUSh 5 p=3→[5 6 15
Stacks 6 15 5 S top[S] = 3 PUSH 5
Stacks Push 9 pS]=4→ 956 15
Stacks 6 15 9 5 S top[S] = 4 PUSH 9