Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 6 Data Structures. Stack top 2 2 4 4 6 6 8 8 9 9x.

Similar presentations


Presentation on theme: "Lecture 6 Data Structures. Stack top 2 2 4 4 6 6 8 8 9 9x."— Presentation transcript:

1 Lecture 6 Data Structures

2 Stack top

3 2 2 4 4 6 6 8 8 9 9x

4 2 2 4 4 6 6 8 8 9 9x

5 Queue 13 5 62 head tail

6 1 1 2 2 3 3x

7 1 1 2 2 3 3 head x

8 Priority Queue A priority queue is a data structure for maintaining a set of elements, each with an associated value, called a key. A max-priority queue supports the following operations: Insert(S,x), Maximum(S), Extract-Max(S), Increase-Key(S,x,k). Max-Heap can be used for implementing max-priority queue.

9

10

11

12

13 Doubly Linked List 12 3 prevkeynext

14 1 12 x x is an object!!!

15 1 12 x 32

16 Sentinel A sentinel is a dummy object that allow us to simplify the boundary condition. With sentinel, a doubly linked list can be turned into a circular one. The sentinel nil[L] is placed between the head and the tail.

17

18 Direct Addressing Direct addressing is a simple technique that work well when the universe of keys is reasonably small. Direct-address table is an array in which each position, or slot, corresponds to a key in the universe. If the universe is large, how to do? Hashing!

19 Hash Table Collision resolution by chaining

20 Hash Functions

21 What we learnt in this lecture? Review elementary data structures


Download ppt "Lecture 6 Data Structures. Stack top 2 2 4 4 6 6 8 8 9 9x."

Similar presentations


Ads by Google