loiane / javascript-datastructures-algorithms

:books: collection of JavaScript and TypeScript data structures and algorithms for education purposes. Source code bundle of JavaScript algorithms and data structures book
https://goo.gl/hrb00r
4.64k stars 1.24k forks source link

Insert function of circular-linked-list in charpter6 is error #186

Closed SHIJIECHN closed 2 years ago

SHIJIECHN commented 2 years ago

circular-linked-list.js error: current = this.getElementAt(this.size()); answer: current = this.getElementAt(this.size() - 1);

carlos-novaes commented 2 years ago

circular-linked-list.js error: current = this.getElementAt(this.size()); answer: current = this.getElementAt(this.size() - 1);

it took me almost an hour to figure it out, I'm glad that I wasn't the only one that got it :D

loiane commented 2 years ago

@carlos-novaes @SHIJIECHN can you please open a PR with this fix? Thanks for pointing it out!

Jeffzholy commented 2 years ago

@loiane don't have an access to push up a branch for opening a PR, how to open a PR correctly?

loiane commented 2 years ago

@Jeffzholy you can fork the project to your github account, create a branch, commit the fix and then create the PR from your fork to this github repo.

Jeffzholy commented 2 years ago

@loiane https://github.com/loiane/javascript-datastructures-algorithms/pull/190

loiane commented 2 years ago

@Jeffzholy thank you, merged.