Skip to content

Dico200/binary-tree-challenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Binary Tree Challenge

The reconstruct_binary_tree.cpp file contains 2 challenges involving binary trees.
Its main function creates a binary tree and prints out its contents one-dimensionally in 4 different orders: pre-order, in-order, post-order and level-order.
The 4 different orders are implemented in the file (treelist function) and can be examined there.

The challenges are:

  1. Reconstruct an identical tree using the pre-order and in-order list.
  2. Reconstruct an identical tree using the in-order and level-order list.

The main function prints out all lists of the tree, as well as those of the trees returned by your solutions, and indicates if the solution was successful.

Output looks like this:

pre:   A, B, D, E, C, F, G
in:    D, B, E, A, F, C, G
post:  D, E, B, F, G, C, A
level: A, B, C, D, E, F, G
== challenge1 output:
pre:
in:
post:
level:
success: false
== challenge2 output:
pre:
in:
post:
level:
success: false

More test cases may be added.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published