Jump to content
Larry Ullman's Book Forums
Sign in to follow this  
Necuima

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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...