diff --git a/pydatastructs/linear_data_structures/linked_lists.py b/pydatastructs/linear_data_structures/linked_lists.py index eed58779d..083fc0af5 100644 --- a/pydatastructs/linear_data_structures/linked_lists.py +++ b/pydatastructs/linear_data_structures/linked_lists.py @@ -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. """ @@ -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. """ @@ -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. """ @@ -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. """ @@ -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. """ diff --git a/pydatastructs/trees/binary_trees.py b/pydatastructs/trees/binary_trees.py index 53df522b4..b6713fb30 100644 --- a/pydatastructs/trees/binary_trees.py +++ b/pydatastructs/trees/binary_trees.py @@ -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. @@ -80,6 +83,7 @@ def insert(self, key, data=None): key The key for comparison. + data The data to be inserted. @@ -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 @@ -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 @@ -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. @@ -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 ======= diff --git a/pydatastructs/trees/heaps.py b/pydatastructs/trees/heaps.py index 1fa0e88cd..c3f95e902 100644 --- a/pydatastructs/trees/heaps.py +++ b/pydatastructs/trees/heaps.py @@ -142,6 +142,7 @@ def insert(self, key, data=None): key The key for comparison. + data The data to be inserted. @@ -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. """ @@ -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. diff --git a/pydatastructs/trees/m_ary_trees.py b/pydatastructs/trees/m_ary_trees.py index 8f4c2ac97..97c90bb28 100644 --- a/pydatastructs/trees/m_ary_trees.py +++ b/pydatastructs/trees/m_ary_trees.py @@ -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 @@ -73,6 +77,7 @@ def insert(self, key, data=None): key The key for comparison. + data The data to be inserted. @@ -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. @@ -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 diff --git a/pydatastructs/trees/space_partitioning_trees.py b/pydatastructs/trees/space_partitioning_trees.py index 495c714bc..c34ce7e35 100644 --- a/pydatastructs/trees/space_partitioning_trees.py +++ b/pydatastructs/trees/space_partitioning_trees.py @@ -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. diff --git a/pydatastructs/utils/misc_util.py b/pydatastructs/utils/misc_util.py index c6f0dd390..f7c492bc8 100644 --- a/pydatastructs/utils/misc_util.py +++ b/pydatastructs/utils/misc_util.py @@ -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 @@ -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. @@ -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 ==== @@ -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 ====