Skip to content

Commit 115d253

Browse files
committed
Sync linked-list docs with problem-specifications
The linked-list exercise has been overhauled as part of a project to make practice exercises more consistent and friendly. For more context, please see the discussion in the forum, as well as the pull request that updated the exercise in the problem-specifications repository: - https://forum.exercism.org/t/new-project-making-practice-exercises-more-consistent-and-human-across-exercism/3943 - exercism/problem-specifications#2245
1 parent 6cc4b91 commit 115d253

File tree

2 files changed

+23
-17
lines changed

2 files changed

+23
-17
lines changed
Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
# Instructions
22

3-
Implement a doubly linked list.
3+
Your team has decided to use a doubly linked list to represent each train route in the schedule.
4+
Each station along the train's route will be represented by a node in the linked list.
45

5-
Like an array, a linked list is a simple linear data structure.
6-
Several common data types can be implemented using linked lists, like queues, stacks, and associative arrays.
6+
You don't need to worry about arrival and departure times at the stations.
7+
Each station will simply be represented by a number.
78

8-
A linked list is a collection of data elements called *nodes*.
9-
In a *singly linked list* each node holds a value and a link to the next node.
10-
In a *doubly linked list* each node also holds a link to the previous node.
9+
Routes can be extended, adding stations to the beginning or end of a route.
10+
They can also be shortened by removing stations from the beginning or the end of a route.
1111

12-
You will write an implementation of a doubly linked list.
13-
Implement a Node to hold a value and pointers to the next and previous nodes.
14-
Then implement a List which holds references to the first and last node and offers an array-like interface for adding and removing items:
12+
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.
1513

16-
- `push` (*insert value at back*);
17-
- `pop` (*remove value at back*);
18-
- `shift` (*remove value at front*).
19-
- `unshift` (*insert value at front*);
14+
The size of a route is measured not by how far the train travels, but by how many stations it stops at.
2015

21-
To keep your implementation simple, the tests will not cover error conditions.
22-
Specifically: `pop` or `shift` will never be called on an empty list.
16+
```exercism/note
17+
The linked list is a fundamental data structure in computer science, often used in the implementation of other data structures.
18+
As the name suggests, it is a list of nodes that are linked together.
19+
It is a list of "nodes", where each node links to its neighbor or neighbors.
20+
In a **singly linked list** each node links only to the node that follows it.
21+
In a **doubly linked list** each node links to both the node that comes before, as well as the node that comes after.
2322
24-
Read more about [linked lists on Wikipedia][linked-lists].
23+
If you want to dig deeper into linked lists, check out [this article][intro-linked-list] that explains it using nice drawings.
2524
26-
[linked-lists]: https://en.wikipedia.org/wiki/Linked_list
25+
[intro-linked-list]: https://medium.com/basecs/whats-a-linked-list-anyway-part-1-d8b7e6508b9d
26+
```
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Introduction
2+
3+
You are working on a project to develop a train scheduling system for a busy railway network.
4+
5+
You've been asked to develop a prototype for the train routes in the scheduling system.
6+
Each route consists of a sequence of train stations that a given train stops at.

0 commit comments

Comments
 (0)