Tech moves fast! Stay ahead of the curve with Techopedia!
Join nearly 200,000 subscribers who receive actionable tech insights from Techopedia.
In computer science, a ternary tree is a type of tree data structure where each node can have up to three derivative nodes. This is in contrast to a binary tree, where each node can have either one or two derivative nodes.
In a tree data structure, algorithm experts often use the names "parent" and "child" nodes to describe elements of the tree that derive from each other. In a ternary tree, the parent node can have up to three child nodes, which are often labeled as the "left," "middle" and "right" node, respectively. Certain types of metadata may reside in these derivative nodes.
Because the ternary tree is a more sophisticated model than a binary tree, it can be more suitable for some types of ordered searches and other operations. A ternary structure can also be used for a data heap or for filtering data for some algorithmic operation.