Damian Gordon
 What is a queue?
 What is a queue?
 What is a queue?
5 31 47 81 71 10
 What is a queue?
5 31 47 81 71 10
 What is 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.
 What is a stack?
 What is a stack?
5 31 47 81 71 10
 What is a stack?
5 31 47 81 71 10
 What is 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.
 What is a heap?
 What is a heap?
 What is a heap?
31 5
47
10
71
81
1
 What is a heap?
31 5
47
10
71
81
1
 What is a heap?
 A heap is a tree-like structure generally each
node has two children nodes, where the lower
values are stored near the bottom of the tree
and higher values towards the top of the tree.
 What is a heap?
 MORE FORMALLY:
 The heap property:
◦ If A is a parent node of B then the key of node A is
ordered with respect to the key of node B with the
same ordering applying across the heap
 What is a queue?
9
10
11
12
13
14
15
16
18
19
1 2
3 4
5
6
7 8
0
17
20
 What is a queue?
9
10
11
12
13
14
15
16
18
19
1 2
3 4
5
6
7 8
0
17
20
 What is a stack?
9
10
11
12
13
14
15
16
18
19
1 2
3 4
5
6
7 8
0
17
20
 What is a stack?
9
10
11
12
13
14
15
16
18
19
1 2
3 4
5
6
7 8
0
17
20
 What is a heap?
9
10
11
12
13
14
15
16
18
19
1 2
3 4
5
6
7 8
0
17
20
 What is a heap?
9
10
11
12
13
14
15
16
18
19
1 2
3 4
5
6
7 8
0
17
20
Based on value not location

Operating Systems: Data Structures

  • 1.
  • 2.
     What isa queue?
  • 3.
     What isa queue?
  • 4.
     What isa queue? 5 31 47 81 71 10
  • 5.
     What isa queue? 5 31 47 81 71 10
  • 6.
     What isa 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.
  • 7.
     What isa stack?
  • 8.
     What isa stack? 5 31 47 81 71 10
  • 9.
     What isa stack? 5 31 47 81 71 10
  • 10.
     What isa 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.
  • 11.
     What isa heap?
  • 12.
     What isa heap?
  • 13.
     What isa heap? 31 5 47 10 71 81 1
  • 14.
     What isa heap? 31 5 47 10 71 81 1
  • 15.
     What isa heap?  A heap is a tree-like structure generally each node has two children nodes, where the lower values are stored near the bottom of the tree and higher values towards the top of the tree.
  • 16.
     What isa heap?  MORE FORMALLY:  The heap property: ◦ If A is a parent node of B then the key of node A is ordered with respect to the key of node B with the same ordering applying across the heap
  • 17.
     What isa queue? 9 10 11 12 13 14 15 16 18 19 1 2 3 4 5 6 7 8 0 17 20
  • 18.
     What isa queue? 9 10 11 12 13 14 15 16 18 19 1 2 3 4 5 6 7 8 0 17 20
  • 19.
     What isa stack? 9 10 11 12 13 14 15 16 18 19 1 2 3 4 5 6 7 8 0 17 20
  • 20.
     What isa stack? 9 10 11 12 13 14 15 16 18 19 1 2 3 4 5 6 7 8 0 17 20
  • 21.
     What isa heap? 9 10 11 12 13 14 15 16 18 19 1 2 3 4 5 6 7 8 0 17 20
  • 22.
     What isa heap? 9 10 11 12 13 14 15 16 18 19 1 2 3 4 5 6 7 8 0 17 20 Based on value not location