Question: - There are two list operations: Insert and Remove - Remove operations will have two parts: Operation and Position - Insert operations will have three

- There are two list operations: Insert and Remove
- Remove operations will have two parts: Operation and Position
- Insert operations will have three parts: Operations Position and Data
Valid positions:
- "Head"
- "Tail"
- an integer Index
- Only valid insertions to an empty Linked List will be:
- Insert 0
- Insert Head
- Insert Tail
- Each element will be in its own line.
- Not all given integer Indexs will be valid
- There will be no empty lines
- There might be an empty input file, in this case, the output should be empty.
- Remove all
and \r before processing any input line.
3. Output files
- The output file should display every element of your linked list.
- Each element will be separated by a space (note there is no extra space at the end of the
output).
4. Examples
input1.txt
Insert Head Print
Insert 2 Hello
Insert Tail World
ans1.txt
Print Hello World
input2.txt
Insert 3 Howdy
Insert 0 Hi
Remove Head
ans2.txt
input3.txt
Insert Head Hello
Insert Tail Hi
Insert 2 Tail
Remove 1
ans3.txt
Hello Tail

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!