Skip to content

Commit

Permalink
data made optional in public API (#249)
Browse files Browse the repository at this point in the history
  • Loading branch information
HarsheetKakar committed Apr 6, 2020
1 parent d05a6fb commit b2bc6c9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions pydatastructs/trees/binary_trees.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions pydatastructs/trees/heaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion pydatastructs/trees/m_ary_trees.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit b2bc6c9

Please sign in to comment.