https://github.com/zipcodecore/singlylinkedlist
https://github.com/zipcodecore/singlylinkedlist
corejava corejava-chapter9 corejava-chapter9-section2
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/zipcodecore/singlylinkedlist
- Owner: ZipCodeCore
- Created: 2017-02-23T22:09:05.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2023-10-17T14:50:47.000Z (about 2 years ago)
- Last Synced: 2025-04-15T21:39:30.081Z (8 months ago)
- Topics: corejava, corejava-chapter9, corejava-chapter9-section2
- Language: Java
- Size: 7.81 KB
- Stars: 2
- Watchers: 0
- Forks: 53
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Data structures
Fork this repository and submit the URL of your fork via the Student Portal.
## Linked List
### Requirements
Implement a singly linked list:
- You may not use the `LinkedList` or `ArrayList` class or any other predefined Java collections
- Your linked list must have a node inner class to represent each element
- Your linked list must have add, remove, contains, find, size, get, copy and sort methods
- Method definitions:
- add -- add an element to the list
- remove -- remove an element (specified by numeric index) from the list
- contains -- returns true if the element is in the list, false otherwise
- find -- returns the element's index if it is in the list, -1 otherwise
- size -- returns the current size of the list
- get -- returns the element at the specified index
- copy -- returns a new linked list containing the same values (look up deep versus shallow copy)
- sort -- sorts the list using your algorithm of choice. You must perform the sorting yourself (no fair using someone else's library)
### Optional features
- implement your linked list as a generic class that can store any type of object
- Add a reverse method
- Add a slice method that returns a copy of a subset of the element of the list (eg slice(2,8) returns a new linked list containing elements #2,3,4,5,6,7 -- but not 8)
## Planning and Execution:
* Rememember, **TESTS** for all of the methods involved should be written **BEFORE** their implemtations are written.