Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a MIPS assembly language program that uses dynamic memory allocation to create and manage a linked list data structure Gives the user the following
Write a MIPS assembly language program that uses dynamic memory allocation to create and manage a linked list data structure Gives the user the following options 1. To create and add the first node to a linked list. 2. To add a single node to the pre-existing linked list. The list must already exist before a new node can be added The nodes should be maintained in ascending order based on the data value within the nodes by inserting new nodes into the proper place within the list. If the data value matches a data value already in the list, then the new node should be inserted after any previous nodes that contain the same data value 3. To delete a node from the linked list structure based on the ID field within the node. Remove the node with that ID 4. To search the list and display the node found to contain an ID that matches the target search ID 5. To search the list and display all nodes found to contain a specified data value 6. To display the nodes within the list from start to end by printing the ID and data fields of each 7. To terminate the program by entering X as a command Attempts to create a list should be rejected if a list already exits. Attempts to add to or access the list should be rejected if the list does not already exist. Allocate each node as a 3-word unit that contains the ID, data value and a link to the node that follows. ID fielddata field ink field | (Use the sbrk syscall to obtain memory for the nodes.) When adding a node to the list, the new node should be inserted into the proper place within the list so as to keep the list in ascending order based on the data values within the nodes. Multiple nodes are allowed to have the same data value. A new node with the same data value as one or more existing nodes should be inserted after the existing nodes. The link field within each node contains the address of the node that logically follows. A null link field contains O and indicates the final node within the linked list structure A separate head pointer is used to specify the first node within the list. A null head pointer denotes an empty list. Sample output from the program is shown below. (Sample shows floating point. You do not need to have values that are floating point. You may have integer values.) Console Specify an action to take for the linked list: C to create the list t to display the list A to odda single node D to delete a node S to search for node with the specified ID F to search for a sode with a specified value
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started