0

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();
      }
2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by Agni
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.