Code Monkey home page Code Monkey logo

lp2-skip-list-implementation's Introduction

Long Project LP2: Skip List Implementation

Authors:

End Date:

  • Sunday, October 14, 2018

A. OVERVIEW

Please read the details about the SkipList.

1. ENTRY ATTRIBUTES:

  • Every Entry has height {which tells us how many non-null entries it's next[] has}
  • It also has span[], span[i]: storing distance of the Entry in next[i] from the current Entry

2. SKIPLIST ATTRIBUTES:

  • last[]: an array of Entry, last[i]: Entry at which search came down from level i

  • distanceTraversed[i]: an array of integers, distanceTraversed[i]: distance traversed on level i, as search came down from last[i] to level i-1

  • There are few more attributes which are described at the time of their definition, in the code itself.

  • for rebuild(), we have used iterative approach rather than a recursive one (divide-and-conquer). Initially, when we started we couldn't think of it that way, and hope it doesn't affect any EXCELLENCE CREDIT.

  • There are some private methods which you may use to print the skip list

    • call printList() to print the list with next[] references.
    • call printListSpan() to print the list with span[] values for each Entry

B. OBSERVATION:

  • Our span[] is of type integer, which could have maximum value as (size+1, when head pointing to tail).

    Now, limit of int is 2^31 - 1. So, size can be no greater than 2^31 - 2.

    But we had our POSSIBLE_LEVELS as 33, which could fit in 2^33 - 1 elements. Hence, our top two levels will always have pointers from head to tail. And we could've set POSSIBLE_LEVELS to 31, instead of 33.


C. RESULTS:

1. add-remove-contains operations only:

File # Operation Time (mSec) Memory (used/avail)
lp2-t01.txt 50 7 1 MB / 117 MB
lp2-t02.txt 200 11 1 MB / 117 MB
lp2-t03.txt 1000 22 3 MB / 117 MB
lp2-t04.txt 50000 179 32 MB / 117 MB
lp2-t05.txt 100000 292 61 MB / 147 MB
lp2-t06.txt 1000000 2709 286 MB / 583 MB

2. add-remove-contains-floor-ceiling-get-first-last operations:

File # Operation Time (mSec) Memory (used/avail)
lp2-t11.txt 50 5 1 MB / 117 MB
lp2-t12.txt 100 8 1 MB / 117 MB
lp2-t13.txt 200 11 1 MB / 117 MB
lp2-t14.txt 1000 18 3 MB / 117 MB
lp2-t15.txt 50000 182 29 MB / 117 MB
lp2-t16.txt 100000 266 57 MB / 147 MB
lp2-t17.txt 1000000 2659 247 MB / 583 MB

NOTE:

  • Time and Memory might change, as you run the test the program on a different system, but they could be comparable to the above values.

Existing Processor: Intel® Core™ i5-8250U CPU @ 1.60GHz × 8 Memory: 7.5 GiB


D. How to Run

  1. Extract the rsn170330.zip

  2. Compile and Run:

$javac rsn170330/*.java
$java rsn170330.SkipListDriver lp2-test/lp2-t14.txt

lp2-skip-list-implementation's People

Contributors

rahul1947 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  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.