SlideShare a Scribd company logo
1 of 12
SKIP LISTS
IN
DATA STRUCTURE
Prepared by:
Vinay Khimsuriya(200430723005)
WHAT IS SKIP LIST?
 A skip list is a data structure.
 The skip list is an extended version of the linked list.
 The skip list is used to store a sorted list of elements or data with a linked
list.
 It allows the process of the elements or data to view efficiently.
 In one single step, it skips several elements of the entire list, which is why
it is known as a skip list.
 It allows the user to search, remove, and insert the element very
quickly. It consists of a base list that includes a set of elements
which maintains the link hierarchy of the subsequent elements.
SKIP LIST STRUCTURE AND TIME COMPLEXITY
 It is built in two layers: The lowest layer and Top layer.
 The lowest layer of the skip list is a common sorted linked list.
 the top layers of the skip list are like an "express line" where the
elements are skipped.
WORKING OF SKIP LIST
 we have 14 nodes, such that these nodes are divided into two layers, as shown in
the diagram.
 The lower layer is a common line that links all nodes, and the top layer is
an express line that links only the main nodes, as we can see in the
diagram.
 Suppose we want to find 47 in this example.
 We will start the search from the first node of the express line and
continue running on the express line until we find a node that is equal a
47 or more than 47.
 We can see in the example that 47 does not exist in the express line, so
we search for a node of less than 47, which is 40. Now, we go to the
normal line with the help of 40, and search the 47, as shown in the
SKIP LIST OPERATION
 Insertion operation: It is used to add a new node to a particular
location in a specific situation.
 Deletion operation: It is used to delete a node in a specific
situation.
 Search Operation: The search operation is used to search a
particular node in a skip list.
IMPLEMENTATION
 We can implement a skip
list with quad-nodes
 A quad-node stores:
 item
 link to the node before
 link to the node after
 link to the node below
 Also, we define special keys
PLUS_INF and
MINUS_INF, and we modify
the key comparator to
handle them
x
quad-node
SEARCH
 We search for a key x in a a skip list as follows:
 We start at the first position of the top list
 At the current position p, we compare x with y  key(after(p))
x = y: we return element(after(p))
x > y: we “scan forward”
x < y: we “drop down”
 If we try to drop down past the bottom list, we return NO_SUCH_KEY
 Example: search for 78
+
-
S0
S1
S2
S3
+
31
-
64 +
31 34
- 23
56 64 78 +
31 34 44
- 12 23 26
INSERTION
 To insert an item (x, o) into a skip list, we use a randomized
algorithm:
 We repeatedly toss a coin until we get tails, and we denote with i
the number of times the coin came up heads
 If i  h, we add to the skip list new lists Sh+1, … , Si +1, each
containing only the two special keys
 We search for x in the skip list and find the positions p0, p1 , …, pi of
the items with largest key less than x in each list S0, S1, … , Si
 For j  0, …, i, we insert item (x, o) into list Sj after position pj
 Example: insert key 15, with i = 2
+
- 10 36
+
-
23
23 +
-
S0
S1
S2
+
-
S0
S1
S2
S3
+
- 10 36
23
15
+
- 15
+
- 23
15
p0
p1
p2
DELETION
 To remove an item with key x from a skip list, we proceed as
follows:
 We search for x in the skip list and find the positions p0, p1 , …, pi of
the items with key x, where position pj is in list Sj
 We remove positions p0, p1 , …, pi from the lists S0, S1, … , Si
 We remove all but one list containing only the two special keys
 Example: remove key 34
- +
45
12
- +
23
23
- +
S0
S1
S2
- +
S0
S1
S2
S3
- +
45
12 23 34
- +
34
- +
23 34
p0
p1
p2
ADVANTAGES OF THE SKIP LIST
 If we want to insert a new node in the skip list, then it will insert
the node very fast because there are no rotations in the skip list.
 The skip list is simple to implement as compared to the hash
table and the binary search tree.
 It is very simple to find a node in the list because it stores the
nodes in sorted form.
 The skip list algorithm can be modified very easily in a more
specific structure, such as indexable skip lists, trees, or priority
queues.
 The skip list is a robust and reliable list.
DISADVANTAGES OF THE SKIP LIST
 It requires more memory than the balanced tree.
 Reverse searching is not allowed.
 The skip list searches the node much slower than the linked
list.
Applications of the Skip list
•It is used in distributed applications, and it represents the pointers
and system in the distributed applications.
•It is used to implement a dynamic elastic concurrent queue with
low lock contention.
•It is also used with the QMap template class.
•The indexing of the skip list is used in running median problems.
•The skip list is used for the delta-encoding posting in the Lucene
search.
Thank You

More Related Content

What's hot

Unit 5 internal sorting &amp; files
Unit 5  internal sorting &amp; filesUnit 5  internal sorting &amp; files
Unit 5 internal sorting &amp; filesDrkhanchanaR
 
Data Structures and Algorithm Analysis
Data Structures  and  Algorithm AnalysisData Structures  and  Algorithm Analysis
Data Structures and Algorithm AnalysisMary Margarat
 
Queue implementation
Queue implementationQueue implementation
Queue implementationRajendran
 
Hashing Technique In Data Structures
Hashing Technique In Data StructuresHashing Technique In Data Structures
Hashing Technique In Data StructuresSHAKOOR AB
 
Queue Implementation Using Array & Linked List
Queue Implementation Using Array & Linked ListQueue Implementation Using Array & Linked List
Queue Implementation Using Array & Linked ListPTCL
 
Graph representation
Graph representationGraph representation
Graph representationTech_MX
 
Algorithms Lecture 6: Searching Algorithms
Algorithms Lecture 6: Searching AlgorithmsAlgorithms Lecture 6: Searching Algorithms
Algorithms Lecture 6: Searching AlgorithmsMohamed Loey
 
Data Structures- Part5 recursion
Data Structures- Part5 recursionData Structures- Part5 recursion
Data Structures- Part5 recursionAbdullah Al-hazmy
 
Lecture 1 data structures and algorithms
Lecture 1 data structures and algorithmsLecture 1 data structures and algorithms
Lecture 1 data structures and algorithmsAakash deep Singhal
 
Priority queue in DSA
Priority queue in DSAPriority queue in DSA
Priority queue in DSAjunnubabu
 
Demonstrate interpolation search
Demonstrate interpolation searchDemonstrate interpolation search
Demonstrate interpolation searchmanojmanoj218596
 
Polish Notation In Data Structure
Polish Notation In Data StructurePolish Notation In Data Structure
Polish Notation In Data StructureMeghaj Mallick
 
1.5 binary search tree
1.5 binary search tree1.5 binary search tree
1.5 binary search treeKrish_ver2
 

What's hot (20)

Unit 5 internal sorting &amp; files
Unit 5  internal sorting &amp; filesUnit 5  internal sorting &amp; files
Unit 5 internal sorting &amp; files
 
Data Structures and Algorithm Analysis
Data Structures  and  Algorithm AnalysisData Structures  and  Algorithm Analysis
Data Structures and Algorithm Analysis
 
skip list
skip listskip list
skip list
 
Queue implementation
Queue implementationQueue implementation
Queue implementation
 
Queues
QueuesQueues
Queues
 
Hashing Technique In Data Structures
Hashing Technique In Data StructuresHashing Technique In Data Structures
Hashing Technique In Data Structures
 
Queue Implementation Using Array & Linked List
Queue Implementation Using Array & Linked ListQueue Implementation Using Array & Linked List
Queue Implementation Using Array & Linked List
 
Graph representation
Graph representationGraph representation
Graph representation
 
Linked list
Linked listLinked list
Linked list
 
Algorithms Lecture 6: Searching Algorithms
Algorithms Lecture 6: Searching AlgorithmsAlgorithms Lecture 6: Searching Algorithms
Algorithms Lecture 6: Searching Algorithms
 
Data Structures- Part5 recursion
Data Structures- Part5 recursionData Structures- Part5 recursion
Data Structures- Part5 recursion
 
Lecture 1 data structures and algorithms
Lecture 1 data structures and algorithmsLecture 1 data structures and algorithms
Lecture 1 data structures and algorithms
 
Priority queue in DSA
Priority queue in DSAPriority queue in DSA
Priority queue in DSA
 
Queues
QueuesQueues
Queues
 
Demonstrate interpolation search
Demonstrate interpolation searchDemonstrate interpolation search
Demonstrate interpolation search
 
Polish Notation In Data Structure
Polish Notation In Data StructurePolish Notation In Data Structure
Polish Notation In Data Structure
 
Tries data structures
Tries data structuresTries data structures
Tries data structures
 
B tree
B treeB tree
B tree
 
b+ tree
b+ treeb+ tree
b+ tree
 
1.5 binary search tree
1.5 binary search tree1.5 binary search tree
1.5 binary search tree
 

Similar to Skip list vinay khimsuriya_200430723005

Computer notes - Binary Search
Computer notes - Binary SearchComputer notes - Binary Search
Computer notes - Binary Searchecomputernotes
 
computer notes - Data Structures - 32
computer notes - Data Structures - 32computer notes - Data Structures - 32
computer notes - Data Structures - 32ecomputernotes
 
presentation-225new
presentation-225newpresentation-225new
presentation-225newNajmul Hoq
 
Bsc cs ii dfs u-2 linklist,stack,queue
Bsc cs ii  dfs u-2 linklist,stack,queueBsc cs ii  dfs u-2 linklist,stack,queue
Bsc cs ii dfs u-2 linklist,stack,queueRai University
 
Bca ii dfs u-2 linklist,stack,queue
Bca ii  dfs u-2 linklist,stack,queueBca ii  dfs u-2 linklist,stack,queue
Bca ii dfs u-2 linklist,stack,queueRai University
 
Mca ii dfs u-3 linklist,stack,queue
Mca ii dfs u-3 linklist,stack,queueMca ii dfs u-3 linklist,stack,queue
Mca ii dfs u-3 linklist,stack,queueRai University
 
STACK AND QUEUE CIRCULAR QUEUE PPTS.pptx
STACK AND QUEUE CIRCULAR QUEUE PPTS.pptxSTACK AND QUEUE CIRCULAR QUEUE PPTS.pptx
STACK AND QUEUE CIRCULAR QUEUE PPTS.pptxsunitha1792
 
unit 5 stack & queue.ppt
unit 5 stack & queue.pptunit 5 stack & queue.ppt
unit 5 stack & queue.pptSeethaDinesh
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure shameen khan
 
ds-lecture-4-171012041008 (1).pdf
ds-lecture-4-171012041008 (1).pdfds-lecture-4-171012041008 (1).pdf
ds-lecture-4-171012041008 (1).pdfKamranAli649587
 
Data structures and Algorithm analysis_Lecture 2.pptx
Data structures and Algorithm analysis_Lecture 2.pptxData structures and Algorithm analysis_Lecture 2.pptx
Data structures and Algorithm analysis_Lecture 2.pptxAhmedEldesoky24
 
Data Structures(Part 1)
Data Structures(Part 1)Data Structures(Part 1)
Data Structures(Part 1)SURBHI SAROHA
 
Unit ii(dsc++)
Unit ii(dsc++)Unit ii(dsc++)
Unit ii(dsc++)Durga Devi
 
Data Structures- Part7 linked lists
Data Structures- Part7 linked listsData Structures- Part7 linked lists
Data Structures- Part7 linked listsAbdullah Al-hazmy
 
data structures and applications power p
data structures and applications power pdata structures and applications power p
data structures and applications power pMeghaKulkarni27
 

Similar to Skip list vinay khimsuriya_200430723005 (20)

Computer notes - Binary Search
Computer notes - Binary SearchComputer notes - Binary Search
Computer notes - Binary Search
 
computer notes - Data Structures - 32
computer notes - Data Structures - 32computer notes - Data Structures - 32
computer notes - Data Structures - 32
 
presentation-225new
presentation-225newpresentation-225new
presentation-225new
 
Bsc cs ii dfs u-2 linklist,stack,queue
Bsc cs ii  dfs u-2 linklist,stack,queueBsc cs ii  dfs u-2 linklist,stack,queue
Bsc cs ii dfs u-2 linklist,stack,queue
 
Bca ii dfs u-2 linklist,stack,queue
Bca ii  dfs u-2 linklist,stack,queueBca ii  dfs u-2 linklist,stack,queue
Bca ii dfs u-2 linklist,stack,queue
 
Mca ii dfs u-3 linklist,stack,queue
Mca ii dfs u-3 linklist,stack,queueMca ii dfs u-3 linklist,stack,queue
Mca ii dfs u-3 linklist,stack,queue
 
Data structures2
Data structures2Data structures2
Data structures2
 
STACK AND QUEUE CIRCULAR QUEUE PPTS.pptx
STACK AND QUEUE CIRCULAR QUEUE PPTS.pptxSTACK AND QUEUE CIRCULAR QUEUE PPTS.pptx
STACK AND QUEUE CIRCULAR QUEUE PPTS.pptx
 
unit 5 stack & queue.ppt
unit 5 stack & queue.pptunit 5 stack & queue.ppt
unit 5 stack & queue.ppt
 
Linked list (1).pptx
Linked list (1).pptxLinked list (1).pptx
Linked list (1).pptx
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure
 
ds-lecture-4-171012041008 (1).pdf
ds-lecture-4-171012041008 (1).pdfds-lecture-4-171012041008 (1).pdf
ds-lecture-4-171012041008 (1).pdf
 
Data structures and Algorithm analysis_Lecture 2.pptx
Data structures and Algorithm analysis_Lecture 2.pptxData structures and Algorithm analysis_Lecture 2.pptx
Data structures and Algorithm analysis_Lecture 2.pptx
 
Data Structures(Part 1)
Data Structures(Part 1)Data Structures(Part 1)
Data Structures(Part 1)
 
Algo>ADT list & linked list
Algo>ADT list & linked listAlgo>ADT list & linked list
Algo>ADT list & linked list
 
Unit ii(dsc++)
Unit ii(dsc++)Unit ii(dsc++)
Unit ii(dsc++)
 
Data Structures- Part7 linked lists
Data Structures- Part7 linked listsData Structures- Part7 linked lists
Data Structures- Part7 linked lists
 
data structures and applications power p
data structures and applications power pdata structures and applications power p
data structures and applications power p
 
Data structure
Data structureData structure
Data structure
 
csc211_lecture_21.pptx
csc211_lecture_21.pptxcsc211_lecture_21.pptx
csc211_lecture_21.pptx
 

Recently uploaded

Natural Polymer Based Nanomaterials
Natural Polymer Based NanomaterialsNatural Polymer Based Nanomaterials
Natural Polymer Based NanomaterialsAArockiyaNisha
 
VIRUSES structure and classification ppt by Dr.Prince C P
VIRUSES structure and classification ppt by Dr.Prince C PVIRUSES structure and classification ppt by Dr.Prince C P
VIRUSES structure and classification ppt by Dr.Prince C PPRINCE C P
 
Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |
Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |
Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |aasikanpl
 
Nanoparticles synthesis and characterization​ ​
Nanoparticles synthesis and characterization​  ​Nanoparticles synthesis and characterization​  ​
Nanoparticles synthesis and characterization​ ​kaibalyasahoo82800
 
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCESTERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCEPRINCE C P
 
Biological Classification BioHack (3).pdf
Biological Classification BioHack (3).pdfBiological Classification BioHack (3).pdf
Biological Classification BioHack (3).pdfmuntazimhurra
 
Analytical Profile of Coleus Forskohlii | Forskolin .pdf
Analytical Profile of Coleus Forskohlii | Forskolin .pdfAnalytical Profile of Coleus Forskohlii | Forskolin .pdf
Analytical Profile of Coleus Forskohlii | Forskolin .pdfSwapnil Therkar
 
Luciferase in rDNA technology (biotechnology).pptx
Luciferase in rDNA technology (biotechnology).pptxLuciferase in rDNA technology (biotechnology).pptx
Luciferase in rDNA technology (biotechnology).pptxAleenaTreesaSaji
 
Spermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatidSpermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatidSarthak Sekhar Mondal
 
Isotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on IoIsotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on IoSérgio Sacani
 
Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.aasikanpl
 
Hubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroidsHubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroidsSérgio Sacani
 
Work, Energy and Power for class 10 ICSE Physics
Work, Energy and Power for class 10 ICSE PhysicsWork, Energy and Power for class 10 ICSE Physics
Work, Energy and Power for class 10 ICSE Physicsvishikhakeshava1
 
Call Girls in Munirka Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Munirka Delhi 💯Call Us 🔝8264348440🔝Call Girls in Munirka Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Munirka Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Scheme-of-Work-Science-Stage-4 cambridge science.docx
Scheme-of-Work-Science-Stage-4 cambridge science.docxScheme-of-Work-Science-Stage-4 cambridge science.docx
Scheme-of-Work-Science-Stage-4 cambridge science.docxyaramohamed343013
 
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...Lokesh Kothari
 
G9 Science Q4- Week 1-2 Projectile Motion.ppt
G9 Science Q4- Week 1-2 Projectile Motion.pptG9 Science Q4- Week 1-2 Projectile Motion.ppt
G9 Science Q4- Week 1-2 Projectile Motion.pptMAESTRELLAMesa2
 
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...Sérgio Sacani
 
Recombination DNA Technology (Nucleic Acid Hybridization )
Recombination DNA Technology (Nucleic Acid Hybridization )Recombination DNA Technology (Nucleic Acid Hybridization )
Recombination DNA Technology (Nucleic Acid Hybridization )aarthirajkumar25
 

Recently uploaded (20)

Natural Polymer Based Nanomaterials
Natural Polymer Based NanomaterialsNatural Polymer Based Nanomaterials
Natural Polymer Based Nanomaterials
 
VIRUSES structure and classification ppt by Dr.Prince C P
VIRUSES structure and classification ppt by Dr.Prince C PVIRUSES structure and classification ppt by Dr.Prince C P
VIRUSES structure and classification ppt by Dr.Prince C P
 
Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |
Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |
Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |
 
Nanoparticles synthesis and characterization​ ​
Nanoparticles synthesis and characterization​  ​Nanoparticles synthesis and characterization​  ​
Nanoparticles synthesis and characterization​ ​
 
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCESTERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
 
Biological Classification BioHack (3).pdf
Biological Classification BioHack (3).pdfBiological Classification BioHack (3).pdf
Biological Classification BioHack (3).pdf
 
Analytical Profile of Coleus Forskohlii | Forskolin .pdf
Analytical Profile of Coleus Forskohlii | Forskolin .pdfAnalytical Profile of Coleus Forskohlii | Forskolin .pdf
Analytical Profile of Coleus Forskohlii | Forskolin .pdf
 
Luciferase in rDNA technology (biotechnology).pptx
Luciferase in rDNA technology (biotechnology).pptxLuciferase in rDNA technology (biotechnology).pptx
Luciferase in rDNA technology (biotechnology).pptx
 
Spermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatidSpermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatid
 
9953056974 Young Call Girls In Mahavir enclave Indian Quality Escort service
9953056974 Young Call Girls In Mahavir enclave Indian Quality Escort service9953056974 Young Call Girls In Mahavir enclave Indian Quality Escort service
9953056974 Young Call Girls In Mahavir enclave Indian Quality Escort service
 
Isotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on IoIsotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on Io
 
Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
 
Hubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroidsHubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroids
 
Work, Energy and Power for class 10 ICSE Physics
Work, Energy and Power for class 10 ICSE PhysicsWork, Energy and Power for class 10 ICSE Physics
Work, Energy and Power for class 10 ICSE Physics
 
Call Girls in Munirka Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Munirka Delhi 💯Call Us 🔝8264348440🔝Call Girls in Munirka Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Munirka Delhi 💯Call Us 🔝8264348440🔝
 
Scheme-of-Work-Science-Stage-4 cambridge science.docx
Scheme-of-Work-Science-Stage-4 cambridge science.docxScheme-of-Work-Science-Stage-4 cambridge science.docx
Scheme-of-Work-Science-Stage-4 cambridge science.docx
 
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
 
G9 Science Q4- Week 1-2 Projectile Motion.ppt
G9 Science Q4- Week 1-2 Projectile Motion.pptG9 Science Q4- Week 1-2 Projectile Motion.ppt
G9 Science Q4- Week 1-2 Projectile Motion.ppt
 
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
 
Recombination DNA Technology (Nucleic Acid Hybridization )
Recombination DNA Technology (Nucleic Acid Hybridization )Recombination DNA Technology (Nucleic Acid Hybridization )
Recombination DNA Technology (Nucleic Acid Hybridization )
 

Skip list vinay khimsuriya_200430723005

  • 1. SKIP LISTS IN DATA STRUCTURE Prepared by: Vinay Khimsuriya(200430723005)
  • 2. WHAT IS SKIP LIST?  A skip list is a data structure.  The skip list is an extended version of the linked list.  The skip list is used to store a sorted list of elements or data with a linked list.  It allows the process of the elements or data to view efficiently.  In one single step, it skips several elements of the entire list, which is why it is known as a skip list.  It allows the user to search, remove, and insert the element very quickly. It consists of a base list that includes a set of elements which maintains the link hierarchy of the subsequent elements.
  • 3. SKIP LIST STRUCTURE AND TIME COMPLEXITY  It is built in two layers: The lowest layer and Top layer.  The lowest layer of the skip list is a common sorted linked list.  the top layers of the skip list are like an "express line" where the elements are skipped.
  • 4. WORKING OF SKIP LIST  we have 14 nodes, such that these nodes are divided into two layers, as shown in the diagram.  The lower layer is a common line that links all nodes, and the top layer is an express line that links only the main nodes, as we can see in the diagram.  Suppose we want to find 47 in this example.  We will start the search from the first node of the express line and continue running on the express line until we find a node that is equal a 47 or more than 47.  We can see in the example that 47 does not exist in the express line, so we search for a node of less than 47, which is 40. Now, we go to the normal line with the help of 40, and search the 47, as shown in the
  • 5. SKIP LIST OPERATION  Insertion operation: It is used to add a new node to a particular location in a specific situation.  Deletion operation: It is used to delete a node in a specific situation.  Search Operation: The search operation is used to search a particular node in a skip list.
  • 6. IMPLEMENTATION  We can implement a skip list with quad-nodes  A quad-node stores:  item  link to the node before  link to the node after  link to the node below  Also, we define special keys PLUS_INF and MINUS_INF, and we modify the key comparator to handle them x quad-node
  • 7. SEARCH  We search for a key x in a a skip list as follows:  We start at the first position of the top list  At the current position p, we compare x with y  key(after(p)) x = y: we return element(after(p)) x > y: we “scan forward” x < y: we “drop down”  If we try to drop down past the bottom list, we return NO_SUCH_KEY  Example: search for 78 + - S0 S1 S2 S3 + 31 - 64 + 31 34 - 23 56 64 78 + 31 34 44 - 12 23 26
  • 8. INSERTION  To insert an item (x, o) into a skip list, we use a randomized algorithm:  We repeatedly toss a coin until we get tails, and we denote with i the number of times the coin came up heads  If i  h, we add to the skip list new lists Sh+1, … , Si +1, each containing only the two special keys  We search for x in the skip list and find the positions p0, p1 , …, pi of the items with largest key less than x in each list S0, S1, … , Si  For j  0, …, i, we insert item (x, o) into list Sj after position pj  Example: insert key 15, with i = 2 + - 10 36 + - 23 23 + - S0 S1 S2 + - S0 S1 S2 S3 + - 10 36 23 15 + - 15 + - 23 15 p0 p1 p2
  • 9. DELETION  To remove an item with key x from a skip list, we proceed as follows:  We search for x in the skip list and find the positions p0, p1 , …, pi of the items with key x, where position pj is in list Sj  We remove positions p0, p1 , …, pi from the lists S0, S1, … , Si  We remove all but one list containing only the two special keys  Example: remove key 34 - + 45 12 - + 23 23 - + S0 S1 S2 - + S0 S1 S2 S3 - + 45 12 23 34 - + 34 - + 23 34 p0 p1 p2
  • 10. ADVANTAGES OF THE SKIP LIST  If we want to insert a new node in the skip list, then it will insert the node very fast because there are no rotations in the skip list.  The skip list is simple to implement as compared to the hash table and the binary search tree.  It is very simple to find a node in the list because it stores the nodes in sorted form.  The skip list algorithm can be modified very easily in a more specific structure, such as indexable skip lists, trees, or priority queues.  The skip list is a robust and reliable list.
  • 11. DISADVANTAGES OF THE SKIP LIST  It requires more memory than the balanced tree.  Reverse searching is not allowed.  The skip list searches the node much slower than the linked list. Applications of the Skip list •It is used in distributed applications, and it represents the pointers and system in the distributed applications. •It is used to implement a dynamic elastic concurrent queue with low lock contention. •It is also used with the QMap template class. •The indexing of the skip list is used in running median problems. •The skip list is used for the delta-encoding posting in the Lucene search.