Jump to content
Larry Ullman's Book Forums

A Review And Pursue Suggestion - Binary Tree


Recommended Posts

Hi Larry,

 

As per your "Tips" on page 351, I found the binary tree suggestion in the 4th bullet point a really good one to get a better understanding of  memory management as well as using recursion in C.

 

Thanks for the suggestion.

 

My little program reads in a text file with some words in it, parses out the words and then adds them to a binary tree stored in alphabetic word order.  If the word is already in the tree, it adds to a counter of that word; if it is not in the tree it adds it and sets the count for that word to one.

 

At the end of the file, the program prints out the words in the tree in alphabetic order plus the word counts and then deletes all the nodes of the tree.

 

I found this exercise to be a great one in the spirit of 'revue and pursue'.

 

Cheers from Oz.

Link to comment
Share on other sites

 Share

×
×
  • Create New...