示例#1
0
    def test_contains1(self):
        size = 100
        input_arr = [0] * size
        for i in range(size):
            input_arr[i] = randint(-1000, 1000)

        tree = UnbalancedBinarySearchTree()
        for v in input_arr:
            tree.add(v)

        value = 1001
        self.assertFalse(tree.contains(value))
示例#2
0
    def _check(self, input_arr):
        tree = UnbalancedBinarySearchTree()

        for v in input_arr:
            tree.add(v)

        input_arr.sort()
        i = 0
        for p in tree:
            if p != input_arr[i]:
                return False
            i += 1
        return True