CSC 172 DATA STRUCTURES. SKIP LISTS Read Weiss 10.4.2.

Slides:



Advertisements
Similar presentations
David Luebke 1 6/7/2014 CS 332: Algorithms Skip Lists Introduction to Hashing.
Advertisements

CMSC420: Skip Lists Kinga Dobolyi Based off notes by Dave Mount.
© 2004 Goodrich, Tamassia Skip Lists1 S0S0 S1S1 S2S2 S3S
Skip Lists. Outline and Reading What is a skip list (§9.4) – Operations (§9.4.1) – Search – Insertion – Deletion Implementation Analysis (§9.4.2) – Space.
CS 225 Lab #11 – Skip Lists.
The Dictionary ADT: Skip List Implementation
David Luebke 1 6/7/2014 ITCS 6114 Skip Lists Hashing.
SKIP LISTS Amihood Amir Incorporationg the slides of Goodrich and Tamassia (2004)
Alon Efrat Computer Science Department University of Arizona SkipList.
Data Structures: A Pseudocode Approach with C
October 26, 2005Copyright © by Erik D. Demaine and Charles E. LeisersonL11.1 Introduction to Algorithms 6.046J/18.401J LECTURE12 Skip Lists Data.
Data Structures Lecture 13 Fang Yu Department of Management Information Systems National Chengchi University Fall 2010.
© 2004 Goodrich, Tamassia Skip Lists1  S0S0 S1S1 S2S2 S3S3    2315.
Skip Lists Intuition and Definition –Efficient searching Insertion Other Operations Randomized Analysis Some figures and ideas from Erik Demaine and Shafi.
Objectives Learn how to implement the sequential search algorithm Explore how to sort an array using the selection sort algorithm Learn how to implement.
CSE 326 Randomized Data Structures David Kaplan Dept of Computer Science & Engineering Autumn 2001.
COMP 171 Data Structures and Algorithms Tutorial 10 Hash Tables.
Discrete Math CSC151 Analysis of Algorithms. Complexity of Algorithms  In CS it's important to be able to predict how many resources an algorithm will.
Skip Lists1 Skip Lists William Pugh: ” Skip Lists: A Probabilistic Alternative to Balanced Trees ”, 1990  S0S0 S1S1 S2S2 S3S3 
Randomized Algorithms - Treaps
Introduction To Algorithms CS 445 Discussion Session 2 Instructor: Dr Alon Efrat TA : Pooja Vaswani 02/14/2005.
Chapter 19 - basic definitions - order statistics ( findkth( ) ) - balanced binary search trees - Java implementations Binary Search Trees 1CSCI 3333 Data.
Symbol Tables Symbol tables are used by compilers to keep track of information about variables functions class names type names temporary variables etc.
1 Bernoulli trial and binomial distribution Bernoulli trialBinomial distribution x (# H) 01 P(x)P(x)P(x)P(x)(1 – p)p ?
Skip Lists Mrutyunjay. Introduction ▪ Linked Lists Benefits & Drawbacks: – Benefits: – Easy Insert and Deletes, implementations. – Drawbacks: – Hard to.
Data Structures Week 8 Further Data Structures The story so far  Saw some fundamental operations as well as advanced operations on arrays, stacks, and.
1 Searching Searching in a sorted linked list takes linear time in the worst and average case. Searching in a sorted array takes logarithmic time in the.
Sorting – Insertion and Selection. Sorting Arranging data into ascending or descending order Influences the speed and complexity of algorithms that use.
Searching Given distinct keys k 1, k 2, …, k n and a collection of n records of the form »(k 1,I 1 ), (k 2,I 2 ), …, (k n, I n ) Search Problem - For key.
1 Hashing - Introduction Dictionary = a dynamic set that supports the operations INSERT, DELETE, SEARCH Dictionary = a dynamic set that supports the operations.
CSC 172 DATA STRUCTURES. SETS and HASHING  Unadvertised in-store special: SETS!  in JAVA, see Weiss 4.8  Simple Idea: Characteristic Vector  HASHING...The.
Skip Lists 二○一七年四月二十五日
1 Chapter 7 Skip Lists and Hashing Part 2: Hashing.
Data Structure II So Pak Yeung Outline Review  Array  Sorted Array  Linked List Binary Search Tree Heap Hash Table.
CHAPTER 9 HASH TABLES, MAPS, AND SKIP LISTS ACKNOWLEDGEMENT: THESE SLIDES ARE ADAPTED FROM SLIDES PROVIDED WITH DATA STRUCTURES AND ALGORITHMS IN C++,
Chapter 3 The easy stuff. Lists If you only need to store a few things, the simplest and easiest approach might be to put them in a list Only if you need.
CSCE 3110 Data Structures & Algorithm Analysis Rada Mihalcea Dictionaries. Reading Weiss Chap. 5, Sec
Hash Tables ADT Data Dictionary, with two operations – Insert an item, – Search for (and retrieve) an item How should we implement a data dictionary? –
2/19/2016 3:18 PMSkip Lists1  S0S0 S1S1 S2S2 S3S3    2315.
Random Variables If  is an outcome space with a probability measure and X is a real-valued function defined over the elements of , then X is a random.
Skip Lists – Why? BSTs –Worse case insertion, search O(n) –Best case insertion, search O(log n) –Where your run fits in O(n) – O(log n) depends on the.
Data Structures and Algorithm Analysis Dr. Ken Cosh Linked Lists.
Data Structures: A Pseudocode Approach with C 1 Chapter 5 Objectives Upon completion you will be able to: Explain the design, use, and operation of a linear.
Skip Lists. Linked Lists Fast modifications given a pointer Slow traversals to random point.
Skip Lists S3   S2   S1   S0  
Sorted Maps © 2014 Goodrich, Tamassia, Goldwasser Skip Lists.
Skip Lists 5/10/2018 Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia, and M.
School of Computing Clemson University Fall, 2012
Indexing Goals: Store large files Support multiple search keys
COP3530- Data Structures Advanced Lists
Searching an Array: Binary Search
Sequences 8/2/ :16 AM Linked Lists Linked Lists.
Skip Lists S3 + - S2 + - S1 + - S0 + -
Skip Lists.
Arrays and Linked Lists
Skip Lists S3 + - S2 + - S1 + - S0 + -
CMSC 341 Skip Lists 1.
Skip Lists S3 + - S2 + - S1 + - S0 + -
Sorted Maps © 2014 Goodrich, Tamassia, Goldwasser Skip Lists.
Dictionaries < > = /3/2018 8:58 AM Dictionaries
CMSC 341 Skip Lists.
ADTs so far.
Parasol Lab, Dept. CSE, Texas A&M University
Maintaining Dynamic Tree with Min Subject to Constraints
Skip List: formally A skip list for a set S of distinct (key, element) items is a series of lists S0, S1 , … , Sh such that Each list Si contains the special.
CSCI 104 Skip Lists Mark Redekopp.
Fun… Tree Diagrams… Probability.
More on Linked List Yumei Huo Department of Computer Science
Applications of Arrays
Presentation transcript:

CSC 172 DATA STRUCTURES

SKIP LISTS Read Weiss

SKIP LISTS  Dictionary Data Structure  Efficient

SKIP LISTS  Dictionary Data Structure (insert delete lookup)  Efficient O(lg n)

SKIP LISTS  Dictionary Data Structure (insert delete lookup)  Efficient O(lg n)

SKIP LISTS  Dictionary Data Structure  Efficient (with high probability)  Randomized

SKIP LISTS  Dictionary Data Structure  Efficient (with high probability)  Randomized  Easy to implement

LISTS  How much time does it take to search a sorted linked list?  How can this be improved?

EXAMPLE

 What is this sequence? 14,23,28,34,42,50,59,66,72, 79,86,96,103,110

EXAMPLE  What is this sequence? 14,23,34,42,50,59,66,72, 79,86,96,103,110

EXAMPLE  What is this sequence? 14,23,34,42,50,59,66,72, 79,86,96,103,110,116,125

SKIP LISTS  Use two lists  L 2 stores all element  L 1 stores some elements  Links between shared elements

Lookup on a skip list

1)Take L1 until you go too far 2)Back up one 3)Transfer to L2 4)Take L2 until you find element (or go too far – not found – or insert)

Lookup on a skip list How should we distribute the L1 list? What is the time cost of a search?

Lookup on a skip list How should we distribute the L1 list? What is the time cost of a search? Minimize : L1.length + (L2.length/L1.length)

NEXT STEP  2 linked lists 2(n^(1/2))  Can we improve this further?

NEXT STEP  2 linked lists 2(n^(1/2))  Can we improve this further?  3 linked lists 3(n^(1/3))  k linked lists k(n^(1/k))  N linked lists ????  lg n linked lists lg n (n^(1/lg n))

BALLANCED SKIP LISTS  Ideal as long as structure is maintained

BALLANCED SKIP LISTS  Ideal as long as structure is maintained  Insertions and deletions mess up structure

INSERTION ON SKIP LISTS  Search to find location  Must insert on bottom list  Which other lists?  FLIP A COIN  If heads add to level above and flip again.  If tails done.

INSERTION ON SKIP LISTS  FLIP A COIN  If heads add to level above and flip again.  If tails done. ½ of the elements go up one level ¼ of the elements go up 2 levels 1/8 of the elements go up 3 levels

INSERTION ON SKIP LISTS  EXAMPLE

ANALYSIS  Intuitively:  Height of the structure is O(lg n)  How many coin flips do we need to get lg n heads?