Visit Our UNIX and Linux User Community


2-4 trees in C


 
Thread Tools Search this Thread
Top Forums Programming 2-4 trees in C
# 1  
Old 10-30-2009
2-4 trees in C

i am trying to write a program in order to learn how to work with trees and especially 2-4 trees.
the general idea is that each node is represented by 4 cells and 5 pointers? (maybe 2 arrays then? )
let's suppose that we insert simply int numbers in all cells.
firstly we initialize the root (==null ? )
then we fill up all 4 cells of the first node and we must have its 4 int numbers in numerical order?and what happens when we want to insert a 5th element?

of course i don't expect every question answered(as there is only 1 total answer i suppose) but a brief explanation would really help.maybe a link to a tutorial would also be very helpful.


//important: how can i separate internal nodes from leaf nodes?let's suppose that each pointer in the leaf level must point to another array(one level lower that is)which may contain also 4 cells with another type(int or char * etc)...how can i write and create this separation?maybe two structs or can i do that with just one struct and flag variables?
# 2  
Old 10-30-2009
Here is one tutorial - Tutorial on (2,4)-trees
# 3  
Old 11-02-2009
Quote:
Originally Posted by fpmurphy
Here is one tutorial - Tutorial on (2,4)-trees
thank you i will check itSmilie

Previous Thread | Next Thread
Test Your Knowledge in Computers #543
Difficulty: Easy
A global variable can be accessed and referenced on every line of code.
True or False?

5 More Discussions You Might Find Interesting

1. What is on Your Mind?

From little Acorns big trees grow...

Hi all... This is mainly for Corona688: Do yo remember your translation of a DFT into AWK code? Well it reached 130 dls inside the first 14 days, but take a look at it now. Aminet - dev/gcc/DFT-FFT.awk.txt (0 Replies)
Discussion started by: wisecracker
0 Replies

2. Slackware

What is the medium usually used to backup large trees?

Hi: What's asked. (2 Replies)
Discussion started by: stf92
2 Replies

3. Shell Programming and Scripting

How to copy very large directory trees

I have constant trouble with XCOPY/s for multi-gigabyte transfers. I need a utility like XCOPY/S that remembers where it left off if I reboot. Is there such a utility? How about a free utility (free as in free beer)? How about an md5sum sanity check too? I posted the above query in another... (3 Replies)
Discussion started by: siegfried
3 Replies

4. Shell Programming and Scripting

CGI , Perl and Trees

I have been trying to get this for weeks now but maybe someone knows or has a snippet of code to display a collapsible tree view. something like this: +Yahoo! -/site.html -/site2.html +Google -/site.php -/site2.php (1 Reply)
Discussion started by: Dabheeruz
1 Replies

5. Shell Programming and Scripting

Best way to diff two huge directory trees

Hi I have a job that will be running nightly incremental backsup of a large directory tree. I did the initial backup, now I want to write a script to verify that all the files were transferred correctly. I did something like this which works in principle on small trees: diff -r -q... (6 Replies)
Discussion started by: same1290
6 Replies

Featured Tech Videos