algorithm - Sort alphabet letters using a Binary tree -


i came across interview question states: how represent letters a, b, c, d, e, f , g in sorted order using binary tree representation?

it's stumped me. if take g root of tree left child e , right child f right subtree "greater than" left subtree. node e, left child , right child b , f's left child c , right child d.

is correct or else have different answer?

the binary tree described binary heap, used implement priority queue.

instead, use binary search tree, keeps keys in sorted order.


Comments

Popular posts from this blog

javascript - Trigger mouseenter when an animated element touches mouse -

json - Zend error Connection -

java - Using Spring @Transactional with a combination of readOnly and write, when does this entity get committed? -