We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b7c7372 commit a308e38Copy full SHA for a308e38
pygorithm/data_structures/tree.py
@@ -226,6 +226,11 @@ def postorder(self, root):
226
self._postorder.append(root.get_data()) # get the data of current node
227
return self._postorder
228
229
+ # easily retrieve the source code of the BSTNode class
230
+ def get_code(self):
231
+ import inspect
232
+ return inspect.getsource(BSTNode)
233
+
234
class BinarySearchTree(object):
235
def __init__(self):
236
self.root = None
@@ -260,3 +265,8 @@ def postorder(self):
260
265
print()
261
266
if self.root is not None:
262
267
return self.root.postorder(self.root)
268
269
+ # easily retrieve the source code of the BinarySearchTree class
270
271
272
+ return inspect.getsource(BinarySearchTree)
0 commit comments