Member Avatar

Ive made my binary tree in the following format [code=C] typedef struct node { int info; struct node *left; struct node *right; }*nodeptr; [/code] Im looking for a function that will accept the root pointer and print the tree in a graphical format. for eg. i want the output to be _____5 _____/\ ____3__7 ____/__/\ ___2__6_8 _________\ __________9 How can i get such and output (without the underscores .. given only because spaces cannot be detected.) Please Help!!

Member Avatar
+1 forum 12
Member Avatar

Suppose we have two array inorder and preorder containing the elements in the said format. Using these two arrays how can i generate the binary tree?? Any help on the algorithm to be followed will be highly appreciated. For eg: inorder is : 2 3 4 5 6 7 8 preorder is : 5 3 2 4 7 6 8 then the Binary tree shld be ________5 ________/\ _______3_7 _______/\_/\ ______2_4 6_8 How can i form this binary tree?? i know the algorithm by hand but how do i implement it in C??

Member Avatar
+0 forum 8
Member Avatar

I have a broadband connection that i want to dial at a specific time automatically. Can anyone tell me how to do it?? Its Urgent.. Please help

Member Avatar
+0 forum 3
Member Avatar

Ive written the following simple code to find the addresses of the varialbles [code=C] #include<stdio.h> int main() { int a; int b; char c; float d; printf("\nInt : %x\nInt : %x\nChar : %x\nfloat : %x",&a,&b,&c,&d); return 0; } /* OUTPUT Int : 12ff4c Int : 12ff48 Char : 12ff47 float : 12ff40 */ [/code] My Question is why is there an extra gap of 3 in the memory??

Member Avatar
+0 forum 3
Member Avatar

Suppose i have a random permutation of 0,1,...., N-1. Now if i want to get the identity mapping from this can i do anything better than sorting?? I mean, sorting does not take into fact that all nos from 0 to N-1 are in the array or not. But in this case as we know that all the nos from 0 to N-1 are present...can I get a better algorithm and just sorting the array?? Please Help

Member Avatar
+0 forum 5

The End.