Run Code  | Code Wall  | Users  | Misc  | Feedback  | About  | Login  | Theme  | Privacy 

bst - lot of methods

Language: Layout:
+ ] Show input
Compilation time: 0.14 sec, absolute running time: 0.12 sec, cpu time: 0.11 sec, average memory usage: 16 Mb, average nr of threads: 4 
edit mode |  history  | discussion
10
10
15
10
0
contains tests:
ASSERT: PASS: 10 exists
10
0
5
ASSERT: PASS: 4 does not exist
10
15
ASSERT: PASS: 20 exists
10
ASSERT: PASS: 0 exists
10
15
20
ASSERT: PASS: 100 does not exist
find min tests:
ASSERT: PASS: 0 is the minumim
find max tests:
ASSERT: FAIL: 20 is the maximum
level-order traversal - can be used for printing the tree:
10 0 15 5 20 

pre-order traversal
10 0 5 15 20 
in-order traversal - can be used for sorting the tree:
0 5 10 15 20 
post-order traversal
20 15 10 5 0 
is binary tree?
left 0 10 True
left 5 10 True
right 15 10 True
right 20 10 True
right 5 0 True
right 20 15 True
ASSERT: PASS: this is a binary tree

is binary tree? (efficient method)
ASSERT: PASS: this is a binary tree