A Ternary Tree (T) is a tree in which every non terminal node has at most 3 children.

We will use T to simulate the following activity:

A set of P candidates must pass a set of exams ordered in an array of N exam codes (an exam code is an array of char). For a given exam, a candidate can be in one of the 3 following cases: success, failure or non-passed exam yet. Thus, every T node represents an exam with: exam code as root, succeeded candidates as left child, failed candidates as right child and in the middle whose didnâ€™t pass exam yet. The following figure depicts 2 exams and the situation of 10 candidates: how to write it :)

deceptikon 1,790

Sokurenko 42

deceptikon 1,790

ziziBA -3

WaltP 2,905

Sokurenko 42

WaltP 2,905

WaltP 2,905

deceptikon 1,790

WaltP
commented:
True, but he DID offer working code -- which is cheating. +0

ziziBA -3

WaltP
commented:
All this talk about cheating meant nothing to you, obviously... -3

ziziBA -3

ziziBA -3