Posted: June 2nd, 2021

Csc 240 lab 3 1) update the specifications of the deleteitem function

CSC 240

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

Lab 3

1) Update the specifications of the DeleteItem function of the array version of the class UnsortedType as follows:

a) If the ItemType to be deleted is not found in the list, then the list remains unchanged.

b) All copies of the item to be deleted are removed from the list, if they exist.

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

What is the time complexity of the DeleteItem function and why?

2) Create a function called ShiftRight that shifts the contents of the list one index to the right bringing the last item (index = length – 1) of the list to the front (index = 0) of the list.

What is the time complexity of the ShiftRight function and why?

Use the following driver to test your implementations:

#include <iostream>

#include “unsorted.h”

using namespace std;

int main() {

UnsortedType classList;

classList.PutItem(ItemType(4));

classList.PutItem(ItemType(5));

classList.PutItem(ItemType(4));

classList.PutItem(ItemType(4));

classList.PutItem(ItemType(8));

cout << “(original) length: ” << classList.GetLength() << endl;

classList.ResetList();

classList.Print();

classList.ShiftRight();

cout << “(shifted right) length: ” << classList.GetLength() << endl;

classList.ResetList();

classList.Print();

classList.DeleteItem(ItemType(4));

cout << “(delete all 4s) length: ” << classList.GetLength() << endl;

classList.ResetList();

classList.Print();

classList.ShiftRight();

cout << “(shift right) length: ” << classList.GetLength() << endl;

classList.ResetList();

classList.Print();

return 0;

}

Also, use the following ItemType class, as provided in your source code:

class ItemType

{

public:

ItemType();

RelationType ComparedTo(ItemType) const;

void Print(std::ostream&) const;

void Initialize(int number);

private:

int value;

};

Expert paper writers are just a few clicks away

Place an order in 3 easy steps. Takes less than 5 mins.

Calculate the price of your order

You will get a personal manager and a discount.
We'll send you the first draft for approval by at
Total price:
$0.00
error: Content is protected !!
Open chat
1
Order through WhatsApp!
affordablepaperwritings.com
Hello!
You Can Now Place your Order through WhatsApp
 

 

Order your essay today and save 30% with the discount code DISCOUNTS2022