# converting ternary to binary

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 ad1c9bdddfhttps://brainmass.com/computer-science/searching/converting-ternary-binary-21179

#### Solution Preview

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:

TERNARY_TO_BINARY_1:

set binary_node_1 = ternary_node_1

...

#### Solution Summary

The expert writes pseudocodes for a recursive function. The expert converts a ternary tree into a binary search tree.