944,045 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 322
  • C++ RSS
Oct 17th, 2009
0

Abt Binary Search Trees

Expand Post »
Write a program that will allow randomized 0..100 numbers and the 15 generated numbers will serve as the input to ur binary search tree. The program should then print out the contents of your BST using preorder, inorder, and postorder traversals, store the result in the text file ( bst.txt)Recall the convention to place any duplicate number in the left subtree of that letter.

So far ive only done the randomize process... help me do the other parts...please any idea will help... or if you give the code much better,,,

Thx ...


C++ Syntax (Toggle Plain Text)
  1. #include<stdlib.h>
  2. #include<iostream.h>
  3. #include<conio.h>
  4.  
  5. int main()
  6.  
  7. {
  8.  
  9. clrscr();
  10.  
  11. srand((unsigned)time(0));
  12. int random_integer = rand();
  13.  
  14. for(int index=0; index<15; index++) {
  15. random_integer = (rand()%100)+1;
  16. cout << random_integer << endl;
  17. }
  18. getch();
  19. }
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ging ging is offline Offline
2 posts
since Oct 2009
Oct 17th, 2009
0
Re: Abt Binary Search Trees
Unfortunately you havn't done enough to make us help u... you can find out a lot of material about tree traversal here, infact you can see similar threads at the bottom of this page too. Read them and you should be able to do a lot more than this. Post your code then if you face any issues.
Featured Poster
Reputation Points: 431
Solved Threads: 116
Practically a Master Poster
Agni is offline Offline
654 posts
since Dec 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Creating ouput files dynamically - (File I/O)
Next Thread in C++ Forum Timeline: ConvertToInt32 problem





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC