SlideShare a Scribd company logo
1 of 3
Download to read offline
ASSIGNMENT 5 
 
Introduction 
 
Many a times a complex problem becomes easier to solve if you have the                           
appropriate data structure at hand. More so when the input size involved is very                           
large. Skip List is one such simple data structure which will help you efficiently solve                             
problems where ordering is required or dictionaries are required. 
 
Objective 
 
The aim of this assignment is to introduce you to the Skip List data structure                             
including implementation of various operations on it. 
 
Description 
 
Skip Lists are an alternative representation of balanced trees that provides                     
approximate O(log n) access times with the advantage that the implementation is                       
straightforward and the storage requirement is less than a standard balanced tree                       
structure. A distinct difference from most search structures is that the behaviour of                         
skip lists is probabilistic without dependence on the order of insertion of elements.  
 
 
Each node in a skip list has an array of several forward pointers that link to                               
nodes next in the list. The number of forward pointers (node height) in a particular                             
node is determined by a probability function that is applied during insertion. The                         
distribution of the node heights is random. 
 
 
 
To search for a key in the skip list, start at the root and work left to right. For                                     
the current node, work down from the top of the array of forward pointers. Find the                               
first forward pointer that links to another node. Compare the search key against the                           
key of the forward node. If the keys match, you are done. If the search key is less                                   
than the forward node, then the value is on the left side of the forward node,                               
otherwise it is on the right side. If it is on the left side, stay on the current node and                                       
go down one and the right one to the next forward node and repeat. If the key is on                                     
the right side, move to the node that is linked by the forward node, and start over. 
This way, the entire list need not be traversed and the entire search operation                           
can be carried out in O(log n) instead of O(n) time. 
 
Task 
You are required to implement a dictionary using a skip list with a max level of                               
16 which allows basic operations like insertion in the list, deletion from the list,                           
searching and displaying the entire list. There are two parts of the assignment. 
Part 1 
1. The input will be given through a file and will be as follows:­ 
(a) The first line of the input file will be a number ​N ​indicating how many                             
entries are there in the file. 
 
(b) Subsequent ​N ​lines will be in the form of “​key,value,height​” 
 
2. The output will be a GraphViz dot file as described in the class.  
(a) GraphViz dot is a specification for representing graphs, state machines                   
and transition diagrams. A sample file for skip list representation is uploaded                       
in moodle. 
 
Part 2 
The input will be given through two input files and will be as follows:­ 
1. The first file will be defining the dictionary as follows:­ 
(a) The first line of this input file will be a number ​N ​indicating how many                             
entries are there in the file. 
 
(b) Subsequent ​N ​lines will be in the form of “​key,value​” 
 
2. The second input file will be as follows:­ 
(a) The first line will be a number ​M ​indicating the number of search keys. 
(b) Subsequent ​M ​lines will be in the form of “​search key​”. 
 
3. For the same input, you will vary the value of the probability ​p from the set                               
, , , , }{2
1
e
1
 4
1
8
1 1
16  
 
4. For every value of ​p ​you will search your skip list for the search keys from the                                 
input file and note the total search time. Finally, using ​gnuplot​, make a graph of ​p                               
Vs ​search times​. 
 
 
 
Skip List Operations  
The operations are described below:­ 
(a) insertp(SkipList *, int key, char * val, float p) 
Insert a node into the skip list with the key and value as given using ​p                               
as the probability for calculating node height. If the key already exists,                       
then just update the value with this value.  
 
(b) inserth(SkipList *, int key, char * val, int h) 
Insert a node into the skip list with the key and value as given using ​h                               
as the node height. If the key already exists, then just update the value                           
with this value.  
 
(c) delete(SkipList *, int key) 
Delete the node from the SkipList  with the given key  
 
(d) find(SkipList *, int key) 
Find in the SkipList the value corresponding to the key provided. 
 
(e) display(SkipList *) 
Output the skip list as a GraphViz DOT document. 
 
Deliverables 
You will submit your C/C++ program along with the makefile, and doxy file as                           
a single ​rollno_a5.tar.gz file in the moodle submission link. It is mandatory that your                           
code should follow proper indentation and commenting style. There will be                     
deductions in the awarded marks, if you fail to do so. If you are using C++, the use of                                     
STL is not permitted. 

More Related Content

What's hot

Stack data structure in Data Structure using C
Stack data structure in Data Structure using C Stack data structure in Data Structure using C
Stack data structure in Data Structure using C Meghaj Mallick
 
Stacks & Queues By Ms. Niti Arora
Stacks & Queues By Ms. Niti AroraStacks & Queues By Ms. Niti Arora
Stacks & Queues By Ms. Niti Arorakulachihansraj
 
Unit ii(dsc++)
Unit ii(dsc++)Unit ii(dsc++)
Unit ii(dsc++)Durga Devi
 
Linked list
Linked listLinked list
Linked listVONI
 
Data Structure -List Stack Queue
Data Structure -List Stack QueueData Structure -List Stack Queue
Data Structure -List Stack Queuesurya pandian
 
Linked List Static and Dynamic Memory Allocation
Linked List Static and Dynamic Memory AllocationLinked List Static and Dynamic Memory Allocation
Linked List Static and Dynamic Memory AllocationProf Ansari
 
10 Linked Lists Sacks and Queues
10 Linked Lists Sacks and Queues10 Linked Lists Sacks and Queues
10 Linked Lists Sacks and QueuesPraveen M Jigajinni
 
Doubly linked list
Doubly linked listDoubly linked list
Doubly linked listFahd Allebdi
 
Stacks & Queues
Stacks & QueuesStacks & Queues
Stacks & Queuestech4us
 

What's hot (17)

Stack data structure in Data Structure using C
Stack data structure in Data Structure using C Stack data structure in Data Structure using C
Stack data structure in Data Structure using C
 
Linked lists a
Linked lists aLinked lists a
Linked lists a
 
Stacks & Queues By Ms. Niti Arora
Stacks & Queues By Ms. Niti AroraStacks & Queues By Ms. Niti Arora
Stacks & Queues By Ms. Niti Arora
 
Unit ii(dsc++)
Unit ii(dsc++)Unit ii(dsc++)
Unit ii(dsc++)
 
Linked list
Linked listLinked list
Linked list
 
linked list
linked list linked list
linked list
 
Data Structure -List Stack Queue
Data Structure -List Stack QueueData Structure -List Stack Queue
Data Structure -List Stack Queue
 
Linked List Static and Dynamic Memory Allocation
Linked List Static and Dynamic Memory AllocationLinked List Static and Dynamic Memory Allocation
Linked List Static and Dynamic Memory Allocation
 
10 Linked Lists Sacks and Queues
10 Linked Lists Sacks and Queues10 Linked Lists Sacks and Queues
10 Linked Lists Sacks and Queues
 
Doubly linked list
Doubly linked listDoubly linked list
Doubly linked list
 
Link List
Link ListLink List
Link List
 
Data Structure (Circular Linked List)
Data Structure (Circular Linked List)Data Structure (Circular Linked List)
Data Structure (Circular Linked List)
 
Linked list
Linked listLinked list
Linked list
 
linked list
linked listlinked list
linked list
 
Rana Junaid Rasheed
Rana Junaid RasheedRana Junaid Rasheed
Rana Junaid Rasheed
 
Stacks & Queues
Stacks & QueuesStacks & Queues
Stacks & Queues
 
Singly link list
Singly link listSingly link list
Singly link list
 

Similar to Implement Skip List Data Structure

Ch 1 intriductions
Ch 1 intriductionsCh 1 intriductions
Ch 1 intriductionsirshad17
 
1.3 Linked List.pptx
1.3 Linked List.pptx1.3 Linked List.pptx
1.3 Linked List.pptxssuserd2f031
 
unit 5 stack & queue.ppt
unit 5 stack & queue.pptunit 5 stack & queue.ppt
unit 5 stack & queue.pptSeethaDinesh
 
Fundamentals of data structures
Fundamentals of data structuresFundamentals of data structures
Fundamentals of data structuresNiraj Agarwal
 
Assg 05 QuicksortCOSC 2336 Data StructuresObjectives.docx
Assg 05 QuicksortCOSC 2336 Data StructuresObjectives.docxAssg 05 QuicksortCOSC 2336 Data StructuresObjectives.docx
Assg 05 QuicksortCOSC 2336 Data StructuresObjectives.docxjane3dyson92312
 
Assg 05 QuicksortCOSC 2336 Data StructuresObjectives.docx
Assg 05 QuicksortCOSC 2336 Data StructuresObjectives.docxAssg 05 QuicksortCOSC 2336 Data StructuresObjectives.docx
Assg 05 QuicksortCOSC 2336 Data StructuresObjectives.docxfestockton
 
هياكلبيانات
هياكلبياناتهياكلبيانات
هياكلبياناتRafal Edward
 
L1 - Recap.pdf
L1 - Recap.pdfL1 - Recap.pdf
L1 - Recap.pdfIfat Nix
 
Remove Duplicates in an Unsorted Linked List in Python
Remove Duplicates in an Unsorted Linked List in PythonRemove Duplicates in an Unsorted Linked List in Python
Remove Duplicates in an Unsorted Linked List in PythonKal Bartal
 
Skip Graphs and its Applications
Skip Graphs and its ApplicationsSkip Graphs and its Applications
Skip Graphs and its ApplicationsAjay Bidyarthy
 
DATA STRUCTURE AND ALGORITJM POWERPOINT.ppt
DATA STRUCTURE AND ALGORITJM POWERPOINT.pptDATA STRUCTURE AND ALGORITJM POWERPOINT.ppt
DATA STRUCTURE AND ALGORITJM POWERPOINT.pptyarotos643
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithmsJulie Iskander
 

Similar to Implement Skip List Data Structure (20)

Data Structure
Data StructureData Structure
Data Structure
 
Data structure
 Data structure Data structure
Data structure
 
Ch 1 intriductions
Ch 1 intriductionsCh 1 intriductions
Ch 1 intriductions
 
1.3 Linked List.pptx
1.3 Linked List.pptx1.3 Linked List.pptx
1.3 Linked List.pptx
 
Data Structure
Data StructureData Structure
Data Structure
 
Linked lists
Linked listsLinked lists
Linked lists
 
unit 5 stack & queue.ppt
unit 5 stack & queue.pptunit 5 stack & queue.ppt
unit 5 stack & queue.ppt
 
Fundamentals of data structures
Fundamentals of data structuresFundamentals of data structures
Fundamentals of data structures
 
hashing.pdf
hashing.pdfhashing.pdf
hashing.pdf
 
Assg 05 QuicksortCOSC 2336 Data StructuresObjectives.docx
Assg 05 QuicksortCOSC 2336 Data StructuresObjectives.docxAssg 05 QuicksortCOSC 2336 Data StructuresObjectives.docx
Assg 05 QuicksortCOSC 2336 Data StructuresObjectives.docx
 
Assg 05 QuicksortCOSC 2336 Data StructuresObjectives.docx
Assg 05 QuicksortCOSC 2336 Data StructuresObjectives.docxAssg 05 QuicksortCOSC 2336 Data StructuresObjectives.docx
Assg 05 QuicksortCOSC 2336 Data StructuresObjectives.docx
 
هياكلبيانات
هياكلبياناتهياكلبيانات
هياكلبيانات
 
L1 - Recap.pdf
L1 - Recap.pdfL1 - Recap.pdf
L1 - Recap.pdf
 
General Data structures
General Data structuresGeneral Data structures
General Data structures
 
2309.09359.pdf
2309.09359.pdf2309.09359.pdf
2309.09359.pdf
 
2309.09359.pdf
2309.09359.pdf2309.09359.pdf
2309.09359.pdf
 
Remove Duplicates in an Unsorted Linked List in Python
Remove Duplicates in an Unsorted Linked List in PythonRemove Duplicates in an Unsorted Linked List in Python
Remove Duplicates in an Unsorted Linked List in Python
 
Skip Graphs and its Applications
Skip Graphs and its ApplicationsSkip Graphs and its Applications
Skip Graphs and its Applications
 
DATA STRUCTURE AND ALGORITJM POWERPOINT.ppt
DATA STRUCTURE AND ALGORITJM POWERPOINT.pptDATA STRUCTURE AND ALGORITJM POWERPOINT.ppt
DATA STRUCTURE AND ALGORITJM POWERPOINT.ppt
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
 

More from Amrith Krishna

Unsupervised program synthesis
Unsupervised program synthesisUnsupervised program synthesis
Unsupervised program synthesisAmrith Krishna
 
Analyzing Stack Overflow - Problem
Analyzing Stack Overflow - ProblemAnalyzing Stack Overflow - Problem
Analyzing Stack Overflow - ProblemAmrith Krishna
 
Asterix and the Maagic Potion - Suffix tree problem
Asterix and the Maagic Potion - Suffix tree problemAsterix and the Maagic Potion - Suffix tree problem
Asterix and the Maagic Potion - Suffix tree problemAmrith Krishna
 
Roller Coaster Problem - OS
Roller Coaster Problem  - OSRoller Coaster Problem  - OS
Roller Coaster Problem - OSAmrith Krishna
 
File Watcher - Lab Assignment
File Watcher - Lab AssignmentFile Watcher - Lab Assignment
File Watcher - Lab AssignmentAmrith Krishna
 
R - Eigen vector centrality with product reviews
R - Eigen vector centrality with product reviewsR - Eigen vector centrality with product reviews
R - Eigen vector centrality with product reviewsAmrith Krishna
 
Skipl List implementation - Part 2
Skipl List implementation - Part 2Skipl List implementation - Part 2
Skipl List implementation - Part 2Amrith Krishna
 
Maach-Dal-Bhaat Problem
Maach-Dal-Bhaat ProblemMaach-Dal-Bhaat Problem
Maach-Dal-Bhaat ProblemAmrith Krishna
 
Named Entity recognition in Sanskrit
Named Entity recognition in SanskritNamed Entity recognition in Sanskrit
Named Entity recognition in SanskritAmrith Krishna
 
Astra word Segmentation
Astra word SegmentationAstra word Segmentation
Astra word SegmentationAmrith Krishna
 
Segmentation in Sanskrit texts
Segmentation in Sanskrit textsSegmentation in Sanskrit texts
Segmentation in Sanskrit textsAmrith Krishna
 

More from Amrith Krishna (16)

Unsupervised program synthesis
Unsupervised program synthesisUnsupervised program synthesis
Unsupervised program synthesis
 
Analyzing Stack Overflow - Problem
Analyzing Stack Overflow - ProblemAnalyzing Stack Overflow - Problem
Analyzing Stack Overflow - Problem
 
Asterix and the Maagic Potion - Suffix tree problem
Asterix and the Maagic Potion - Suffix tree problemAsterix and the Maagic Potion - Suffix tree problem
Asterix and the Maagic Potion - Suffix tree problem
 
Roller Coaster Problem - OS
Roller Coaster Problem  - OSRoller Coaster Problem  - OS
Roller Coaster Problem - OS
 
File Watcher - Lab Assignment
File Watcher - Lab AssignmentFile Watcher - Lab Assignment
File Watcher - Lab Assignment
 
R - Eigen vector centrality with product reviews
R - Eigen vector centrality with product reviewsR - Eigen vector centrality with product reviews
R - Eigen vector centrality with product reviews
 
Skipl List implementation - Part 2
Skipl List implementation - Part 2Skipl List implementation - Part 2
Skipl List implementation - Part 2
 
Maach-Dal-Bhaat Problem
Maach-Dal-Bhaat ProblemMaach-Dal-Bhaat Problem
Maach-Dal-Bhaat Problem
 
QGene Quiz 2016
QGene Quiz 2016QGene Quiz 2016
QGene Quiz 2016
 
Named Entity recognition in Sanskrit
Named Entity recognition in SanskritNamed Entity recognition in Sanskrit
Named Entity recognition in Sanskrit
 
Astra word Segmentation
Astra word SegmentationAstra word Segmentation
Astra word Segmentation
 
Segmentation in Sanskrit texts
Segmentation in Sanskrit textsSegmentation in Sanskrit texts
Segmentation in Sanskrit texts
 
ShutApp
ShutAppShutApp
ShutApp
 
Ferosa - Insights
Ferosa - InsightsFerosa - Insights
Ferosa - Insights
 
Taddhita Generation
Taddhita GenerationTaddhita Generation
Taddhita Generation
 
Windows Architecture
Windows ArchitectureWindows Architecture
Windows Architecture
 

Recently uploaded

Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxShobhayan Kirtania
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...Pooja Nehwal
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 

Recently uploaded (20)

Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 

Implement Skip List Data Structure

  • 1. ASSIGNMENT 5    Introduction    Many a times a complex problem becomes easier to solve if you have the                            appropriate data structure at hand. More so when the input size involved is very                            large. Skip List is one such simple data structure which will help you efficiently solve                              problems where ordering is required or dictionaries are required.    Objective    The aim of this assignment is to introduce you to the Skip List data structure                              including implementation of various operations on it.    Description    Skip Lists are an alternative representation of balanced trees that provides                      approximate O(log n) access times with the advantage that the implementation is                        straightforward and the storage requirement is less than a standard balanced tree                        structure. A distinct difference from most search structures is that the behaviour of                          skip lists is probabilistic without dependence on the order of insertion of elements.       Each node in a skip list has an array of several forward pointers that link to                                nodes next in the list. The number of forward pointers (node height) in a particular                              node is determined by a probability function that is applied during insertion. The                          distribution of the node heights is random.       
  • 2. To search for a key in the skip list, start at the root and work left to right. For                                      the current node, work down from the top of the array of forward pointers. Find the                                first forward pointer that links to another node. Compare the search key against the                            key of the forward node. If the keys match, you are done. If the search key is less                                    than the forward node, then the value is on the left side of the forward node,                                otherwise it is on the right side. If it is on the left side, stay on the current node and                                        go down one and the right one to the next forward node and repeat. If the key is on                                      the right side, move to the node that is linked by the forward node, and start over.  This way, the entire list need not be traversed and the entire search operation                            can be carried out in O(log n) instead of O(n) time.    Task  You are required to implement a dictionary using a skip list with a max level of                                16 which allows basic operations like insertion in the list, deletion from the list,                            searching and displaying the entire list. There are two parts of the assignment.  Part 1  1. The input will be given through a file and will be as follows:­  (a) The first line of the input file will be a number ​N ​indicating how many                              entries are there in the file.    (b) Subsequent ​N ​lines will be in the form of “​key,value,height​”    2. The output will be a GraphViz dot file as described in the class.   (a) GraphViz dot is a specification for representing graphs, state machines                    and transition diagrams. A sample file for skip list representation is uploaded                        in moodle.    Part 2  The input will be given through two input files and will be as follows:­  1. The first file will be defining the dictionary as follows:­  (a) The first line of this input file will be a number ​N ​indicating how many                              entries are there in the file.    (b) Subsequent ​N ​lines will be in the form of “​key,value​”    2. The second input file will be as follows:­  (a) The first line will be a number ​M ​indicating the number of search keys.  (b) Subsequent ​M ​lines will be in the form of “​search key​”.   
  • 3. 3. For the same input, you will vary the value of the probability ​p from the set                                , , , , }{2 1 e 1  4 1 8 1 1 16     4. For every value of ​p ​you will search your skip list for the search keys from the                                  input file and note the total search time. Finally, using ​gnuplot​, make a graph of ​p                                Vs ​search times​.        Skip List Operations   The operations are described below:­  (a) insertp(SkipList *, int key, char * val, float p)  Insert a node into the skip list with the key and value as given using ​p                                as the probability for calculating node height. If the key already exists,                        then just update the value with this value.     (b) inserth(SkipList *, int key, char * val, int h)  Insert a node into the skip list with the key and value as given using ​h                                as the node height. If the key already exists, then just update the value                            with this value.     (c) delete(SkipList *, int key)  Delete the node from the SkipList  with the given key     (d) find(SkipList *, int key)  Find in the SkipList the value corresponding to the key provided.    (e) display(SkipList *)  Output the skip list as a GraphViz DOT document.    Deliverables  You will submit your C/C++ program along with the makefile, and doxy file as                            a single ​rollno_a5.tar.gz file in the moodle submission link. It is mandatory that your                            code should follow proper indentation and commenting style. There will be                      deductions in the awarded marks, if you fail to do so. If you are using C++, the use of                                      STL is not permitted.