2-4 trees in C


 
Thread Tools Search this Thread
Top Forums Programming 2-4 trees in C
Prev   Next
# 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?
 
Login or Register to Ask a Question

Previous Thread | Next Thread

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
Login or Register to Ask a Question
MSGFMT_SET_PATTERN(3)							 1						     MSGFMT_SET_PATTERN(3)

MessageFormatter::setPattern - Set the pattern used by the formatter

	Object oriented style

SYNOPSIS
public bool MessageFormatter::setPattern (string $pattern) DESCRIPTION
Procedural style bool msgfmt_set_pattern (MessageFormatter $fmt, string $pattern) Set the pattern used by the formatter PARAMETERS
o $fmt - The message formatter o $pattern - The pattern string to use in this message formatter. The pattern uses an 'apostrophe-friendly' syntax; it is run through umsg_autoQuoteApostrophe before being interpreted. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 msgfmt_set_pattern(3) example <?php $fmt = msgfmt_create( "en_US", "{0, number} monkeys on {1, number} trees" ); echo "Default pattern: '" . msgfmt_get_pattern( $fmt ) . "' "; echo "Formatting result: " . msgfmt_format( $fmt, array(123, 456) ) . " "; msgfmt_set_pattern( $fmt, "{0, number} trees hosting {1, number} monkeys" ); echo "New pattern: '" . msgfmt_get_pattern( $fmt ) . "' "; echo "Formatted number: " . msgfmt_format( $fmt, array(123, 456) ) . " "; ?> Example #2 OO example <?php $fmt = new MessageFormatter( "en_US", "{0, number} monkeys on {1, number} trees" ); echo "Default pattern: '" . $fmt->getPattern() . "' "; echo "Formatting result: " . $fmt->format(array(123, 456)) . " "; $fmt->setPattern("{0, number} trees hosting {1, number} monkeys" ); echo "New pattern: '" . $fmt->getPattern() . "' "; echo "Formatted number: " . $fmt->format(array(123, 456)) . " "; ?> The above example will output: Default pattern: '{0,number} monkeys on {1,number} trees' Formatting result: 123 monkeys on 456 trees New pattern: '{0,number} trees hosting {1,number} monkeys' Formatted number: 123 trees hosting 456 monkeys SEE ALSO
msgfmt_create(3), msgfmt_get_pattern(3). PHP Documentation Group MSGFMT_SET_PATTERN(3)