-
Notifications
You must be signed in to change notification settings - Fork 313
Added LCA and tests #88
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
Changes from 9 commits
36de7f2
b894bce
8dd5d23
814daad
f9099ba
994e267
94817e0
a53d277
00ad7f7
f997c53
3fa3760
e37ee7d
94d879c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -415,6 +415,129 @@ def rank(self, x): | |||||
| walk = p | ||||||
| return r | ||||||
|
|
||||||
| def _simple_path(self, key, root, path=[]): | ||||||
| """ | ||||||
| Utility funtion to find the simple path between root and node. | ||||||
|
|
||||||
| Parameter | ||||||
| ========= | ||||||
|
|
||||||
| key: | ||||||
| node to be searched | ||||||
|
|
||||||
| path: | ||||||
|
||||||
| Stores path from root to the node to be found | ||||||
|
|
||||||
| Returns | ||||||
| ======= | ||||||
|
|
||||||
| bool: | ||||||
|
||||||
| bool: | |
| path[::-1]: bool |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please convert this into iterative logic using pydatastructs.Stack as Python has a finite recursion limit irrespective of the size of heap memory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stack hasn't been implemented yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I made all the changes you have mentioned except this.
pydatastruct.stack is still abstract.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See, https://github.com/codezonediitj/pydatastructs/blob/master/pydatastructs/miscellaneous_data_structures/stack.py#L9
Stack can be used to remove recursion here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just now saw that.
Ill start making the changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
czgdp1807 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A value error would have been better to let the user know that they are searching for garbage values.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please split this into two lines. Doesn't look clean.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
key may not always be an integer. So, this conflicts with the doc string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
key: Python objectThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't addressed.