Case 1:
Menu
insert <data> after <index>
insert <data> before <index>
insert <data> at beg
insert <data> at end
remove <index>
quit
The list:
What would you like to do? insert 3 at beg
The list: 3
What would you like to do? insert 5 at end
The list: 3 5
What would you like to do? insert 1 after 0
The list: 3 1 5
What would you like to do? insert 2 after 2
The list: 3 1 5 2
What would you like to do? remove 0
The list: 1 5 2
What would you like to do? remove 2
The list: 1 5
What would you like to do? remove 1
The list: 1
What would you like to do? remove 0
The list:
What would you like to do? quit
Case 2:
Menu
insert <data> after <index>
insert <data> before <index>
insert <data> at beg
insert <data> at end
remove <index>
quit
The list:
What would you like to do? insert 3 after 0
No such index.
The list:
What would you like to do? insert 10 at end
The list: 10
What would you like to do? insert 1 at beg
The list: 1 10
What would you like to do? insert 5 before 0
The list: 1 10 5
What would you like to do? insert 9 at beg
The list: 9 1 10 5
What would you like to do? remove 3
The list: 9 1 10
What would you like to do? quit
1. An instance of CircularDoublyLinkedList is created.
2. The user is presented with a menu to perform various operations on the list.
3. The corresponding methods are called to perform each operation.
Comments