Download presentation
Presentation is loading. Please wait.
Published byFrancis Austin Shepherd Modified over 9 years ago
1
Data Structures: Advanced Damian Gordon
2
Advanced Data Structure We’ll look at: – Linked Lists – Trees – Stacks – Queues
3
Linked Lists Imagine we wanted to have an array where we can dynamically add elements into it, and take them away. We can do this with a linked list.
4
Linked Lists A linked list is made up of nodes.
5
Linked Lists A linked list is made up of nodes. Each node has two parts to it:
6
Linked Lists A linked list is made up of nodes. Each node has two parts to it: PointerValue
7
Linked Lists For example
8
Linked Lists For example 23
9
Linked Lists For example 2362
10
Linked Lists For example 236237
11
Linked Lists For example 23623731
12
Linked Lists For example 23623731
13
Linked Lists For example 23623731 Start of List End of List
14
Linked Lists To add a value in: 23623731
15
Linked Lists To add a value in: 23623731 26
16
Linked Lists To add a value in: 23623731 26
17
Linked Lists To add a value in: 23623731 26
18
Linked Lists To add a value in: 23623731 26
19
Linked Lists To delete a value: 23623731 26
20
Linked Lists To delete a value: 23623731 26
21
Linked Lists To delete a value: 23623731
22
Trees We can also have a tree:
23
Trees We can also have a tree: A tree is made up of nodes. Each node has three parts.
24
Trees We can also have a tree: A tree is made up of nodes. Each node has three parts. A value and two pointers, a left and a right one. Value RightLeft
25
Trees This is what it looks like: 23 6814 33831153 7727
26
Trees This is what it looks like: 23 6814 33831153 Root Parent Child 77 Leaf 27
27
Stacks We can also have a stack:
28
Stacks We can also have a stack:
29
Stacks We can also have a stack: It’s a structure that conforms to the principle of Last In, First Out (LIFO). The last item to join the stack is the first item to be served.
30
Stacks 31 41 59 26 53 59
31
Stacks 31 41 59 26 53 59 Top Bottom
32
Stacks Values are added to the top:
33
Stacks Values are added to the top: 31 41 59 26 53 59 67
34
Stacks Values are added to the top: 31 41 59 26 53 59 67
35
Stacks Values are added to the top: 31 41 59 26 53 59 67
36
Stacks Values are removed from the top: 31 41 59 26 53 59 67
37
Stacks Values are removed from the top: 31 41 59 26 53 59 67
38
Stacks Values are removed from the top: 31 41 59 26 53 59
39
Queues We can also have a queue:
40
Queues We can also have a queue:
41
Queues We can also have a queue: It’s a structure that conforms to the principle of First In, First Out (FIFO). The first item to join the queue is the first item to be served.
42
Queues 31 415926 5359
43
Queues 31 415926 5359 Back Front
44
Queues Values are added to the back: 31 415926 5359 86
45
Queues Values are added to the back: 31 415926 5359 86
46
Queues Values are added to the back: 31 415926 5359 86
47
Queues Values are removed from the front: 31 415926 5359 86
48
Queues Values are removed from the front: 31 415926 5359 86
49
Queues Values are removed from the front: 31 415926 5359 86
50
Queues Values are removed from the front: 415926 5359 86
51
etc.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.