Giter VIP home page Giter VIP logo

skip-list's Introduction

<<< SKIP LIST >>>

Description:

The skip list is a probabilisitc data structure that is built upon the general idea of a linked list. The skip list uses probability to build subsequent layers of linked lists upon an original linked list. Each additional layer of links contains fewer elements, but no new elements.

For Example:

You can think about the skip list like a subway system. There's one train that stops at every single stop. However, there is also an express train. This train doesn't visit any unique stops, but it will stop at fewer stops. This makes the express train an attractive option if you know where it stops.

Functions:

Skip List has the following Functions:

a) Insert(value) : This function inserts the node of the given value in the List.

b) Delete(value) : This function deletes nodeof the given value from the List.

c) Search(value) : This function searches the node of the given value in the List and return if the element is present in the list or not.

d) PrintList() : This functions displays a sorted Skip list with random levels of every node.

Time Complexity:

The complexity of a skip list is complicated due to its probabilistic nature. The Worst Case time complexity of different opertions are:

Average Case:

Indexing - O(log(n)),

Insertion - O(log(n)),

Search - O(log(n)),

Deletion - O(log(n))

Worst case:

Indexing - O(n),

Insertion - O(n),

Search - O(n),

Deletion - O(n)

How To Run The Program:

  1. Make an object of the SkipList class. For Example: list = SkipList().

  2. It Will be an empty list at first.

  3. Insert a node in the List using the Insert() Function by giving the value. For Example: lst.Insert(value), here value = 1,2,3...

  4. Display the List using the PrintList() Function.

  5. Delete a node from the List using the Delete() Function. For Example: lst.Delete(value), here value = 1,2,3...

  6. To search a node in the List, use the Search() Function. For Example: lst.Search(value), here value = 1,2,3...

If the node is present in the list the function will return True.

If the node is not present in the list the function will return False.

Group Members:

Muhammad Arsal 18B-115-CS(A)

Muhammad Osama 18B-003-CS(A)

skip-list's People

Contributors

osama710 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.