-
Notifications
You must be signed in to change notification settings - Fork 0
/
LinkedList - instructions.txt
37 lines (33 loc) · 1.53 KB
/
LinkedList - instructions.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
SOLVE IT:
- detect a cycle in a linked list.
- Floyd's Tortoise & Hare algorithm (+)
- hash tables ( in the future )
- find middle element of a linked list.
- basic middle element finder (+)
- Floyd's Tortoise & Hare algorithm (+) ( faster )
- reverse a linked list. (+)
- merge two linked lists. (+)
- delete the nth node from the end of a linked list. (+)
- sort linked list
- remove duplicates from a linked list. (+)
- check if a linked list is a palindrome. (+)
- implement a stack using a linked list.
- implement a queue using a linked list.
- implement a linked list. (+)
IMPLEMENT ( with and without tail ):
size() - returns the number of data elements in the list
empty() - bool returns true if empty
value_at(index) - returns the value of the nth item (starting at 0 for first)
push_front(value) - adds an item to the front of the list
pop_front() - remove the front item and return its value
push_back(value) - adds an item at the end
pop_back() - removes end item and returns its value
front() - get the value of the front item
back() - get the value of the end item
insert(index, value) - insert value at index, so the current item at that index is pointed to by the new item at the index
erase(index) - removes node at given index
value_n_from_end(n) - returns the value of the node at the nth position from the end of the list
reverse() - reverses the list
remove_value(value) - removes the first item in the list with this value
FLASHCARDS:
- what is the difference between while( current != nullptr and current->next != nullptr )