Esempio n. 1
0
 def test_items_level_order_with_7_numbers(self):
     # Create a complete binary search tree of 7 items in level-order
     items = [4, 2, 6, 1, 3, 5, 7]
     tree = BinarySearchTree(items)
     # Ensure the level-order traversal of tree items is ordered correctly
     assert tree.items_level_order() == [4, 2, 6, 1, 3, 5, 7]
Esempio n. 2
0
 def test_items_level_order_with_3_strings(self):
     # Create a complete binary search tree of 3 strings in level-order
     items = ['B', 'A', 'C']
     tree = BinarySearchTree(items)
     # Ensure the level-order traversal of tree items is ordered correctly
     assert tree.items_level_order() == ['B', 'A', 'C']