Add linked-list module: singly and doubly lists with measured costs, reverse, middle, Floyd cycle detection, merge and 5 more interview problems, the 2015 menu programs and a doubly-list bug they exposed (15 tests, 15 transcripts)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b6r9iSyHu5qSJMzH2n
This commit is contained in:
@@ -0,0 +1,184 @@
|
||||
The 2015 doubly linked list menu program, same keystrokes as the original article
|
||||
=================================================================================
|
||||
|
||||
keystrokes: 1 1 20 1 1 40 1 2 60 1 3 45 2 1 4 65 2 3 1 3 2 2 1 2 2 3 1 4 20 2 3 2 3 1 5
|
||||
output identical to the 2015 article's sample output: true
|
||||
|
||||
--- Doubly Linked List Menu ---
|
||||
1. Insert
|
||||
2. Remove
|
||||
3. Display list
|
||||
4. Search
|
||||
5. Exit
|
||||
Select option: 1
|
||||
1. Insert at first
|
||||
2. Insert at last
|
||||
3. Insert after position
|
||||
4. Insert before position
|
||||
Select: 1
|
||||
Enter element: 20
|
||||
|
||||
--- Doubly Linked List Menu ---
|
||||
1. Insert
|
||||
2. Remove
|
||||
3. Display list
|
||||
4. Search
|
||||
5. Exit
|
||||
Select option: 1
|
||||
1. Insert at first
|
||||
2. Insert at last
|
||||
3. Insert after position
|
||||
4. Insert before position
|
||||
Select: 1
|
||||
Enter element: 40
|
||||
|
||||
--- Doubly Linked List Menu ---
|
||||
1. Insert
|
||||
2. Remove
|
||||
3. Display list
|
||||
4. Search
|
||||
5. Exit
|
||||
Select option: 1
|
||||
1. Insert at first
|
||||
2. Insert at last
|
||||
3. Insert after position
|
||||
4. Insert before position
|
||||
Select: 2
|
||||
Enter element: 60
|
||||
|
||||
--- Doubly Linked List Menu ---
|
||||
1. Insert
|
||||
2. Remove
|
||||
3. Display list
|
||||
4. Search
|
||||
5. Exit
|
||||
Select option: 1
|
||||
1. Insert at first
|
||||
2. Insert at last
|
||||
3. Insert after position
|
||||
4. Insert before position
|
||||
Select: 3
|
||||
Enter element: 45
|
||||
Enter position: 2
|
||||
|
||||
--- Doubly Linked List Menu ---
|
||||
1. Insert
|
||||
2. Remove
|
||||
3. Display list
|
||||
4. Search
|
||||
5. Exit
|
||||
Select option: 1
|
||||
1. Insert at first
|
||||
2. Insert at last
|
||||
3. Insert after position
|
||||
4. Insert before position
|
||||
Select: 4
|
||||
Enter element: 65
|
||||
Enter position: 2
|
||||
|
||||
--- Doubly Linked List Menu ---
|
||||
1. Insert
|
||||
2. Remove
|
||||
3. Display list
|
||||
4. Search
|
||||
5. Exit
|
||||
Select option: 3
|
||||
1. Forward display
|
||||
2. Reverse display
|
||||
Select: 1
|
||||
Forward: 40 65 20 45 60
|
||||
|
||||
--- Doubly Linked List Menu ---
|
||||
1. Insert
|
||||
2. Remove
|
||||
3. Display list
|
||||
4. Search
|
||||
5. Exit
|
||||
Select option: 3
|
||||
1. Forward display
|
||||
2. Reverse display
|
||||
Select: 2
|
||||
Reverse: 60 45 20 65 40
|
||||
|
||||
--- Doubly Linked List Menu ---
|
||||
1. Insert
|
||||
2. Remove
|
||||
3. Display list
|
||||
4. Search
|
||||
5. Exit
|
||||
Select option: 2
|
||||
1. Delete first
|
||||
2. Delete last
|
||||
3. Delete at position
|
||||
Select: 1
|
||||
Deleted: 40
|
||||
|
||||
--- Doubly Linked List Menu ---
|
||||
1. Insert
|
||||
2. Remove
|
||||
3. Display list
|
||||
4. Search
|
||||
5. Exit
|
||||
Select option: 2
|
||||
1. Delete first
|
||||
2. Delete last
|
||||
3. Delete at position
|
||||
Select: 2
|
||||
Deleted: 60
|
||||
|
||||
--- Doubly Linked List Menu ---
|
||||
1. Insert
|
||||
2. Remove
|
||||
3. Display list
|
||||
4. Search
|
||||
5. Exit
|
||||
Select option: 3
|
||||
1. Forward display
|
||||
2. Reverse display
|
||||
Select: 1
|
||||
Forward: 65 20 45
|
||||
|
||||
--- Doubly Linked List Menu ---
|
||||
1. Insert
|
||||
2. Remove
|
||||
3. Display list
|
||||
4. Search
|
||||
5. Exit
|
||||
Select option: 4
|
||||
Enter element to search: 20
|
||||
Element found at position: 2
|
||||
|
||||
--- Doubly Linked List Menu ---
|
||||
1. Insert
|
||||
2. Remove
|
||||
3. Display list
|
||||
4. Search
|
||||
5. Exit
|
||||
Select option: 2
|
||||
1. Delete first
|
||||
2. Delete last
|
||||
3. Delete at position
|
||||
Select: 3
|
||||
Enter position: 2
|
||||
Deleted: 20
|
||||
|
||||
--- Doubly Linked List Menu ---
|
||||
1. Insert
|
||||
2. Remove
|
||||
3. Display list
|
||||
4. Search
|
||||
5. Exit
|
||||
Select option: 3
|
||||
1. Forward display
|
||||
2. Reverse display
|
||||
Select: 1
|
||||
Forward: 65 45
|
||||
|
||||
--- Doubly Linked List Menu ---
|
||||
1. Insert
|
||||
2. Remove
|
||||
3. Display list
|
||||
4. Search
|
||||
5. Exit
|
||||
Select option: 5
|
||||
Exiting...
|
||||
Reference in New Issue
Block a user