Click here to Skip to main content
15,891,184 members
Home / Discussions / Algorithms
   

Algorithms

 
AnswerRe: Random Number Generation Pin
73Zeppelin5-Nov-08 21:36
73Zeppelin5-Nov-08 21:36 
GeneralRe: Random Number Generation Pin
BobInNJ6-Nov-08 6:29
BobInNJ6-Nov-08 6:29 
GeneralRe: Random Number Generation Pin
73Zeppelin6-Nov-08 8:28
73Zeppelin6-Nov-08 8:28 
GeneralRe: Random Number Generation Pin
BobInNJ6-Nov-08 9:56
BobInNJ6-Nov-08 9:56 
GeneralRe: Random Number Generation Pin
73Zeppelin6-Nov-08 10:21
73Zeppelin6-Nov-08 10:21 
GeneralRe: Random Number Generation Pin
BobInNJ6-Nov-08 12:51
BobInNJ6-Nov-08 12:51 
GeneralRe: Random Number Generation [modified] Pin
73Zeppelin6-Nov-08 20:50
73Zeppelin6-Nov-08 20:50 
QuestionRecords and Clusters [modified] Pin
DQNOK5-Nov-08 4:40
professionalDQNOK5-Nov-08 4:40 
For many varied reasons, I decided to write my own balanced binary tree library. One feature of my library that I haven't seen in other freely available libraries is "clusters", and a "recluster" function.

The problem that I am attacking is that as elements are randomly added to the tree, the tree rotations that automatically happen to keep the tree balanced tend to spread the edge pointers all over the place. The end result is that in a large tree, a typical traversal can require reading nodes from all over physical memory (or disk pages): a very inefficient use of cache. By clustering several subtree "near the root nodes" together in physical memory, tree traversals can be sped-up significantly by keeping nodes that always get visited near one another within physical memory (or on the same disk page). For example, in a properly clustered tree, with clusters large enough to hold 4 levels of records (1+2+4+8 = 15 records), a tree of height 16 (>45000 records) can be traversed in only 4 cluster reads instead of 16 reads that might be required of a non-clustered tree.

What I don't know is a good way to measure how "out-of-cluster" a tree is. I'd like to be able to determine when a tree needs to be reclustered. I'm sure there is good theory out there for this; and the idea doesn't seem to be that difficult, but I haven't run onto the solution yet. I've spent a little bit of time googling for a method, and probably a couple of hours thinking about it. Nothing yet.

Any ideas or helpful links?

David
---------
Empirical studies indicate that 20% of the people drink 80% of the beer. With C++ developers, the rule is that 80% of the developers understand at most 20% of the language. It is not the same 20% for different people, so don't count on them to understand each other's code.
http://yosefk.com/c++fqa/picture.html#fqa-6.6

---------

modified on Wednesday, November 5, 2008 11:33 AM

AnswerRe: Records and Clusters Pin
Member 41945935-Nov-08 6:28
Member 41945935-Nov-08 6:28 
GeneralRe: Records and Clusters Pin
DQNOK5-Nov-08 6:56
professionalDQNOK5-Nov-08 6:56 
GeneralRe: Records and Clusters Pin
Member 41945935-Nov-08 7:44
Member 41945935-Nov-08 7:44 
GeneralRe: Records and Clusters Pin
DQNOK6-Nov-08 4:54
professionalDQNOK6-Nov-08 4:54 
GeneralRe: Records and Clusters Pin
Member 41945936-Nov-08 7:57
Member 41945936-Nov-08 7:57 
GeneralRe: Records and Clusters Pin
Member 419459325-Apr-09 4:28
Member 419459325-Apr-09 4:28 
GeneralRe: Records and Clusters Pin
DQNOK27-Apr-09 3:13
professionalDQNOK27-Apr-09 3:13 
GeneralRe: Records and Clusters Pin
DQNOK27-Apr-09 5:57
professionalDQNOK27-Apr-09 5:57 
GeneralRe: Records and Clusters Pin
Member 419459327-Apr-09 11:22
Member 419459327-Apr-09 11:22 
QuestionRePosted from C# Forums: A Job Exam Question Pin
Bulky Fellow4-Nov-08 20:31
Bulky Fellow4-Nov-08 20:31 
AnswerRe: RePosted from C# Forums: A Job Exam Question Pin
Arash Partow4-Nov-08 21:59
Arash Partow4-Nov-08 21:59 
AnswerRe: RePosted from C# Forums: A Job Exam Question Pin
Mark Churchill5-Nov-08 1:46
Mark Churchill5-Nov-08 1:46 
GeneralRe: RePosted from C# Forums: A Job Exam Question Pin
riced9-Nov-08 4:03
riced9-Nov-08 4:03 
GeneralRe: RePosted from C# Forums: A Job Exam Question Pin
Bulky Fellow9-Nov-08 7:45
Bulky Fellow9-Nov-08 7:45 
GeneralRe: RePosted from C# Forums: A Job Exam Question Pin
Mark Churchill9-Nov-08 11:33
Mark Churchill9-Nov-08 11:33 
QuestionTrammel method for constructing an ellipse Pin
hxhl9525-Oct-08 19:38
hxhl9525-Oct-08 19:38 
AnswerRe: Trammel method for constructing an ellipse Pin
73Zeppelin25-Oct-08 23:52
73Zeppelin25-Oct-08 23:52 

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.