Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

data made optional in public API #249

Merged
merged 5 commits into from
Apr 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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