mirror of
https://github.moeyy.xyz/https://github.com/trekhleb/javascript-algorithms.git
synced 2024-12-25 22:46:20 +08:00
Code style fixes.
This commit is contained in:
parent
de1cc0b047
commit
e220450d7d
@ -7,7 +7,7 @@ The task is to traverse the given linked list in straight order.
|
||||
|
||||
For example for the following linked list:
|
||||
|
||||
![](https://upload.wikimedia.org/wikipedia/commons/6/6d/Singly-linked-list.svg)
|
||||
![Singly linked list](https://upload.wikimedia.org/wikipedia/commons/6/6d/Singly-linked-list.svg)
|
||||
|
||||
The order of traversal should be:
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
Например, для следующего связного списка:
|
||||
|
||||
![](https://upload.wikimedia.org/wikipedia/commons/6/6d/Singly-linked-list.svg)
|
||||
![Singly linked list](https://upload.wikimedia.org/wikipedia/commons/6/6d/Singly-linked-list.svg)
|
||||
|
||||
Порядок обхода будет такой:
|
||||
|
||||
|
@ -227,20 +227,18 @@ describe('LinkedList', () => {
|
||||
let node = linkedList.find({ value: 3 });
|
||||
expect(node.value).toBe(4);
|
||||
|
||||
node = linkedList.find({ callback: value => value < 3 });
|
||||
node = linkedList.find({ callback: (value) => value < 3 });
|
||||
expect(node.value).toBe(1);
|
||||
});
|
||||
|
||||
it('should convert to array', () => {
|
||||
const linkedList = new LinkedList();
|
||||
|
||||
linkedList.append(1);
|
||||
linkedList.append(2);
|
||||
linkedList.append(3);
|
||||
|
||||
expect(linkedList.toArray().join(',')).toBe('1,2,3');
|
||||
});
|
||||
|
||||
|
||||
it('should reverse linked list', () => {
|
||||
const linkedList = new LinkedList();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user