Skip to content

The time complexity of every algorithms make its value #1401

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

Merged
merged 5 commits into from
Oct 19, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions sorts/bubble_sort.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import time
start = time.process_time()
def bubble_sort(collection):
"""Pure implementation of bubble sort algorithm in Python

Expand Down Expand Up @@ -37,3 +39,4 @@ def bubble_sort(collection):
user_input = input("Enter numbers separated by a comma:").strip()
unsorted = [int(item) for item in user_input.split(",")]
print(*bubble_sort(unsorted), sep=",")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are also counting the time that the user enters the data. Let’s only count sort time...

Please move line 2 to be just above this line and also indent line 42.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay . Thanks a lot for the obersvation. Will do the changes

print(time.process_time() - start)