From b2bc6c96f3dcde37d3dbb5934ad9972103bab515 Mon Sep 17 00:00:00 2001 From: Harsheet Kakar <42893005+HarsheetKakar@users.noreply.github.com> Date: Mon, 6 Apr 2020 21:08:04 +0530 Subject: [PATCH] `data` made optional in public API (#249) --- pydatastructs/trees/binary_trees.py | 6 +++--- pydatastructs/trees/heaps.py | 4 ++-- pydatastructs/trees/m_ary_trees.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pydatastructs/trees/binary_trees.py b/pydatastructs/trees/binary_trees.py index e197d63ba..b475e6cab 100644 --- a/pydatastructs/trees/binary_trees.py +++ b/pydatastructs/trees/binary_trees.py @@ -61,7 +61,7 @@ def __new__(cls, key=None, root_data=None, comp=None, obj.is_order_statistic = is_order_statistic return obj - def insert(self, key, data): + def insert(self, key, data=None): """ Inserts data by the passed key using iterative algorithm. @@ -206,7 +206,7 @@ def _update_size(self, start_idx): self.right_size(self.tree[walk]) + 1) walk = self.tree[walk].parent - def insert(self, key, data): + def insert(self, key, data=None): res = self.search(key) if res is not None: self.tree[res].data = data @@ -715,7 +715,7 @@ def _balance_insertion(self, curr, last): path.append(walk), path.append(last) walk = self.tree[walk].parent - def insert(self, key, data): + def insert(self, key, data=None): super(AVLTree, self).insert(key, data) self._balance_insertion(self.size - 1, self.tree[self.size-1].parent) diff --git a/pydatastructs/trees/heaps.py b/pydatastructs/trees/heaps.py index 4d6eb1ad5..45d0bc4eb 100644 --- a/pydatastructs/trees/heaps.py +++ b/pydatastructs/trees/heaps.py @@ -129,7 +129,7 @@ def _heapify(self, i): else: break - def insert(self, key, data): + def insert(self, key, data=None): """ Insert a new element to the heap according to heap property. @@ -440,7 +440,7 @@ def merge(self, other_heap): j += 1 self.root_list = new_root_list - def insert(self, key, data): + def insert(self, key, data=None): """ Inserts new node with the given key and data. diff --git a/pydatastructs/trees/m_ary_trees.py b/pydatastructs/trees/m_ary_trees.py index f0a4d389a..75b622515 100644 --- a/pydatastructs/trees/m_ary_trees.py +++ b/pydatastructs/trees/m_ary_trees.py @@ -59,7 +59,7 @@ def __new__(cls, key=None, root_data=None, comp=None, obj.is_order_statistic = is_order_statistic return obj - def insert(self, key, data): + def insert(self, key, data=None): """ Inserts data by the passed key using iterative algorithm.