Skip to content

Conversation

@copelandhouse2
Copy link
Owner

Algorithm Assignment. Build the following:

  • Bubble Sort
  • Merge Sort
  • Binary Search

Copy link

@reneemeyer reneemeyer left a comment

Choose a reason for hiding this comment

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

Craig, nice job, all tests passed, just one question below :)

for (let i = 0; i< ary.length; i++){
if (ary[i] > ary[i + 1]) {
flip = true;
// using the swap without temp algorithm! Ex: ary[i] = 10, ary[i+1] = 6

Choose a reason for hiding this comment

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

nice! I like this check

let leftSide = ary.slice(0, middle);
let rightSide = ary.slice(middle);

return merge(mergeSort(leftSide), mergeSort(rightSide));

Choose a reason for hiding this comment

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

nice and simple, why did you use let and and not const?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Renee, I changed "let" vars to const where applicable. Made changes in both mergeSort and binarySearch (not in bubbleSort as my commit msg indicates :))

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.

3 participants