javascript-algorithms icon indicating copy to clipboard operation
javascript-algorithms copied to clipboard

Inserting, removing, accessing, modifying, by index, on linked list

Open willow-iam opened this issue 3 years ago • 2 comments

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?)

willow-iam avatar Jan 16 '22 18:01 willow-iam

Hi @willow-iam, I decided to work on the Linked-Lists functions you asked for.

I created this pull request to learn more about open source for a Intro to software Engineering course I am taking. This is my first open source contribution so I hope it gets accepted!

I created functions for remove (deleteAtIndex), get (findByIndex) and set (setAtIndex). I did not create the insert function as that is already an existing function for linked-lists.

I also created test cases for all of these functions to ensure they work optimally and correctly!

yairtemkin avatar Jan 29 '22 17:01 yairtemkin

can i contribute to this issue ??

swraj28 avatar Apr 15 '23 14:04 swraj28