Linked list exemple for my website tutorial. Pretty simple. Feel free to use it.
Compile the program with make
.
Clean the program with make clean
.
Lauch the binary as ./bin/linked_list.out
.
Instanciate the list:
-- {}
Filling list with Push():
-- {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
Inserting 42 at index 5 with Insert():
-- {0, 1, 2, 3, 4, 42, 5, 6, 7, 8, 9}
Removing the 5th element with Remove():
-- {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
Swapping the 0th element with the 9th with Swap():
-- {9, 1, 2, 3, 4, 5, 6, 7, 8, 0}
Reversing the list with Reverse():
-- {0, 8, 7, 6, 5, 4, 3, 2, 1, 9}
Is the list empty with Empty():
-- 0
Is the list empty after calling Clear() with Empty():
-- 1