Extend a Linked List to allow various insertion methods.
data-structures-and-algorithms
public repository.Branch Name: linked-list-insertions
Challenge Type: Extending an Implementation
Write the following methods for the Linked List class:
value
to the end of the listInitial List | Method Args | Resulting List |
---|---|---|
head -> {1} -> {3} -> {2} -> X |
5 |
head -> {1} -> {3} -> {2} -> {5} -> X |
head -> X |
1 |
head -> {1} -> X |
Initial List | Method Args | Resulting List |
---|---|---|
head -> {1} -> {3} -> {2} -> X |
3, 5 |
head -> {1} -> {5} -> {3} -> {2} -> X |
head -> {1} -> {3} -> {2} -> X |
1, 5 |
head -> {5} -> {1} -> {3} -> {2} -> X |
head -> {1} -> {2} -> {2} -> X |
2, 5 |
head -> {1} -> {5} -> {2} -> {2} -> X |
head -> {1} -> {3} -> {2} -> X |
4, 5 |
No change, method exception |
Initial List | Method Args | Resulting List |
---|---|---|
head -> {1} -> {3} -> {2} -> X |
3, 5 |
head -> {1} -> {3} -> {5} -> {2} -> X |
head -> {1} -> {3} -> {2} -> X |
2, 5 |
head -> {1} -> {3} -> {2} -> {5} -> X |
head -> {1} -> {2} -> {2} -> X |
2, 5 |
head -> {1} -> {2} -> {5} -> {2} -> X |
head -> {1} -> {3} -> {2} -> X |
4, 5 |
No change, method exception |
For this and all future code challenges, write tests.
Utilize the Single-responsibility principle: any methods you write should be clean, reusable, abstract component parts to the whole challenge. You will be given feedback and marked down if you attempt to define a large, complex algorithm in one function definition.
You have access to the Node class and all the properties on the Linked List class.
Write tests to prove the following functionality:
Unit tests must be passing before you submit your final solution code.
Once you’ve achieved a working solution, write an additional method to delete a node with the given value from the linked list.
Ensure your complete solution follows the standard requirements.