trekhleb / trekhleb/javascript-algorithms
Inserting, removing, accessing, modifying, by index, on linked list
Open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 197k
- Forks
- 31k
- PR merge metrics
- No merged PRs in 30d
Description
Insert(head, index, value)
Pre: head is the head node in the list
Post: the list at the new index is the value; all items in the list are shifted up one index (trivial in a linked list).
Remove(head, index)
Pre: head is the head node in the list
Post: the item at the index is returned; all items after that index are shifted down one index (trivial in a linked list).
Get(head, index)
Pre: head is the head node in the list
Post: the item at the index is returned.
Set(head, index, value)
Pre: head is the head node in the list
Post: the previous item at the index is returned; the index now holds the new value
These seem like important features to be in a list. Should we add these? (Also, I'm kinda new to contributing; should these 4 functions be separate issues, or are they related enough that they make sense as one issue?)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the linked-list implementation and reviewing its existing public operations. Confirm whether Insert, Remove, Get, and Set fit the current API, then add the agreed operations with behavior matching the stated preconditions and postconditions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- data
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100