Hello guys and gals,
I made a simple Binary search tree and traversed it using intraversal so that the list gets sorted. Here is what I did.
Now actually I want to look at the efficiency of the method, for that I used difftime function. But whatever number of elements I enter, the result is same 0.000000seconds. I was thinking of making the output something like MK27 has shown(elapsed time) in here(post no.14). How can I do that such that the time taken to sort the list is also displayed correctly in the output. I hope I made myself clear.
#define MAX 25
struct node *left;
struct node *right;
typedef struct node *vish;
vish maketree(int x)
void setleft(vish p,int x)
void setright(vish p,int x)
void intrav(vish tree)
printf("Enter the number of elements in the tree\n");
printf("Enter elements one by one");
printf("The elements you entered are\n");
printf("\n\nTime taken to sort %f",difftime(second,first));