I just have a general question. How would a threaded binary tree output in the three transversals: inorder, postorder, and preorder?
I know in a regular binary tree pre would start at the first element and go in direct order and inoder would skip around then go back the second time around to get the other elements it missed. But with a threaded tree, wouldn't it keep repeating the same things over and over in an endless loop because it would never be null or am I missing the point?
Yes. You need a check if a key is repeated and so it would test and know when to stop I'm guessing. So I'm assuming the output would be the same as a regular binary tree..
So if I see it right: 3, 5, 0 ,7 ,1 inputted would make the tree like
....3
../....\
0.......5
..\.......\
...1.......7
and the 0 left would still be NULL but the 3 and 7 connects to the 1 and 5 left stays NULL and 7 right stays NULL, if I get it right.
so when having it read in those numbers for output, say postorder, it would be: 1, 0, 7, 5, 3? or would the links make it go 1, 0, 7, 3, 5 for postorder?