Write the pseudocode for a recursive function TERNARY TO BINARY, that will convert a ternary tree into a binary search tree.© BrainMass Inc. brainmass.com November 24, 2021, 11:18 am ad1c9bdddf
I recommend reading the attached file; it's the same as below but with nicer formatting :-)
Your problem is to write a psuedocode algorithm which will take in a ternary search tree and convert it into a binary search tree.
Recall that a ternary search tree is just a binary search tree where each node has an extra child. I will assume for this problem that in your binary search tree, a matching node becomes the right child; you can easily modify the algorithm if your teacher prefers it to be the left child.
Let's start with just the most basic psuedocode:
set binary_node_1 = ternary_node_1
The expert writes pseudocodes for a recursive function. The expert converts a ternary tree into a binary search tree.