Skip to content

yew011/Binary_Tree_Constructor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Base (Abstract) Class => Binary_Tree,
--- member variable:
    - the number of levels,
    - the number of nodes, only valid for complete tree,
    - the selection option: level_node_
    - the complete flag, bool type
    - the tree_root_, not allowed to be set by user, the tree begins from tree_root_+1 (for easier implementation)

--- member function:
    - virtual function => construct_, return the pointer to the node
    - virtual function => print the tree, (BFS)


Ordinary_Binary_Tree : Binary_Tree
--- member variable:
    - none

--- member function:
    - construct_: construct the tree, return the pointer to the root.
    - print_:	  print the tree in amazingly beautiful form.


Example of Generated Tree (Output from print_ function) :D~

Complete Tree:
     B
   /   \
  C     D
 / \   / \
E   F G   H

Complete Tree:
                       B
            /                     \
           C                       D
      /         \             /         \
     E           F           G           H
   /   \       /   \       /   \       /   \
  I     J     K     L     M     N     O     P
 / \   / \   / \   / \   / \   / \   / \   / \
Q   R S   T U   V W   X Y   Z [   \ ]   ^ _   `


Incomplete Tree:
                       B
            /                     \
           C                       D
                \             /         \
                 E           F           G
               /   \       /               \
              H     I     J                 K
             / \   /     / \                  
            L   M N     O   P                  

Incomplete Tree:
                       B
            /                     \
           C                       D
      /                       /         \
     E                       F           G
       \                       \       /   \
        H                       I     J     K
       / \                     /     /       \
      L   M                   N     O         P

About

Set of classes for generating various types of binary trees

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages