File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ This is a simple implementation of a one-way linked-list in C++.
77``` c++
88// Create new list
99OneWayLinkedList* list = new OneWayLinkedList();
10+
1011// Add some nodes
1112list->addEnd (1);
1213list->addEnd(2);
@@ -23,9 +24,14 @@ list->print();
2324cout << "Size: " << list->getSize() << endl;
2425
2526// Reverse the current list
27+ cout << "Reverse the list" << endl;
2628list->reverse();
2729
30+ // Print all nodes
31+ list->print();
32+
2833// Reverse the current list with a recursive function
34+ cout << "Reverse the list with a recursive function" << endl;
2935list->reverseRecursive(list->getFirstNode());
3036
3137// Print all nodes
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ using namespace std;
66int main (int argc, char ** argv) {
77 // Create new list
88 OneWayLinkedList* list = new OneWayLinkedList ();
9+
910 // Add some nodes
1011 list->addEnd (1 );
1112 list->addEnd (2 );
You can’t perform that action at this time.
0 commit comments