Okay, so I've implemented preorder, postorder, and inorder traversals of a binary tree in C. I've found that inorder traversal is best for sorting a previously sorted tree after adding or deleting a node, because it allows for an optimized bubble sort that only moves one element. What are the respective advantages of preorder and postorder traversals? Is there a tutorial on data structure optimization somewhere?
1 reply to this topic
#1
Posted 20 August 2011 - 10:24 AM
Programming is a journey, not a destination.
|
|
|
#2
Posted 28 August 2011 - 07:09 AM
Quote
What are the respective advantages of preorder and postorder traversals?
Adding a sorted array to a bst causes an undesirable skewed tree. Searching/adding/removing values in a skewed tree can result in a change of O(LogN) to O(N).
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









