Question: On a piece of paper draw linked node and write code for the following scenarios. The code is just the essential code fragment. You just
On a piece of paper draw linked node and write code for the following scenarios. The code is just the essential code fragment. You just write out a few lines of code on paper. This is done in C++.
1 make empty list.
2 PutItem() assume that you are adding to unsorted list at the beginning.
3 PutItem() assume that you are adding to unsorted list at the end. The list may have a tail pointer.
4 PutItem() assume that you are adding to sorted list. This means that you have find the proper spot and add in the middle.
Use this example. Your list is 1 4 8 11. You want to add 5.
5 GetItem
6 Delete Item from the front
7 Delete Item from the back
8 Delete Item from the from the middle. Use five from the list above.
Constructors (2):
make empty list
take some initial elements
Transformers:
PutItem,
DeleteItem,
MakeEmpty
Observers:
IsFull,
GetLength
GetItem
Iterators:
ResetList,
GetNextItem
Analysis:
1 What is the order of PutItem()? Why?
2 What is the order of GetItem()? Why?
3 What is the order of DeleteItem? Why?
4 What is the least efficient operation in the list?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
