@@ -25,19 +25,22 @@ class BinaryTree(object):
25
25
Parameters
26
26
==========
27
27
28
+ key
29
+ Required if tree is to be instantiated with
30
+ root otherwise not needed.
31
+
28
32
root_data
29
33
Optional, the root node of the binary tree.
30
34
If not of type TreeNode, it will consider
31
35
root as data and a new root node will
32
36
be created.
33
- key
34
- Required if tree is to be instantiated with
35
- root otherwise not needed.
37
+
36
38
comp: lambda/function
37
39
Optional, A lambda function which will be used
38
40
for comparison of keys. Should return a
39
41
bool value. By default it implements less
40
42
than operator.
43
+
41
44
is_order_statistic: bool
42
45
Set it to True, if you want to use the
43
46
order statistic features of the tree.
@@ -80,6 +83,7 @@ def insert(self, key, data=None):
80
83
81
84
key
82
85
The key for comparison.
86
+
83
87
data
84
88
The data to be inserted.
85
89
@@ -101,6 +105,7 @@ def delete(self, key, **kwargs):
101
105
key
102
106
The key of the node which is
103
107
to be deleted.
108
+
104
109
balancing_info: bool
105
110
Optional, by default, False
106
111
The information needed for updating
@@ -135,6 +140,7 @@ def search(self, key, **kwargs):
135
140
136
141
key
137
142
The key for searching.
143
+
138
144
parent: bool
139
145
If true then returns index of the
140
146
parent of the node with the passed
@@ -532,8 +538,10 @@ def lowest_common_ancestor(self, j, k, algorithm=1):
532
538
533
539
j: Node.key
534
540
Key of first node
541
+
535
542
k: Node.key
536
543
Key of second node
544
+
537
545
algorithm: int
538
546
The algorithm to be used for computing the
539
547
lowest common ancestor.
@@ -1213,13 +1221,14 @@ def breadth_first_search(self, node=None, strategy='queue'):
1213
1221
Parameters
1214
1222
==========
1215
1223
1216
- strategy : str
1217
- The strategy using which the computation has to happen.
1218
- By default, it is set 'queue'.
1219
1224
node : int
1220
1225
The index of the node from where the traversal has to be instantiated.
1221
1226
By default, set to, root index.
1222
1227
1228
+ strategy : str
1229
+ The strategy using which the computation has to happen.
1230
+ By default, it is set 'queue'.
1231
+
1223
1232
Returns
1224
1233
=======
1225
1234
0 commit comments