- Implement insertion, deletion and search for a doubly-linked list as defined in class.
-list of pairs of an integer key and an operation, e.g., 1.in 3.in 5.in 3.del 2.in 1.sch ….. (insertions are to be performed at the head unless otherwise specified, and deletions are at the node with the value of the integer key as specified)
-Input with operations to insert in a specific position in the list other than the head is shown as follows
A sample input sequence: “1.in 3.in 5.in 3.del 7.in 9.in 11.in 12.in 2.in 1.sch 15.in_7 ”
15.in_7 is to insert a node with key value 15 between the node with key value 7 and the next node.
In case of a query with an invalid (non-existing) key value, reject it.
/* Notice that pairs are delimited by a single space in between. Note that input is to be read in from a file in a batch. */
-The list before operation and the list after operation displayed on the screen standard outout (not into a file).
-Note that output of a “sch” is to be “found” or “not found”.
-If a duplicate is inserted display “duplicate key”. (I know it’s O(n), smiles), and reject it.
Any other way different then note it in the README file.
- Implement insertion (or push) and deletion (or pop) for a stack and a circular queue with length of n keys as defined in class.
-Input: list of pairs of an integer and an operation, e.g.,
10 1.in 3.in 5.in del 2.in ….. for the queue
10 1.push 2.push 5.push pop 2.push ….. for the stack
/* note that the forefront “10” in each input file indicates the size of the stack or queue. */
/* Note that input is to be read in from a file in a batch. */
/* In case of overflow, print “overflow” and halt your program */
-Output: the list before operation and the list after operation displayed on the screen standard outout (not into a file).
A command line user interface has to be provided as follows:
“Enter your input file name:”
“Display the input before:” /* display the input integers following a statement */
“Display the output after the operation:” /* display the resulting output on the screen */
Write a separate program for each question. Total 3 programs (one program for linked list, one for stack and one for queue) are to be submitted to the same directory under “handin”.
*Provide a README file with specific instructions for compilation and execution for the grader to follow, and any notes you want to add such as how you handle “overflow”, etc.