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:
Claude
2026-11-25 19:06:04 +05:30
parent 09f875ddd9
commit 515302d5ba
40 changed files with 3683 additions and 0 deletions
+176
View File
@@ -0,0 +1,176 @@
The 2015 singly linked list menu program, same keystrokes as the original article
=================================================================================
keystrokes: 1 2 10 1 3 50 1 1 20 2 1 3 90 4 3 50 3 1 2 1 2 2 4 1 3 80 4 2 3 2 4 5
output identical to the 2015 article's sample output: true
--- Singly Linked List Menu ---
1. Insert
2. Remove
3. Search
4. Display
5. Exit
Enter choice: 1
1. Insert at position
2. Insert at first
3. Insert at last
Enter choice: 2
Enter element: 10
--- Singly Linked List Menu ---
1. Insert
2. Remove
3. Search
4. Display
5. Exit
Enter choice: 1
1. Insert at position
2. Insert at first
3. Insert at last
Enter choice: 3
Enter element: 50
--- Singly Linked List Menu ---
1. Insert
2. Remove
3. Search
4. Display
5. Exit
Enter choice: 1
1. Insert at position
2. Insert at first
3. Insert at last
Enter choice: 1
Enter element: 20
Enter position: 2
--- Singly Linked List Menu ---
1. Insert
2. Remove
3. Search
4. Display
5. Exit
Enter choice: 1
1. Insert at position
2. Insert at first
3. Insert at last
Enter choice: 3
Enter element: 90
--- Singly Linked List Menu ---
1. Insert
2. Remove
3. Search
4. Display
5. Exit
Enter choice: 4
List: 10 20 50 90
--- Singly Linked List Menu ---
1. Insert
2. Remove
3. Search
4. Display
5. Exit
Enter choice: 3
Enter element to search: 50
Element found at position: 3
--- Singly Linked List Menu ---
1. Insert
2. Remove
3. Search
4. Display
5. Exit
Enter choice: 3
Enter element to search: 1
Element not found
--- Singly Linked List Menu ---
1. Insert
2. Remove
3. Search
4. Display
5. Exit
Enter choice: 2
1. Remove first element
2. Remove last element
3. Remove element at position
Enter choice: 1
Removed: 10
--- Singly Linked List Menu ---
1. Insert
2. Remove
3. Search
4. Display
5. Exit
Enter choice: 2
1. Remove first element
2. Remove last element
3. Remove element at position
Enter choice: 2
Removed: 90
--- Singly Linked List Menu ---
1. Insert
2. Remove
3. Search
4. Display
5. Exit
Enter choice: 4
List: 20 50
--- Singly Linked List Menu ---
1. Insert
2. Remove
3. Search
4. Display
5. Exit
Enter choice: 1
1. Insert at position
2. Insert at first
3. Insert at last
Enter choice: 3
Enter element: 80
--- Singly Linked List Menu ---
1. Insert
2. Remove
3. Search
4. Display
5. Exit
Enter choice: 4
List: 20 50 80
--- Singly Linked List Menu ---
1. Insert
2. Remove
3. Search
4. Display
5. Exit
Enter choice: 2
1. Remove first element
2. Remove last element
3. Remove element at position
Enter choice: 3
Enter position: 2
Removed: 50
--- Singly Linked List Menu ---
1. Insert
2. Remove
3. Search
4. Display
5. Exit
Enter choice: 4
List: 20 80
--- Singly Linked List Menu ---
1. Insert
2. Remove
3. Search
4. Display
5. Exit
Enter choice: 5
Exiting...