SlideShare a Scribd company logo
CSC 240
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.
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
#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;
};
CSC 240Lab 31) Update the specifications of the DeleteItem f.docx

More Related Content

PDF
BackgroundIn many applications, the composition of a collection o.pdf
PDF
All code should be in C++Using the UnsortedList class (UnsortedLis.pdf
PDF
Using C++I keep getting messagehead does not name a type.pdf
DOCX
Week 2 - Advanced C++list1.txt312220131197.docx
PDF
Lab Manual-OOP.pdf
PDF
Using the C++ programming language1. Implement the UnsortedList cl.pdf
PDF
Pleae help me with this C++ task to the required result by edit or f.pdf
PDF
(Unordered Sets) As explained in this chapter, a set is a collection.pdf
BackgroundIn many applications, the composition of a collection o.pdf
All code should be in C++Using the UnsortedList class (UnsortedLis.pdf
Using C++I keep getting messagehead does not name a type.pdf
Week 2 - Advanced C++list1.txt312220131197.docx
Lab Manual-OOP.pdf
Using the C++ programming language1. Implement the UnsortedList cl.pdf
Pleae help me with this C++ task to the required result by edit or f.pdf
(Unordered Sets) As explained in this chapter, a set is a collection.pdf

Similar to CSC 240Lab 31) Update the specifications of the DeleteItem f.docx (20)

PPTX
gtyt67utt57uy76r4w54yt67utt57uy76r4wyt67utt57uy76r4wetrt.pptx
PPT
Chapter three data structure and algorithms qaybta quee
DOC
Main ds manual
PPTX
Object Oriented Programming Using C++: C++ STL Programming.pptx
DOCX
In Class AssignmetzCST280W13a-1.pdfCST 280 In-Class Pract.docx
PDF
you will implement some sorting algorithms for arrays and linked lis.pdf
PDF
refman
PPTX
Unsorted Sorted List_Array.pptx
PDF
C++ Searching & Sorting5. Sort the following list using the select.pdf
PDF
In C++Add the function min as an abstract function to the classar.pdf
DOC
programming in C++ report
PDF
Data Structure
PDF
Recursion Lecture in C++
PDF
a) Write the recursive function in C++ to sort a set of data using M.pdf
DOC
Devry gsp 215 week 6 i lab virtual memory new
PPT
data stracyturwe waaure semeer gorbe eidd fata sahttacuyeiwi
PPT
Chapter 5 ds
PPT
PF Lecture 9.ppt hakakbshisokwb jaiksnsjomabhj
PDF
Below is a code segment for the Deleteltem function in an unsorted li.pdf
gtyt67utt57uy76r4w54yt67utt57uy76r4wyt67utt57uy76r4wetrt.pptx
Chapter three data structure and algorithms qaybta quee
Main ds manual
Object Oriented Programming Using C++: C++ STL Programming.pptx
In Class AssignmetzCST280W13a-1.pdfCST 280 In-Class Pract.docx
you will implement some sorting algorithms for arrays and linked lis.pdf
refman
Unsorted Sorted List_Array.pptx
C++ Searching & Sorting5. Sort the following list using the select.pdf
In C++Add the function min as an abstract function to the classar.pdf
programming in C++ report
Data Structure
Recursion Lecture in C++
a) Write the recursive function in C++ to sort a set of data using M.pdf
Devry gsp 215 week 6 i lab virtual memory new
data stracyturwe waaure semeer gorbe eidd fata sahttacuyeiwi
Chapter 5 ds
PF Lecture 9.ppt hakakbshisokwb jaiksnsjomabhj
Below is a code segment for the Deleteltem function in an unsorted li.pdf
Ad

More from mydrynan (20)

DOCX
CSIA 413 Cybersecurity Policy, Plans, and Programs.docx
DOCX
CSIS 100CSIS 100 - Discussion Board Topic #1One of the object.docx
DOCX
CSI Paper Grading Rubric- (worth a possible 100 points) .docx
DOCX
CSIA 413 Cybersecurity Policy, Plans, and ProgramsProject #4 IT .docx
DOCX
CSI 170 Week 3 AssingmentAssignment 1 Cyber Computer CrimeAss.docx
DOCX
CSE422 Section 002 – Computer Networking Fall 2018 Ho.docx
DOCX
CSCI  132  Practical  Unix  and  Programming   .docx
DOCX
CSCI 714 Software Project Planning and EstimationLec.docx
DOCX
CSCI 561Research Paper Topic Proposal and Outline Instructions.docx
DOCX
CSCI 561 DB Standardized Rubric50 PointsCriteriaLevels of .docx
DOCX
CryptographyLesson 10© Copyright 2012-2013 (ISC)², Inc. Al.docx
DOCX
CSCI 352 - Digital Forensics Assignment #1 Spring 2020 .docx
DOCX
CSCE 1040 Homework 2 For this assignment we are going to .docx
DOCX
CSCE509–Spring2019Assignment3updated01May19DU.docx
DOCX
CSCI 2033 Elementary Computational Linear Algebra(Spring 20.docx
DOCX
CSCE 3110 Data Structures & Algorithms Summer 2019 1 of .docx
DOCX
CSCI 340 Final Group ProjectNatalie Warden, Arturo Gonzalez, R.docx
DOCX
CSC-321 Final Writing Assignment In this assignment, you .docx
DOCX
Cryptography is the application of algorithms to ensure the confiden.docx
DOCX
CSc3320 Assignment 6 Due on 24th April, 2013 Socket programming .docx
CSIA 413 Cybersecurity Policy, Plans, and Programs.docx
CSIS 100CSIS 100 - Discussion Board Topic #1One of the object.docx
CSI Paper Grading Rubric- (worth a possible 100 points) .docx
CSIA 413 Cybersecurity Policy, Plans, and ProgramsProject #4 IT .docx
CSI 170 Week 3 AssingmentAssignment 1 Cyber Computer CrimeAss.docx
CSE422 Section 002 – Computer Networking Fall 2018 Ho.docx
CSCI  132  Practical  Unix  and  Programming   .docx
CSCI 714 Software Project Planning and EstimationLec.docx
CSCI 561Research Paper Topic Proposal and Outline Instructions.docx
CSCI 561 DB Standardized Rubric50 PointsCriteriaLevels of .docx
CryptographyLesson 10© Copyright 2012-2013 (ISC)², Inc. Al.docx
CSCI 352 - Digital Forensics Assignment #1 Spring 2020 .docx
CSCE 1040 Homework 2 For this assignment we are going to .docx
CSCE509–Spring2019Assignment3updated01May19DU.docx
CSCI 2033 Elementary Computational Linear Algebra(Spring 20.docx
CSCE 3110 Data Structures & Algorithms Summer 2019 1 of .docx
CSCI 340 Final Group ProjectNatalie Warden, Arturo Gonzalez, R.docx
CSC-321 Final Writing Assignment In this assignment, you .docx
Cryptography is the application of algorithms to ensure the confiden.docx
CSc3320 Assignment 6 Due on 24th April, 2013 Socket programming .docx
Ad

Recently uploaded (20)

PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PPTX
Cell Structure & Organelles in detailed.
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
RMMM.pdf make it easy to upload and study
PPTX
Orientation - ARALprogram of Deped to the Parents.pptx
PDF
01-Introduction-to-Information-Management.pdf
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
VCE English Exam - Section C Student Revision Booklet
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
Classroom Observation Tools for Teachers
PPTX
Cell Types and Its function , kingdom of life
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PPTX
Pharma ospi slides which help in ospi learning
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
202450812 BayCHI UCSC-SV 20250812 v17.pptx
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Cell Structure & Organelles in detailed.
Final Presentation General Medicine 03-08-2024.pptx
O5-L3 Freight Transport Ops (International) V1.pdf
RMMM.pdf make it easy to upload and study
Orientation - ARALprogram of Deped to the Parents.pptx
01-Introduction-to-Information-Management.pdf
O7-L3 Supply Chain Operations - ICLT Program
VCE English Exam - Section C Student Revision Booklet
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Classroom Observation Tools for Teachers
Cell Types and Its function , kingdom of life
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Pharma ospi slides which help in ospi learning
Chinmaya Tiranga quiz Grand Finale.pdf
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Module 4: Burden of Disease Tutorial Slides S2 2025

CSC 240Lab 31) Update the specifications of the DeleteItem f.docx

  • 1. CSC 240 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. 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 #include "unsorted.h" using namespace std; int main() { UnsortedType classList;
  • 2. 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();
  • 3. 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; };