Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 310047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T07:47:51+00:00 2026-05-12T07:47:51+00:00

[SOLVED] So I decided to try and create a sorted doubly linked skip list…

  • 0

[SOLVED]

So I decided to try and create a sorted doubly linked skip list…

I’m pretty sure I have a good grasp of how it works. When you insert x the program searches the base list for the appropriate place to put x (since it is sorted), (conceptually) flips a coin, and if the “coin” lands on a then that element is added to the list above it(or a new list is created with element in it), linked to the element below it, and the coin is flipped again, etc. If the “coin” lands on b at anytime then the insertion is over. You must also have a -infinite stored in every list as the starting point so that it isn’t possible to insert a value that is less than the starting point (meaning that it could never be found.)

To search for x, you start at the “top-left” (highest list lowest value) and “move right” to the next element. If the value is less than x than you continue to the next element, etc. until you have “gone too far” and the value is greater than x. In this case you go back to the last element and move down a level, continuing this chain until you either find x or x is never found.

To delete x you simply search x and delete it every time it comes up in the lists.

For now, I’m simply going to make a skip list that stores numbers. I don’t think there is anything in the STL that can assist me, so I will need to create a class List that holds an integer value and has member functions, search, delete, and insert.

The problem I’m having is dealing with links. I’m pretty sure I could create a class to handle the “horizontal” links with a pointer to the previous element and the element in front, but I’m not sure how to deal with the “vertical” links (point to corresponding element in other list?)

If any of my logic is flawed please tell me, but my main questions are:

  1. How to deal with vertical links and whether my link idea is correct
  2. Now that I read my class List idea I’m thinking that a List should hold a vector of integers rather than a single integer. In fact I’m pretty positive, but would just like some validation.
  3. I’m assuming the coin flip would simply call int function where rand()%2 returns a value of 0 or 1 and if it’s 0 then a the value “levels up” and if it’s 0 then the insert is over. Is this incorrect?
  4. How to store a value similar to -infinite?

Edit: I’ve started writing some code and am considering how to handle the List constructor….I’m guessing that on its construction, the “-infinite” value should be stored in the vectorname[0] element and I can just call insert on it after its creation to put the x in the appropriate place.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T07:47:52+00:00Added an answer on May 12, 2026 at 7:47 am
    1. Just store 2 pointers. One called above, and one called below in your node class.
    2. Not sure what you mean.
    3. According to wikipedia you can also do a geometric distribution. I’m not sure if the type of distribution matters for totally random access, but it obviously matters if you know your access pattern.
    4. I am unsure of what you mean by this. You can represent something like that with floating point numbers.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 176k
  • Answers 177k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Eclipse MTJ, Antenna and of course Sun's WTK May 12, 2026 at 3:22 pm
  • Editorial Team
    Editorial Team added an answer In the top-level of c.py (i.e. outside of any function… May 12, 2026 at 3:22 pm
  • Editorial Team
    Editorial Team added an answer It Tries TL;DR: for the purpose of writing and debugging… May 12, 2026 at 3:22 pm

Related Questions

[SOLVED] So I decided to try and create a sorted doubly linked skip list...
I know the ideal place to ask is at . I posted my question
When I developed a piece of (academic) software using Java, I was forced to
I am using the Kohana framework (but I think it's irrelevant for this question)
We need to read and count different types of messages/run some statistics on a

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.