From 5b5b7eaf31985ce5275bd44a538e705194f3d304 Mon Sep 17 00:00:00 2001 From: monvin <97kilogram@gmail.com> Date: Wed, 2 Oct 2019 16:49:15 +0530 Subject: [PATCH 1/3] Update bst.py --- graphs_trees/bst/bst.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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) From e4dcc465dfdf5147f4fa4e590e99eb39032e2a13 Mon Sep 17 00:00:00 2001 From: monvin <97kilogram@gmail.com> Date: Wed, 2 Oct 2019 16:56:49 +0530 Subject: [PATCH 2/3] Update test_merge_sort.py --- sorting_searching/merge_sort/test_merge_sort.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sorting_searching/merge_sort/test_merge_sort.py b/sorting_searching/merge_sort/test_merge_sort.py index e1d8fd9e..f7322796 100644 --- a/sorting_searching/merge_sort/test_merge_sort.py +++ b/sorting_searching/merge_sort/test_merge_sort.py @@ -1,3 +1,7 @@ +#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. +#The merge() function is used for merging two halves. + from nose.tools import assert_equal, assert_raises @@ -28,4 +32,4 @@ def main(): if __name__ == '__main__': - main() \ No newline at end of file + main() From fc91acf34b4854cd3c7cbe97474086eae9b594ed Mon Sep 17 00:00:00 2001 From: monvin <97kilogram@gmail.com> Date: Wed, 2 Oct 2019 16:59:08 +0530 Subject: [PATCH 3/3] Update test_merge_sort.py --- sorting_searching/merge_sort/test_merge_sort.py | 1 - 1 file changed, 1 deletion(-) diff --git a/sorting_searching/merge_sort/test_merge_sort.py b/sorting_searching/merge_sort/test_merge_sort.py index f7322796..47daca56 100644 --- a/sorting_searching/merge_sort/test_merge_sort.py +++ b/sorting_searching/merge_sort/test_merge_sort.py @@ -1,6 +1,5 @@ #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. -#The merge() function is used for merging two halves. from nose.tools import assert_equal, assert_raises