Skip to content
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 some Searching and Sorting Algorithms #413

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dipakpawar152000
Copy link

@dipakpawar152000 dipakpawar152000 commented Oct 28, 2020

Description

Please include a summary of the change and which issue is fixed or what question/feature you have added.

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature/question
  • This change requires a documentation update
  • Bookmark link

Checklist:

  • My code follows the style guidelines of this project i.e. Pep8
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • Any dependent changes have been merged and published in downstream modules
  • I have squashed unnecessary commits

def merge_sort(unsorted_list):
if len(unsorted_list) <= 1:
return unsorted_list
# Find the middle point and devide it

Choose a reason for hiding this comment

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

this comment seems to not be indented, could you please fix it?

@@ -0,0 +1,19 @@
def selection_sort(input_list):

Choose a reason for hiding this comment

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

you do not need this extra line here

@@ -0,0 +1,26 @@
def shellSort(input_list):
gap = len(input_list) // 2

Choose a reason for hiding this comment

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

you can save len(input_list) here outside and reuse it as len(input_list)) is the same across the function right?

@@ -0,0 +1,26 @@
def shellSort(input_list):

Choose a reason for hiding this comment

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

from PEP8 this should be written in lower_case_with_underscores, for e.g.:

shellSort -> shell_sort or shellsort

@@ -0,0 +1,18 @@
def insertion_sort(InputList):

Choose a reason for hiding this comment

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

I think this project is using the convention names in lower_case_with_underscores so believe you have to fix the variable names here

int(((float(idxn - idx0)/( values[idxn] - values[idx0]))
* ( x - values[idx0])))

# Compare the value at mid point with search value

Choose a reason for hiding this comment

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

don't you think the comment would be better inside the function?

Copy link

@laysauchoa laysauchoa left a comment

Choose a reason for hiding this comment

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

nice PR, some points:

  • linting can be improved
  • could add some docs strings in the functions
  • the README should be updated as you are creating a new folder and this folder should be under algorithm, I believe
  • the variable names used in the project and the file names follow the lower_case_with_underscore

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