diff --git a/graphs_trees/bst/bst.py b/graphs_trees/bst/bst.py index 9b23e8e2..ea84f684 100644 --- a/graphs_trees/bst/bst.py +++ b/graphs_trees/bst/bst.py @@ -1,3 +1,9 @@ +#coding question using bst +#Binary Search Tree is a node-based binary tree data structure which has the following properties: +#The left subtree of a node contains only nodes with keys lesser than the node’s key. +#The right subtree of a node contains only nodes with keys greater than the node’s key. +#The left and right subtree each must also be a binary search tree. + class Node(object): def __init__(self, data): @@ -40,4 +46,4 @@ def _insert(self, node, data): node.right.parent = node return node.right else: - return self._insert(node.right, data) \ No newline at end of file + return self._insert(node.right, data) diff --git a/sorting_searching/merge_sort/test_merge_sort.py b/sorting_searching/merge_sort/test_merge_sort.py index e1d8fd9e..47daca56 100644 --- a/sorting_searching/merge_sort/test_merge_sort.py +++ b/sorting_searching/merge_sort/test_merge_sort.py @@ -1,3 +1,6 @@ +#Like QuickSort, Merge Sort is a Divide and Conquer algorithm. +#It divides input array in two halves, calls itself for the two halves and then merges the two sorted halves. + from nose.tools import assert_equal, assert_raises @@ -28,4 +31,4 @@ def main(): if __name__ == '__main__': - main() \ No newline at end of file + main()