Skip to content

Insertion sort#22

Open
chaitanyanarukulla wants to merge 7 commits into
masterfrom
insertion_sort
Open

Insertion sort#22
chaitanyanarukulla wants to merge 7 commits into
masterfrom
insertion_sort

Conversation

@chaitanyanarukulla

Copy link
Copy Markdown
Owner

No description provided.

Comment thread README.md
To use insert_sort, from insert_sort import insert_sort.
Pass in a list of numbers insert_sort(list).

* _bubble_sort(list) (O(n^2))_

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

this looks like it shouldn't be in this spot

Comment thread src/insertion_sort.py


def insert_sort(list):
"""Bubble sort a list."""

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nope

Comment thread src/insertion_sort.py
@@ -0,0 +1,52 @@

"""Bubble sort a list."""

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Change this

Comment thread src/insertion_sort.py
from random import randint


def insert_sort(list):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a different variable name than list since list is a Python built-in type object

Comment thread src/insertion_sort.py
return list


if __name__ == '__main__':

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

How is the code in this if __name__ == "__main__" block showing me the timing differences between the best, worst, and average case scenarios?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants