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 structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithmsJulie Iskander
 
2 Important Data Structure Interview Questions
2 Important Data Structure Interview Questions2 Important Data Structure Interview Questions
2 Important Data Structure Interview QuestionsGeekster
 

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 structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
 
2 Important Data Structure Interview Questions
2 Important Data Structure Interview Questions2 Important Data Structure Interview Questions
2 Important Data Structure Interview Questions
 

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

Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 

Recently uploaded (20)

Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 

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.