Click here to Skip to main content
15,889,116 members
Home / Discussions / Algorithms
   

Algorithms

 
AnswerRe: Answer for this algorithm Pin
CPallini13-Apr-07 4:37
mveCPallini13-Apr-07 4:37 
GeneralRe: Answer for this algorithm Pin
MoustafaS13-Apr-07 4:40
MoustafaS13-Apr-07 4:40 
AnswerRe: Answer for this algorithm [modified] Pin
Leslie Sanford13-Apr-07 4:46
Leslie Sanford13-Apr-07 4:46 
AnswerRe: Answer for this algorithm Pin
cp987613-Apr-07 4:47
cp987613-Apr-07 4:47 
GeneralRe: Answer for this algorithm Pin
MoustafaS13-Apr-07 4:51
MoustafaS13-Apr-07 4:51 
GeneralRe: Answer for this algorithm Pin
cp987613-Apr-07 4:59
cp987613-Apr-07 4:59 
GeneralRe: Answer for this algorithm Pin
MoustafaS13-Apr-07 5:02
MoustafaS13-Apr-07 5:02 
QuestionSkip List Indexing Pin
Leslie Sanford12-Apr-07 5:55
Leslie Sanford12-Apr-07 5:55 
A few years ago, I wrote a Skip List[^] class in C#. I've found this data structure to be handy. For one thing, it's easily adapted to a priority queue[^].

What I'd like to do is add the ability to access items in the skip list by index, e.g. give me the n'th item in the list. This is easy enough to do in O(N) time by simply starting at the beginning of the list and moving one by one through the list until you've reached the desired item. I was looking for a better way. Kunth decribes a way to do this with binary search trees. I'd like to find the equivalent algorithm for skip lists.

William Pugh, the skip list's inventor, decribes a way in his skip list cookbook[^]. But his algorithm assumes the existance of a "distance" field in each node. The distance field represents the next nodes position minus the current nodes position.

I didn't find this very helpful. It requires each node and each pointer level to know their position in the list. Well, if they know that already, then it's easy enough to search for the specified item by position to begin with.

It would be easy enough to add a position field to each node. The position would represent the node's index into the list. The problem becomes trying to maintain this field as items are added and removed from the list. Descructive operations will make the position value of all subsequent nodes invalid.

This may be a problem where there isn't a solution, at least not one that works as well as the binary search tree approach. Anyway, I'd appreciate any insights.
AnswerRe: Skip List Indexing Pin
Luc Pattyn12-Apr-07 9:30
sitebuilderLuc Pattyn12-Apr-07 9:30 
GeneralRe: Skip List Indexing Pin
Leslie Sanford12-Apr-07 10:44
Leslie Sanford12-Apr-07 10:44 
QuestionThe Perfect Circle Pin
Bassam Abdul-Baki10-Apr-07 4:15
professionalBassam Abdul-Baki10-Apr-07 4:15 
AnswerRe: The Perfect Circle Pin
Paddy Boyd12-Apr-07 2:57
Paddy Boyd12-Apr-07 2:57 
QuestionLp,BP,HP filters design in C# Pin
Keleistein9-Apr-07 20:44
Keleistein9-Apr-07 20:44 
AnswerRe: Lp,BP,HP filters design in C# Pin
Roger Wright10-Apr-07 8:21
professionalRoger Wright10-Apr-07 8:21 
GeneralRe: Lp,BP,HP filters design in C# Pin
cp987611-Apr-07 1:46
cp987611-Apr-07 1:46 
Questionsome probability problem ? Pin
codeprojecter_8-Apr-07 23:56
codeprojecter_8-Apr-07 23:56 
AnswerRe: some probability problem ? Pin
cp98769-Apr-07 2:34
cp98769-Apr-07 2:34 
Questionconvert arrays of number to an integer Pin
Khodadad Pakdamans8-Apr-07 22:17
Khodadad Pakdamans8-Apr-07 22:17 
AnswerRe: convert arrays of number to an integer Pin
Luc Pattyn8-Apr-07 23:38
sitebuilderLuc Pattyn8-Apr-07 23:38 
GeneralRe: convert arrays of number to an integer Pin
cp98769-Apr-07 19:26
cp98769-Apr-07 19:26 
Questionan interesting program,please help Pin
Khodadad Pakdamans8-Apr-07 20:10
Khodadad Pakdamans8-Apr-07 20:10 
AnswerRe: an interesting program,please help Pin
cp98768-Apr-07 20:34
cp98768-Apr-07 20:34 
GeneralRe: an interesting program,please help Pin
Khodadad Pakdamans8-Apr-07 22:12
Khodadad Pakdamans8-Apr-07 22:12 
GeneralRe: an interesting program,please help Pin
DQNOK14-Apr-07 12:04
professionalDQNOK14-Apr-07 12:04 
QuestionQuadratic Rule Urgent Help needed Pin
pHysiX8-Apr-07 0:50
pHysiX8-Apr-07 0:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.