Hop Jump and Leap Dhruv Matani and Gaurav
- Slides: 48
Hop, Jump, and Leap Dhruv Matani and Gaurav Menghani
Hop, Jump, and Leap* Dhruv Matani and Gaurav Menghani * In O(lg n) with high probability
Hop, Jump, and Leap • Skip Lists are a simple and powerful datastructure. • Augmenting skip-lists to achieve decent running times for most problems. • By decent, we mean O(lg n) w. h. p
Hop, Jump, and Leap In class, we saw: Order Maintenance Static RMQ O(1) Amortized Insert O(n) preprocessing O(1) Query
Hop, Jump, and Leap Today, we shall see: Order Maintenance O(lg n) w. h. p. Query Dynamic RMQ O(lg n) w. h. p. Insert O(lg n) w. h. p. Query
Dynamic Range Minimum Query using Skip Lists
7 1 8 5 19 2 8 3 19 2 7 1 26 2 30 1 26 1 13 1 8 1 24 1 19 1 27 1
Find element at Index 4
Find the element at index 4 7 1 8 5 19 2 8 3 19 2 7 1 26 2 30 1 26 1 13 1 8 1 24 1 19 1 27 1
Find the element at index 4 6 7 1 7 1 26 2 30 1 26 1 13 1 8 5 19 2 8 3 19 2 24 1 19 1 27 1
Find the element at index 4 7 1 8 5 19 2 8 3 19 2 1 7 1 7 1 26 2 30 1 26 1 13 1 8 1 24 1 19 1 27 1
Find the element at index 4 7 1 6 7 1 7 1 26 2 30 1 26 1 13 1 8 5 19 2 8 3 19 2 24 1 19 1 27 1
Find the element at index 4 7 1 8 5 19 2 8 3 19 2 1 7 1 26 2 30 1 26 1 13 1 8 1 24 1 19 1 27 1
Find the element at index 4 7 1 8 5 19 2 8 3 19 2 7 1 3 26 2 30 1 26 1 13 1 8 1 24 1 19 1 27 1
Find the element at index 4 7 1 8 5 19 2 8 3 19 2 7 1 6 26 2 30 1 26 1 13 1 8 1 24 1 19 1 27 1
Find the element at index 4 7 1 8 5 19 2 8 3 19 2 7 1 26 2 3 7 1 30 1 26 1 13 1 8 1 24 1 19 1 27 1
Find the element at index 4 7 1 8 5 19 2 8 3 19 2 7 1 26 2 30 1 26 1 4 13 1 8 1 24 1 19 1 27 1
Find minimum in range [3, 7]
Find min [3, 7] 7 1 8 5 19 2 8 3 19 2 7 1 26 2 30 1 26 1 13 1 8 1 24 1 19 1 27 1
Find min [3, 7] 7 1 8 5 19 2 8 3 19 2 7 1 26 2 30 1 26 1 13 1 8 1 24 1 19 1 27 1
Find min [3, 7] = [3, 6], [7, 7] 7 1 7 1 26 2 30 1 26 1 13 1 8 5 19 2 8 3 19 2 24 1 19 1 27 1
Find min [3, 7] [7, 7] 7 1 [3, 6] 7 1 7 1 26 2 30 1 26 1 13 1 8 5 19 2 8 3 19 2 24 1 19 1 27 1
Find min [3, 7] [7, 7] 7 1 [3, 6] 7 1 7 1 26 2 30 1 26 1 13 1 8 5 19 2 8 3 19 2 24 1 19 1 27 1
Find min [3, 7] [7, 7] 7 1 [3, 6] 7 1 7 1 26 2 30 1 26 1 13 1 8 5 19 2 8 3 19 2 24 1 19 1 27 1
Find min [3, 7] [7, 7] 7 1 [3, 6] 7 1 26 2 30 1 26 1 13 1 8 5 19 2 8 3 19 2 24 1 19 1 27 1
Find min [3, 7] [7, 7] 7 1 7 1 [3, 6] = [3, 3], [4, 6] 30 1 26 2 26 1 13 1 8 5 19 2 8 3 19 2 24 1 19 1 27 1
Find min [3, 7] [7, 7] 7 1 [4, 6] 7 1 30 1 26 2 26 1 13 1 8 5 19 2 8 3 19 2 24 1 19 1 27 1
Find min [3, 7] [7, 7] 7 1 [4, 6] 7 1 [3, 3] 7 1 30 1 26 2 26 1 13 1 8 5 19 2 8 3 19 2 24 1 19 1 27 1
Find min [3, 7] [7, 7] 7 1 [4, 6] 7 1 [3, 3] 30 1 26 2 26 1 13 1 8 5 19 2 8 3 19 2 24 1 19 1 27 1
Find min [3, 7] [7, 7] 7 1 [4, 6] 7 1 30 1 [3, 3] 26 2 26 1 13 1 8 5 19 2 8 3 19 2 24 1 19 1 27 1
Find min [3, 7] [7, 7] 7 1 7 1 [4, 6] 26 2 30 1 [3, 3] 26 1 13 1 8 5 19 2 8 3 19 2 24 1 19 1 27 1
Find min [3, 7] 7 1 8 5 19 2 8 3 19 2 7 1 [4, 6] 26 2 30 1 [3, 3] 26 1 13 1 8 1 24 1 [7, 7] 19 1 27 1
Insert element with Value 5 at Index 5
Insert 5 at index 5 7 1 8 5 19 2 8 3 19 2 7 1 26 2 30 1 26 1 13 1 8 1 24 1 19 1 27 1
Insert 5 at index 5 7 1 8 5 19 2 8 3 19 2 7 1 26 2 5 1 7 1 30 1 26 1 13 1 8 1 24 1 19 1 27 1
Insert 5 at index 5 7 1 8 5 19 2 8 3 19 2 7 1 26 2 [5, 2] [8, 2] 5 1 7 1 30 1 26 1 13 1 8 1 24 1 19 1 27 1
Insert 5 at index 5 7 1 8 5 19 2 8 2 19 2 7 1 26 2 [5, 2] 5 2 [8, 2] 5 1 7 1 30 1 26 1 13 1 8 1 24 1 19 1 27 1
Insert 5 at index 5 7 1 8 5 19 2 8 2 19 2 [5, 4] [8, 2] 7 1 26 2 5 1 7 1 30 1 26 1 13 1 8 1 24 1 19 1 27 1
Insert 5 at index 5 7 1 [5, 4] 7 1 26 2 5 4 [8, 2] 5 2 8 5 19 2 8 2 19 2 5 1 7 1 30 1 26 1 13 1 8 1 24 1 19 1 27 1
Insert 5 at index 5 7 1 8 5 19 2 5 4 8 2 19 2 5 2 8 2 19 2 [5, 4] [8, 2] 7 1 26 2 5 1 7 1 30 1 26 1 13 1 8 1 24 1 19 1 27 1
Insert 5 at index 5 7 1 5 6 19 2 5 4 8 2 19 2 5 2 8 2 19 2 [5, 4] [8, 2] 7 1 26 2 5 1 7 1 30 1 26 1 13 1 8 1 24 1 19 1 27 1
Insert 5 at index 5 7 1 7 1 26 2 5 6 19 2 5 4 8 2 19 2 5 2 8 2 19 2 5 1 7 1 30 1 26 1 13 1 8 1 24 1 19 1 27 1
Order Maintenance using Skip Lists
• To perform Order Maintenance, we insert an element after a given element. • This costs O(lg n) w. h. p • Does X precede Y? – Is the rank(X) < rank(Y)? • This costs O(lg n) w. h. p
Does 13 precede 19? 7 1 8 5 19 2 8 3 19 2 7 1 26 2 30 1 26 1 13 1 8 1 24 1 19 1 27 1
Does 13 precede 19? Rank(13) = 1 + 2 + 1 = 4 7 1 8 5 19 2 8 3 19 2 7 1 26 2 30 1 26 1 13 1 8 1 24 1 19 1 27 1
Does 13 precede 19? Rank(19) = 1 + 5 + 1 = 7 7 1 8 5 19 2 8 3 19 2 7 1 26 2 30 1 26 1 13 1 8 1 24 1 19 1 27 1
The End
- Dhruv matani
- We're gonna jump jump jump in the river
- Choke packet in computer network
- Hip hippity hop
- Hop by hop choke packet
- Hop by hop choke packet
- Hop by hop choke packet
- Hop to hop
- Hop on hop off delhi
- Old school hip hop quiz
- A hip a hop a hippity hop
- Jb instruction in 8086
- Triage start
- Dhruv grewal marketing
- Dhruv gaming blogspot
- Dhruv rebba
- Gaurav bubna
- Gaurav sharma cisco
- Gaurav daga microsoft
- Gaurav shekhar
- Gaurav 8 bit
- Gaurav bubna
- Gaurav bubna
- Gaurav sharma inside edge
- Gaurav bubna
- Leap into the void yves klein
- Louise erdrich the leap
- The great leap forward ap world history
- Great leap forward propaganda
- Leap.laa.edu.ph
- Leap 360 interim test answer key
- Leap360
- Leap 360 geometry interim test form 1 answer key
- Ppt ok
- Leap connect
- Leap program douglasville ga
- Atavism poem
- Leap foot exam
- Workfront leap
- Chinese great leap forward
- Romeo and juliet act 4 scene 1 quotes
- Chinese great leap forward
- Leap connect assessment guide
- Leap online bolton
- Great leap forward communes
- Great leap forward communes
- Creative leap meaning
- List of leap years
- Tertian leap