-
-
Notifications
You must be signed in to change notification settings - Fork 27
exercises(linked-list): sync docs #512
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
kytrinyx
wants to merge
2
commits into
main
Choose a base branch
from
sync-linked-list-docs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,26 +1,26 @@ | ||
| # Instructions | ||
|
|
||
| Implement a doubly linked list. | ||
| Your team has decided to use a doubly linked list to represent each train route in the schedule. | ||
| Each station along the train's route will be represented by a node in the linked list. | ||
|
|
||
| Like an array, a linked list is a simple linear data structure. | ||
| Several common data types can be implemented using linked lists, like queues, stacks, and associative arrays. | ||
| You don't need to worry about arrival and departure times at the stations. | ||
| Each station will simply be represented by a number. | ||
|
|
||
| A linked list is a collection of data elements called *nodes*. | ||
| In a *singly linked list* each node holds a value and a link to the next node. | ||
| In a *doubly linked list* each node also holds a link to the previous node. | ||
| Routes can be extended, adding stations to the beginning or end of a route. | ||
| They can also be shortened by removing stations from the beginning or the end of a route. | ||
|
|
||
| You will write an implementation of a doubly linked list. | ||
| Implement a Node to hold a value and pointers to the next and previous nodes. | ||
| Then implement a List which holds references to the first and last node and offers an array-like interface for adding and removing items: | ||
| Sometimes a station gets closed down, and in that case the station needs to be removed from the route, even if it is not at the beginning or end of the route. | ||
|
|
||
| - `push` (*insert value at back*); | ||
| - `pop` (*remove value at back*); | ||
| - `shift` (*remove value at front*). | ||
| - `unshift` (*insert value at front*); | ||
| The size of a route is measured not by how far the train travels, but by how many stations it stops at. | ||
|
|
||
| To keep your implementation simple, the tests will not cover error conditions. | ||
| Specifically: `pop` or `shift` will never be called on an empty list. | ||
| ```exercism/note | ||
| The linked list is a fundamental data structure in computer science, often used in the implementation of other data structures. | ||
| As the name suggests, it is a list of nodes that are linked together. | ||
| It is a list of "nodes", where each node links to its neighbor or neighbors. | ||
| In a **singly linked list** each node links only to the node that follows it. | ||
| In a **doubly linked list** each node links to both the node that comes before, as well as the node that comes after. | ||
|
|
||
| Read more about [linked lists on Wikipedia][linked-lists]. | ||
| If you want to dig deeper into linked lists, check out [this article][intro-linked-list] that explains it using nice drawings. | ||
|
|
||
| [linked-lists]: https://en.wikipedia.org/wiki/Linked_list | ||
| [intro-linked-list]: https://medium.com/basecs/whats-a-linked-list-anyway-part-1-d8b7e6508b9d | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # Introduction | ||
|
|
||
| You are working on a project to develop a train scheduling system for a busy railway network. | ||
|
|
||
| You've been asked to develop a prototype for the train routes in the scheduling system. | ||
| Each route consists of a sequence of train stations that a given train stops at. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.