mgechev / javascript-algorithms

💻 JavaScript implementations of computer science algorithms
https://mgechev.github.io/javascript-algorithms/
MIT License
7.83k stars 1.28k forks source link

Linkedlist remove method has issue #146

Closed rthangam closed 5 years ago

rthangam commented 5 years ago

The linkedlist data structure compares data like this

if (temp.data === data) {

to compare data which won't work. Either we need to recurse and compare all properties or use thirdparty library like lodash or underscore etc to do this. Please fix it.

mgechev commented 5 years ago

The best solution in this case is to provide a comparator function which accepts two objects and returns a boolean result.

I'd not mind keeping the reference check since it clearly demonstrates the data structure without introducing additional complexity.

Would you want to open a PR?

rthangam commented 5 years ago

Thanks for the response. Sure if you can. Sorry are you asking me to do it ?

brunob15 commented 5 years ago

Hi Minko! I can open a PR for this if you want.

mgechev commented 5 years ago

Hey @brunob15, sure!

brunob15 commented 5 years ago

Minko, I'm working on Windows and I'm getting errors about the linebreak style from gulp-eslint when running npm run build. What do you suggest to do?

image

mgechev commented 5 years ago

Feel free to disable this eslint rule.

brunob15 commented 5 years ago

Great! I already created a PR :) Thank you