I know how to convert from a general tree to a binary tree just fine,
a a
/ | \ /
b c d -> b
\
c
\
d
I was just asked how to convert from a general tree to a binary search tree though. My thoughts are that the person who asked me either didn't mean binary search tree (I asked him, he said he did), or he's misunderstanding something from his class notes. In any case, has anyone heard of doing this? General tree to binary search tree? The answer I gave him was first convert to a binary tree then sort it to get a binary search tree. Is this correct?
Copyright Notice:Content Author:「Captain Man」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/16086958/is-there-a-way-to-convert-from-a-general-tree-to-binary-search-tree