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

Question about your merge sort! #1

Closed
mspanish opened this issue Oct 20, 2014 · 8 comments
Closed

Question about your merge sort! #1

mspanish opened this issue Oct 20, 2014 · 8 comments

Comments

@mspanish
Copy link

Hello and congrats on your upcoming book! I look forward to it, and am delighted to see that you are a a woman :)

I am just working with merge sort algos for the first time, and see you've got a slightly different thing going on here - the

result.push(left[il++]);

instead of using result.push(left.shift()) - which seems to be what I've seen elsewhere. Does eliminating the shift() help performance?

thanks for all your samples and best of luck w/ the book launch.

Obrigada desde Alaska
Stacey

@loiane
Copy link
Owner

loiane commented Oct 20, 2014

Hi Stacey,

Thanks!

The shift method removes an element from the array, while left[il++] access the element only. Accessing the element is a cheaper operation rather than removing it.

Have a nice day!

@mspanish
Copy link
Author

Thanks very much Loiane - I've just gotten my brain around left[i++], and I really appreciate your response! Your book will be very fun to look at, I hope it comes out in Kindle form so I can use it on my phone. I hope you sell many copies :)

@anthonybrown
Copy link

I just discoverd your book, and want to point out an error in the first example of arrays.
You forgot to create the averageTemp array.
var averageTemp = []; then the averageTemp[0] = 31.9; averageTemp[1] = 35.3; averageTemp[2] = 42.4; averageTemp[3] = 52.0; averageTemp[4] = 60.8;

works.
Looking forward to read the book for review.

@anthonybrown
Copy link

I see that you have an example of it on the next page :)

How do I help you if I find more typo's and errors?

@loiane
Copy link
Owner

loiane commented Jan 29, 2015

Thanks Anthony. If you find errors, you can create issues here! Thanks again!

@ryanpoplin
Copy link

Hey Loiane, thanks for writing this book. It's awesome to be able to jump into the concepts with having to learn all of the mathematical notations in conjunction with C || Java!

@ryanpoplin
Copy link

without*

@loiane
Copy link
Owner

loiane commented Mar 18, 2015

Thanks Ryan! Hope you like it! :)

@loiane loiane closed this as completed Mar 18, 2015
loiane pushed a commit that referenced this issue Sep 25, 2021
loiane added a commit that referenced this issue Sep 25, 2021
Merge pull request #1 from loiane/main
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

No branches or pull requests

4 participants