The Artima Developer Community
Sponsored Link

C# Answers Forum
C++ Hash/Skip-List

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Lily

Posts: 1
Nickname: lily
Registered: Feb, 2003

C++ Hash/Skip-List Posted: Feb 25, 2003 7:49 AM
Reply to this message Reply
Advertisement
Hi,

I'm working on the Project that requires to create a hash table and link it with a skip list. The Project is to develop a reservation system for an airline, using a skip list to maintain flight information and a hash table to maintain passenger/reservation information.

Hash table uses passenger names as a key.

My hash func is:
int FltReservations::hash (const string& key) const
{
int hashVal = 0;
for (int i = 0; i < key.length(); i++)
hashVal = hashVal * 37 + key ;

hashVal %= TABLE_SIZE;
if (hashVal < 0)
hashVal += TABLE_SIZE;
return hashVal;
}

I think that the hash table I should create is chained hash table, but I have no idea how to link it with the skip list that has flight numbers and the capacity of each flight. I'm suppose to keep track of two lists, one for the booked passengers and one for the waiting list passengers.

How do I link this information with the hash table? Would each node have two skip lists link to it? Or one list?

Please someone help me. I've searched C++ books but I could not find any similar example anywhere.
Thank you,
Lily

Topic: Java help real urgent Previous Topic   Next Topic Topic: WriteByte in new line

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use