Click here to Skip to main content
15,893,487 members
Home / Discussions / Algorithms
   

Algorithms

 
GeneralRe: Shortest path related Pin
Luc Pattyn27-Oct-09 11:23
sitebuilderLuc Pattyn27-Oct-09 11:23 
GeneralRe: Shortest path related Pin
Alivemau527-Oct-09 12:58
Alivemau527-Oct-09 12:58 
GeneralRe: Shortest path related Pin
Member 419459329-Oct-09 13:31
Member 419459329-Oct-09 13:31 
GeneralRe: Shortest path related Pin
Luc Pattyn29-Oct-09 13:36
sitebuilderLuc Pattyn29-Oct-09 13:36 
AnswerRe: Shortest path related Pin
Member 419459327-Oct-09 14:05
Member 419459327-Oct-09 14:05 
AnswerRe: Shortest path related Pin
Member 419459327-Oct-09 14:17
Member 419459327-Oct-09 14:17 
AnswerRe: Shortest path related Pin
Member 419459327-Oct-09 18:02
Member 419459327-Oct-09 18:02 
QuestionBinary Search Tree "Floor" Search Pin
Bachowny22-Oct-09 1:44
Bachowny22-Oct-09 1:44 
I have a Red Black Tree in which is stored some 'sparse' keys. I might have e.g. {1, 11, 22, 31, 47, 63, 71} etc. The pattern is not important just the sparseness of keys.

What I would like to do is look up the 'closest without going over' key from my BST, which is in-fact the index into a very large array (>10M elements).

So for example if I'm looking for entry 55 using the above index, I would like to return the data stored at the node for 47, which is the best guess index for me to start searching my array for entry 55.

It sounds simple enough but I can't find code or even an algorithm outline anywhere. The closest thing I've seen involves searching for a range of values, but if I knew the range I'd need, I wouldn't need this index in the first place... more behind the scenes, know what I mean? Smile | :)

Couple of things:
* I don't know the indexes or the gaps between keys beforehand.
* This index is rebuilt very often (after array cut-paste operations).

In other words any 'workaround' solutions that don't directly answer my question need to be general enough and fast enough to deal with the problem. The index actually loses information as the array shrinks but the original indexes must be kept.

Hope I've made the problem simple and clear enough. Any help will be very much appreciated!
AnswerRe: Binary Search Tree "Floor" Search Pin
Alan Balkany22-Oct-09 3:45
Alan Balkany22-Oct-09 3:45 
AnswerRe: Binary Search Tree "Floor" Search Pin
Member 419459322-Oct-09 7:02
Member 419459322-Oct-09 7:02 
AnswerRe: Binary Search Tree "Floor" Search Pin
ely_bob27-Oct-09 6:58
professionalely_bob27-Oct-09 6:58 
AnswerRe: Binary Search Tree "Floor" Search Pin
Bachowny29-Oct-09 17:25
Bachowny29-Oct-09 17:25 
QuestionPixar Pin
David Crow16-Oct-09 5:14
David Crow16-Oct-09 5:14 
AnswerRe: Pixar Pin
Fatbuddha 116-Oct-09 5:39
Fatbuddha 116-Oct-09 5:39 
GeneralRe: Pixar Pin
David Crow16-Oct-09 5:42
David Crow16-Oct-09 5:42 
GeneralRe: Pixar Pin
Richard MacCutchan16-Oct-09 5:46
mveRichard MacCutchan16-Oct-09 5:46 
GeneralRe: Pixar Pin
Fatbuddha 116-Oct-09 5:47
Fatbuddha 116-Oct-09 5:47 
AnswerRe: Pixar Pin
harold aptroot16-Oct-09 5:53
harold aptroot16-Oct-09 5:53 
AnswerRe: Pixar Pin
Ray Cassick16-Oct-09 6:56
Ray Cassick16-Oct-09 6:56 
AnswerRe: Pixar Pin
Tim Craig16-Oct-09 18:25
Tim Craig16-Oct-09 18:25 
AnswerRe: Pixar Pin
ely_bob27-Oct-09 7:09
professionalely_bob27-Oct-09 7:09 
AnswerRe: Pixar Pin
enhzflep29-Oct-09 10:11
enhzflep29-Oct-09 10:11 
GeneralRe: Pixar Pin
David Crow29-Oct-09 10:23
David Crow29-Oct-09 10:23 
QuestionComparison or travel algorithm for n-ary tree Pin
sampath_dr13-Oct-09 1:46
sampath_dr13-Oct-09 1:46 
AnswerRe: Comparison or travel algorithm for n-ary tree Pin
Henry Minute13-Oct-09 3:46
Henry Minute13-Oct-09 3:46 

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.