22
Data Structures Damian Gordon

Operating Systems: Data Structures

Embed Size (px)

Citation preview

Page 1: Operating Systems: Data Structures

Data StructuresDamian Gordon

Page 2: Operating Systems: Data Structures

What is a queue?

Data Structures

Page 3: Operating Systems: Data Structures

What is a queue?

Data Structures

Page 4: Operating Systems: Data Structures

What is a queue?

Data Structures

5 31 47 81 71 10

Page 5: Operating Systems: Data Structures

What is a queue?

Data Structures

5 31 47 81 71 10

Page 6: Operating Systems: Data Structures

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.

Data Structures

Page 7: Operating Systems: Data Structures

What is a stack?

Data Structures

Page 8: Operating Systems: Data Structures

What is a stack?

Data Structures

5 31 47 81 71 10

Page 9: Operating Systems: Data Structures

What is a stack?

Data Structures

5 31 47 81 71 10

Page 10: Operating Systems: Data Structures

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.

Data Structures

Page 11: Operating Systems: Data Structures

What is a heap?

Data Structures

Page 12: Operating Systems: Data Structures

What is a heap?

Data Structures

Page 13: Operating Systems: Data Structures

What is a heap?

Data Structures

31 5

47

10

71

81

1

Page 14: Operating Systems: Data Structures

What is a heap?

Data Structures

31 5

47

10

71

81

1

Page 15: Operating Systems: Data Structures

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.

Data Structures

Page 16: Operating Systems: Data Structures

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

Data Structures

Page 17: Operating Systems: Data Structures

What is a queue?

Data Structures

9 10 11

12 13 14

1516

1819

1 2

3 4 5

6 7 8

0

17

20

Page 18: Operating Systems: Data Structures

What is a queue?

Data Structures

9 10 11

12 13 14

1516

1819

1 2

3 4 5

6 7 8

0

17

20

Page 19: Operating Systems: Data Structures

What is a stack?

Data Structures

9 10 11

12 13 14

1516

1819

1 2

3 4 5

6 7 8

0

17

20

Page 20: Operating Systems: Data Structures

What is a stack?

Data Structures

9 10 11

12 13 14

1516

1819

1 2

3 4 5

6 7 8

0

17

20

Page 21: Operating Systems: Data Structures

What is a heap?

Data Structures

9 10 11

12 13 14

1516

1819

1 2

3 4 5

6 7 8

0

17

20

Page 22: Operating Systems: Data Structures

What is a heap?

Data Structures

9 10 11

12 13 14

1516

1819

1 2

3 4 5

6 7 8

0

17

20

Based on value not location