The data structure developed for program 1 does not identify an indexOf method. This useful tool reports back the List index of the first item it finds that matches its input parameter. If it is not present in the List, the method returns -1. Write the indexOf method. You may (and should) use any of the public methods identified in the List interface under program 1 in your solution. Use Example: int main(){ List myList = new LinkedList({1,2,3,4,5,7, 9}); « myList.index0f(4) 11 std::cout < "Index of 4: << std::endl; « myList.index0f 11 std::cout < "Index of 310: (310) << std::endl; } Output: -1

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter18: Stacks And Queues
Section: Chapter Questions
Problem 16PE: The implementation of a queue in an array, as given in this chapter, uses the variable count to...
icon
Related questions
Question
The data structure developed for program 1 does not
identify an indexOf method. This useful tool reports back
the List index of the first item it finds that matches its
input parameter. If it is not present in the List, the method
returns -1.
Write the indexOf method. You may (and should) use any
of the public methods identified in the List interface
under program 1 in your solution.
Use Example:
int main(){
List<int> myList
= new LinkedList({1,2,3,4,5,7,
9});
« myList.index0f(4)
std::cout << "Index of 4:
<< std::endl;
std::cout << "Index of 310:
(310) << std::endl;
%3D
<« myList.index0f
Output:
-1
Transcribed Image Text:The data structure developed for program 1 does not identify an indexOf method. This useful tool reports back the List index of the first item it finds that matches its input parameter. If it is not present in the List, the method returns -1. Write the indexOf method. You may (and should) use any of the public methods identified in the List interface under program 1 in your solution. Use Example: int main(){ List<int> myList = new LinkedList({1,2,3,4,5,7, 9}); « myList.index0f(4) std::cout << "Index of 4: << std::endl; std::cout << "Index of 310: (310) << std::endl; %3D <« myList.index0f Output: -1
The data structure developed for program 1 does not
identify a reverse method. This method totally inverts the
order of every item the list. The back of the line becomes
the front of the line. Write the reverse method. You may
(and should) use any of the public methods identified in
the List interface under program 1 in your solution.
Edit View
Insert
Format Tools Table
12pt v
Paragraph v :
Transcribed Image Text:The data structure developed for program 1 does not identify a reverse method. This method totally inverts the order of every item the list. The back of the line becomes the front of the line. Write the reverse method. You may (and should) use any of the public methods identified in the List interface under program 1 in your solution. Edit View Insert Format Tools Table 12pt v Paragraph v :
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning