Abt Binary Search Trees

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Oct 2009
Posts: 2
Reputation: ging ging is an unknown quantity at this point 
Solved Threads: 0
ging ging ging ging is offline Offline
Newbie Poster

Abt Binary Search Trees

 
0
  #1
Oct 17th, 2009
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 ...


  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. }
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 440
Reputation: Agni is a jewel in the rough Agni is a jewel in the rough Agni is a jewel in the rough 
Solved Threads: 68
Sponsor
Agni's Avatar
Agni Agni is offline Offline
Posting Pro in Training
 
0
  #2
Oct 17th, 2009
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.
thanks
-chandra
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC