-
Notifications
You must be signed in to change notification settings - Fork 25
Added Tree Sort #14
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
Added Tree Sort #14
Conversation
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.
Hi, @Pratham1807 thanks for contributing to The All ▲lgorithms project, the huge collection of algorithms implemented in different languages.
Before merging the pull request you will need to review the contributing guide because there are changes must be done.
├── allalgorithms
│ │── sorting
| | │── bubble_sort.py
| | └── merge_sort.py
│ └── searches
| │── binary_search.py
| └── linear_search.py
├── docs
│ │── sorting
| | │── bubble-sort.md
| | └── merge-sort.md
│ └── searches
| │── binary-search.md
| └── linear-search.md
└── tests
│── test_searches.py
└── test_sorting.py
The above style is required so you may need to add the algorithm along the tests and documentation
tests/test_sorting.py
Outdated
@@ -32,6 +33,9 @@ def test_stooge_sort(self): | |||
|
|||
def test_cocktail_shaker_sort(self): | |||
self.assertEqual([-44, 1, 2, 3, 7, 19], cocktail_shaker_sort([7, 3, 2, 19, -44, 1])) | |||
|
|||
def tree_sort(self): | |||
self.assertEqual([-44, 1, 2, 3, 7, 19], tree_sort([7, 3, 2, 19, -44, 1])) |
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.
Are you comparing a tree with an array? Remember this is a library, it should be returned, not printed.
- Also for this case, we may need documentation for the
insert()
function
I have modified the tree_sort.py file. It now no longer prints the values, rather it returns a list. Now I don't think there would be a need to have documentation for the insert function as the user has to just call the tree_sort function to perform the sorting. |
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.
Thanks for your contribution to The All ▲lgorithms project, the huge collection of algorithms implemented in different languages.
- ✅Tree Sort
Thanks again! and keep it in touch. Make sure you star the repository and follow me @abranhe :) if you want!
Make sure you visit @AllAlgorithms/Python
I will try to drop a new release at the end of each month with the new algorithms that people may add, so I guess your contribution would be available on version v0.0.1
soon.
A simple test for this algorithm available at repl.it/@abranhe/python-libtreesorth
No description provided.