blob: 88c3d7458ef3cd23c292258daf029fd682e258c3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#include"linked-list-utils.h"
template<class T>
void insertAtBegin(LinkedListNode<T>*& ll, const T& elem) {
LinkedListNode<T>* toInsert = new LinkedListNode(elem, ll);
ll = toInsert;
}
void example() {
LinkedListNode<int>* ll = new LinkedListNode(1, new LinkedListNode(2, new LinkedListNode(3)));
printLinkedList(ll);
insertAtBegin(ll, 0);
printLinkedList(ll);
freeList(ll);
}
int main() {
}
|