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

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -