SlideShare a Scribd company logo
1 of 1
Download to read offline
Below is a code segment for the Deleteltem function in an unsorted list implemented using a
static array Fill in the blank sections of code to successfully implement a deleted item void
UnsortedType::DeleteItem(ListItemType& item) There is at most one list item with the same
key as item; there may be none. Post: No list element has the same key as item. int location =
0; int index; bool moreToSearch; more search = bool found = false; while switch
(item.CompardTo(info[location])) case LESS: location^++ moretosearch = break; case
EQUAL:....= true break; if (found) {info [location] = leanth^-- What is the running time of the
Deleteltem operation?
Solution
A) 1.) false
2.) moreToSearch
3) True
4) True
5) found
6) item
B) Time Complexity T(N) = O(N)
C)
template
void UnsortedType::InsertItem(ItemType item)
// item is in the list; length has been incremented.
{
NodeType* location;
location = new NodeType;
location->info = item;
location->next = listData;
listData = location;
length++;
}

More Related Content

Similar to Below is a code segment for the Deleteltem function in an unsorted li.pdf

Lecture07 the linked-list_as_a_data_structure_v3
Lecture07 the linked-list_as_a_data_structure_v3Lecture07 the linked-list_as_a_data_structure_v3
Lecture07 the linked-list_as_a_data_structure_v3
Hariz Mustafa
 
How do I declare the following constructors in my .h file Below.pdf
How do I declare the following constructors in my .h file Below.pdfHow do I declare the following constructors in my .h file Below.pdf
How do I declare the following constructors in my .h file Below.pdf
Conint29
 
java I am trying to run my code but it is not letting me .pdf
java    I am trying to run my code but it is not letting me .pdfjava    I am trying to run my code but it is not letting me .pdf
java I am trying to run my code but it is not letting me .pdf
adinathassociates
 
Implement the ListArray ADT-Implement the following operations.pdf
Implement the ListArray ADT-Implement the following operations.pdfImplement the ListArray ADT-Implement the following operations.pdf
Implement the ListArray ADT-Implement the following operations.pdf
petercoiffeur18
 

Similar to Below is a code segment for the Deleteltem function in an unsorted li.pdf (20)

강의자료6
강의자료6강의자료6
강의자료6
 
AD3251-LINKED LIST,STACK ADT,QUEUE ADT.docx
AD3251-LINKED LIST,STACK ADT,QUEUE ADT.docxAD3251-LINKED LIST,STACK ADT,QUEUE ADT.docx
AD3251-LINKED LIST,STACK ADT,QUEUE ADT.docx
 
searching in data structure.pptx
searching in data structure.pptxsearching in data structure.pptx
searching in data structure.pptx
 
Linear and binary search
Linear and binary searchLinear and binary search
Linear and binary search
 
Lecture07 the linked-list_as_a_data_structure_v3
Lecture07 the linked-list_as_a_data_structure_v3Lecture07 the linked-list_as_a_data_structure_v3
Lecture07 the linked-list_as_a_data_structure_v3
 
DATA STRUCTURE CLASS 12 COMPUTER SCIENCE
DATA STRUCTURE CLASS 12 COMPUTER SCIENCEDATA STRUCTURE CLASS 12 COMPUTER SCIENCE
DATA STRUCTURE CLASS 12 COMPUTER SCIENCE
 
Arrays
ArraysArrays
Arrays
 
Hash table
Hash tableHash table
Hash table
 
Stacks queues
Stacks queuesStacks queues
Stacks queues
 
How do I declare the following constructors in my .h file Below.pdf
How do I declare the following constructors in my .h file Below.pdfHow do I declare the following constructors in my .h file Below.pdf
How do I declare the following constructors in my .h file Below.pdf
 
강의자료10
강의자료10강의자료10
강의자료10
 
data structures and algorithms Unit 3
data structures and algorithms Unit 3data structures and algorithms Unit 3
data structures and algorithms Unit 3
 
CEN 235 4. Abstract Data Types - Queue and Stack.pdf
CEN 235 4. Abstract Data Types - Queue and Stack.pdfCEN 235 4. Abstract Data Types - Queue and Stack.pdf
CEN 235 4. Abstract Data Types - Queue and Stack.pdf
 
java I am trying to run my code but it is not letting me .pdf
java    I am trying to run my code but it is not letting me .pdfjava    I am trying to run my code but it is not letting me .pdf
java I am trying to run my code but it is not letting me .pdf
 
DSA - Array.pptx
DSA - Array.pptxDSA - Array.pptx
DSA - Array.pptx
 
Algorithm
AlgorithmAlgorithm
Algorithm
 
ARRAY in python and c with examples .pptx
ARRAY  in python and c with examples .pptxARRAY  in python and c with examples .pptx
ARRAY in python and c with examples .pptx
 
Implement the ListArray ADT-Implement the following operations.pdf
Implement the ListArray ADT-Implement the following operations.pdfImplement the ListArray ADT-Implement the following operations.pdf
Implement the ListArray ADT-Implement the following operations.pdf
 
Arrays in C++
Arrays in C++Arrays in C++
Arrays in C++
 
arrays in c
arrays in carrays in c
arrays in c
 

More from shalins6

Describe two benefits of the industrial revolution and two proble.pdf
Describe two benefits of the industrial revolution and two proble.pdfDescribe two benefits of the industrial revolution and two proble.pdf
Describe two benefits of the industrial revolution and two proble.pdf
shalins6
 
A parts assembly station on a production line exhibits a severe vibra.pdf
A parts assembly station on a production line exhibits a severe vibra.pdfA parts assembly station on a production line exhibits a severe vibra.pdf
A parts assembly station on a production line exhibits a severe vibra.pdf
shalins6
 
Use C++ Write a function to merge two doubly linked lists. The input.pdf
Use C++ Write a function to merge two doubly linked lists. The input.pdfUse C++ Write a function to merge two doubly linked lists. The input.pdf
Use C++ Write a function to merge two doubly linked lists. The input.pdf
shalins6
 
Tissue regeneration is an emerging and exciting biomedical field. As.pdf
Tissue regeneration is an emerging and exciting biomedical field. As.pdfTissue regeneration is an emerging and exciting biomedical field. As.pdf
Tissue regeneration is an emerging and exciting biomedical field. As.pdf
shalins6
 
The preeminent American naturalist of the late 1800s was Charles Dar.pdf
The preeminent American naturalist of the late 1800s was  Charles Dar.pdfThe preeminent American naturalist of the late 1800s was  Charles Dar.pdf
The preeminent American naturalist of the late 1800s was Charles Dar.pdf
shalins6
 
the politics of the gilded age failed to deal with the critical soci.pdf
the politics of the gilded age failed to deal with the critical soci.pdfthe politics of the gilded age failed to deal with the critical soci.pdf
the politics of the gilded age failed to deal with the critical soci.pdf
shalins6
 

More from shalins6 (20)

Describe two benefits of the industrial revolution and two proble.pdf
Describe two benefits of the industrial revolution and two proble.pdfDescribe two benefits of the industrial revolution and two proble.pdf
Describe two benefits of the industrial revolution and two proble.pdf
 
Dee Dees parents place a high value on academic achievement, but h.pdf
Dee Dees parents place a high value on academic achievement, but h.pdfDee Dees parents place a high value on academic achievement, but h.pdf
Dee Dees parents place a high value on academic achievement, but h.pdf
 
An inter satellite link is established between two satellites. One sa.pdf
An inter satellite link is established between two satellites. One sa.pdfAn inter satellite link is established between two satellites. One sa.pdf
An inter satellite link is established between two satellites. One sa.pdf
 
Circle the correct words At fertilization, eggs and sperm carrying s.pdf
Circle the correct words  At fertilization, eggs and sperm carrying s.pdfCircle the correct words  At fertilization, eggs and sperm carrying s.pdf
Circle the correct words At fertilization, eggs and sperm carrying s.pdf
 
A small object is 25.0 cm from a diverging lens as shown in the figu.pdf
A small object is 25.0 cm from a diverging lens as shown in the figu.pdfA small object is 25.0 cm from a diverging lens as shown in the figu.pdf
A small object is 25.0 cm from a diverging lens as shown in the figu.pdf
 
Cautions about experimentation and samplingSolutionWhen exper.pdf
Cautions about experimentation and samplingSolutionWhen exper.pdfCautions about experimentation and samplingSolutionWhen exper.pdf
Cautions about experimentation and samplingSolutionWhen exper.pdf
 
CH30uz Lecture Which of the f.pdf
CH30uz Lecture Which of the f.pdfCH30uz Lecture Which of the f.pdf
CH30uz Lecture Which of the f.pdf
 
A parts assembly station on a production line exhibits a severe vibra.pdf
A parts assembly station on a production line exhibits a severe vibra.pdfA parts assembly station on a production line exhibits a severe vibra.pdf
A parts assembly station on a production line exhibits a severe vibra.pdf
 
You are conducting a study investigating the effects of a high-fat d.pdf
You are conducting a study investigating the effects of a high-fat d.pdfYou are conducting a study investigating the effects of a high-fat d.pdf
You are conducting a study investigating the effects of a high-fat d.pdf
 
Which of the following is not a premise of the Koch’s postulatesA.pdf
Which of the following is not a premise of the Koch’s postulatesA.pdfWhich of the following is not a premise of the Koch’s postulatesA.pdf
Which of the following is not a premise of the Koch’s postulatesA.pdf
 
What is inclusionSolutioninclusions in biology means the foll.pdf
What is inclusionSolutioninclusions in biology means the foll.pdfWhat is inclusionSolutioninclusions in biology means the foll.pdf
What is inclusionSolutioninclusions in biology means the foll.pdf
 
What organ systems that work with the digestive system to deliver nu.pdf
What organ systems that work with the digestive system to deliver nu.pdfWhat organ systems that work with the digestive system to deliver nu.pdf
What organ systems that work with the digestive system to deliver nu.pdf
 
What are the major design considerations for secondary clarifers fol.pdf
What are the major design considerations for secondary clarifers fol.pdfWhat are the major design considerations for secondary clarifers fol.pdf
What are the major design considerations for secondary clarifers fol.pdf
 
What is meant by composite pavement What is meant by composit.pdf
What is meant by composite pavement  What is meant by composit.pdfWhat is meant by composite pavement  What is meant by composit.pdf
What is meant by composite pavement What is meant by composit.pdf
 
Use C++ Write a function to merge two doubly linked lists. The input.pdf
Use C++ Write a function to merge two doubly linked lists. The input.pdfUse C++ Write a function to merge two doubly linked lists. The input.pdf
Use C++ Write a function to merge two doubly linked lists. The input.pdf
 
Using an intensity of 1 × 10-12 Wm2 as a reference, the threshold o.pdf
Using an intensity of 1 × 10-12 Wm2 as a reference, the threshold o.pdfUsing an intensity of 1 × 10-12 Wm2 as a reference, the threshold o.pdf
Using an intensity of 1 × 10-12 Wm2 as a reference, the threshold o.pdf
 
Tissue regeneration is an emerging and exciting biomedical field. As.pdf
Tissue regeneration is an emerging and exciting biomedical field. As.pdfTissue regeneration is an emerging and exciting biomedical field. As.pdf
Tissue regeneration is an emerging and exciting biomedical field. As.pdf
 
The preeminent American naturalist of the late 1800s was Charles Dar.pdf
The preeminent American naturalist of the late 1800s was  Charles Dar.pdfThe preeminent American naturalist of the late 1800s was  Charles Dar.pdf
The preeminent American naturalist of the late 1800s was Charles Dar.pdf
 
The LS and LF are calculated using thebackward pass through the ne.pdf
The LS and LF are calculated using thebackward pass through the ne.pdfThe LS and LF are calculated using thebackward pass through the ne.pdf
The LS and LF are calculated using thebackward pass through the ne.pdf
 
the politics of the gilded age failed to deal with the critical soci.pdf
the politics of the gilded age failed to deal with the critical soci.pdfthe politics of the gilded age failed to deal with the critical soci.pdf
the politics of the gilded age failed to deal with the critical soci.pdf
 

Recently uploaded

Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
ssuserdda66b
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 

Recently uploaded (20)

Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 

Below is a code segment for the Deleteltem function in an unsorted li.pdf

  • 1. Below is a code segment for the Deleteltem function in an unsorted list implemented using a static array Fill in the blank sections of code to successfully implement a deleted item void UnsortedType::DeleteItem(ListItemType& item) There is at most one list item with the same key as item; there may be none. Post: No list element has the same key as item. int location = 0; int index; bool moreToSearch; more search = bool found = false; while switch (item.CompardTo(info[location])) case LESS: location^++ moretosearch = break; case EQUAL:....= true break; if (found) {info [location] = leanth^-- What is the running time of the Deleteltem operation? Solution A) 1.) false 2.) moreToSearch 3) True 4) True 5) found 6) item B) Time Complexity T(N) = O(N) C) template void UnsortedType::InsertItem(ItemType item) // item is in the list; length has been incremented. { NodeType* location; location = new NodeType; location->info = item; location->next = listData; listData = location; length++; }