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

Parameter order changed in docstrings #275

Merged
merged 1 commit into from
May 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
20 changes: 20 additions & 0 deletions pydatastructs/linear_data_structures/linked_lists.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ def insert_after(self, prev_node, key, data=None):
The node after which the
new node is to be inserted.

key
Any valid identifier to uniquely
identify the node in the linked list.

data
Any valid data to be stored in the node.
"""
Expand All @@ -69,6 +73,10 @@ def insert_at(self, index, key, data=None):
index: int
An integer satisfying python indexing properties.

key
Any valid identifier to uniquely
identify the node in the linked list.

data
Any valid data to be stored in the node.
"""
Expand Down Expand Up @@ -121,6 +129,10 @@ def appendleft(self, key, data=None):
Parameters
==========

key
Any valid identifier to uniquely
identify the node in the linked list.

data
Any valid data to be stored in the node.
"""
Expand All @@ -133,6 +145,10 @@ def append(self, key, data=None):
Parameters
==========

key
Any valid identifier to uniquely
identify the node in the linked list.

data
Any valid data to be stored in the node.
"""
Expand All @@ -149,6 +165,10 @@ def insert_before(self, next_node, key, data=None):
The node before which the
new node is to be inserted.

key
Any valid identifier to uniquely
identify the node in the linked list.

data
Any valid data to be stored in the node.
"""
Expand Down
21 changes: 15 additions & 6 deletions pydatastructs/trees/binary_trees.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,22 @@ class BinaryTree(object):
Parameters
==========

key
Required if tree is to be instantiated with
root otherwise not needed.

root_data
Optional, the root node of the binary tree.
If not of type TreeNode, it will consider
root as data and a new root node will
be created.
key
Required if tree is to be instantiated with
root otherwise not needed.

comp: lambda/function
Optional, A lambda function which will be used
for comparison of keys. Should return a
bool value. By default it implements less
than operator.

is_order_statistic: bool
Set it to True, if you want to use the
order statistic features of the tree.
Expand Down Expand Up @@ -80,6 +83,7 @@ def insert(self, key, data=None):

key
The key for comparison.

data
The data to be inserted.

Expand All @@ -101,6 +105,7 @@ def delete(self, key, **kwargs):
key
The key of the node which is
to be deleted.

balancing_info: bool
Optional, by default, False
The information needed for updating
Expand Down Expand Up @@ -135,6 +140,7 @@ def search(self, key, **kwargs):

key
The key for searching.

parent: bool
If true then returns index of the
parent of the node with the passed
Expand Down Expand Up @@ -532,8 +538,10 @@ def lowest_common_ancestor(self, j, k, algorithm=1):

j: Node.key
Key of first node

k: Node.key
Key of second node

algorithm: int
The algorithm to be used for computing the
lowest common ancestor.
Expand Down Expand Up @@ -1213,13 +1221,14 @@ def breadth_first_search(self, node=None, strategy='queue'):
Parameters
==========

strategy : str
The strategy using which the computation has to happen.
By default, it is set 'queue'.
node : int
The index of the node from where the traversal has to be instantiated.
By default, set to, root index.

strategy : str
The strategy using which the computation has to happen.
By default, it is set 'queue'.

Returns
=======

Expand Down
3 changes: 3 additions & 0 deletions pydatastructs/trees/heaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ def insert(self, key, data=None):

key
The key for comparison.

data
The data to be inserted.

Expand Down Expand Up @@ -174,6 +175,7 @@ def extract(self):
root_element : TreeNode
The TreeNode at the root of the heap,
if the heap is not empty.

None
If the heap is empty.
"""
Expand Down Expand Up @@ -524,6 +526,7 @@ def decrease_key(self, node, new_key):

node: BinomialTreeNode
The node whose key is to be reduced.

new_key
The new key of the given node,
should be less than the current key.
Expand Down
13 changes: 10 additions & 3 deletions pydatastructs/trees/m_ary_trees.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,26 @@ class MAryTree(object):
Parameters
==========

key
Required if tree is to be instantiated with
root otherwise not needed.

root_data
Optional, the root node of the binary tree.
If not of type MAryTreeNode, it will consider
root as data and a new root node will
be created.
key
Required if tree is to be instantiated with
root otherwise not needed.

comp: lambda
Optional, A lambda function which will be used
for comparison of keys. Should return a
bool value. By default it implements less
than operator.

is_order_statistic: bool
Set it to True, if you want to use the
order statistic features of the tree.

max_children
Optional, specifies the maximum number of children
a node can have. Defaults to 2 in case nothing is
Expand Down Expand Up @@ -73,6 +77,7 @@ def insert(self, key, data=None):

key
The key for comparison.

data
The data to be inserted.

Expand Down Expand Up @@ -100,6 +105,7 @@ def delete(self, key, **kwargs):

True
If the node is deleted successfully.

None
If the node to be deleted doesn't exists.

Expand All @@ -121,6 +127,7 @@ def search(self, key, **kwargs):

key
The key for searching.

parent: bool
If true then returns index of the
parent of the node with the passed
Expand Down
1 change: 1 addition & 0 deletions pydatastructs/trees/space_partitioning_trees.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ def query(self, qx, init_node=None):

qx: int/float
The query point

init_node: int
The index of the node from which the query process
is to be started.
Expand Down
16 changes: 8 additions & 8 deletions pydatastructs/utils/misc_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ class TreeNode(Node):
Parameters
==========

data
Any valid data to be stored in the node.
key
Required for comparison operations.
data
Any valid data to be stored in the node.
left: int
Optional, index of the left child node.
right: int
Expand Down Expand Up @@ -64,10 +64,10 @@ class CartesianTreeNode(TreeNode):
Parameters
==========

data
Any valid data to be stored in the node.
key
Required for comparison operations.
data
Any valid data to be stored in the node.
priority: int
An integer value for heap property.

Expand All @@ -92,10 +92,10 @@ class BinomialTreeNode(TreeNode):
Parameters
==========

data
Any valid data to be stored in the node.
key
Required for comparison operations.
data
Any valid data to be stored in the node.

Note
====
Expand Down Expand Up @@ -150,10 +150,10 @@ class MAryTreeNode(TreeNode):
Parameters
==========

data
Any valid data to be stored in the node.
key
Required for comparison operations.
data
Any valid data to be stored in the node.

Note
====
Expand Down