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 ...

#include<stdlib.h>
#include<iostream.h>
#include<conio.h>

int main()

      {

      clrscr();

      srand((unsigned)time(0));
      int random_integer = rand();

      for(int index=0; index<15; index++) {
	random_integer = (rand()%100)+1;
      cout << random_integer << endl;
	}
      getch();
      }

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.