Problem Solving with C++ (10th Edition)
10th Edition
ISBN: 9780134448282
Author: Walter Savitch, Kenrick Mock
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Chapter 18.2, Problem 8STE
Program Plan Intro
STL Basic sequential containers:
“slist”:
- The template class for “slist” class is “<slist>”
- The template class for “slist” is “slist<T>::iterator”.
- This class uses mutable and forward iterator.
- The template class for constant iterator is “slist<T>::const_iterator”.
- This class uses constant and forward iterator.
“list”:
- The template class for “list” class is “<list>”
- The template class for “list” is “list<T>::iterator”.
- This class uses mutable and bidirectional iterator.
- The template class for constant iterator is “list<T>::const_iterator”.
- This class uses constant and bidirectional iterator.
- The template class for reverse iterator is “list<T>::reverse_iterator”.
- This class uses mutable and bidirectional iterator.
- The template class for constant reverse iterator is “list<T>::const_reverse_iterator”.
- This class uses constant and bidirectional iterator.
“
- The template class for “vector” class is “<vector>”
- The template class for “vector” is “vector<T>::iterator”.
- This class uses mutable, random, and access iterator.
- The template class for constant iterator is “vector<T>::const_iterator”.
- This class uses constant, random, and access iterator.
- The template class for reverse iterator is “vector<T>::reverse_iterator”.
- This class uses mutable, random, and access iterator.
- The template class for constant reverse iterator is “vector<T>::const_reverse_iterator”.
- This class uses constant, random, and access iterator.
“deque”:
- The template class for “deque” class is “<deque>”
- The template class for “deque” is “deque<T>::iterator”.
- This class uses mutable, random, and access iterator.
- The template class for constant iterator is “deque<T>::const_iterator”.
- This class uses constant, random, and access iterator.
- The template class for reverse iterator is “deque<T>::reverse_iterator”.
- This class uses mutable, random, and access iterator.
- The template class for constant reverse iterator is “deque<T>::const_reverse_iterator”.
- This class uses constant, random, and access iterator.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Given a template class named indexList, the prototype of one of its member function is as follows:
bool replace (int index, const T &item);
When implementing, what is the prototype (the first two lines only) of the replace function? The body of the function is
not needed.
A
B I EE % $5
3
in C++
kth ElementExtend the class linkedListType by adding the following operations:a. Write a function that returns the info of the kth element of the linked list. If no such element exists, terminate the program.b. Write a function that deletes the kth element of the linked list. If no such element exists, terminate the program. Provide the definitions of these functions in the class linkedListType.
please, do not copy from any other sources, give me a fresh new code. Thank you
Add the following functions and write a program to test these functions in the class
linkedListType:
a. Write the definition of a function that returns the data of the kth element of the linked list. If such
element is not exist in the list, exit the program.
b. Write the definition of a function that deletes the kth element of the linked list. If such element does not exist in the list, exit the program and display message as output.
Chapter 18 Solutions
Problem Solving with C++ (10th Edition)
Ch. 18.1 - If v is a vector, what does v.begin() return? What...Ch. 18.1 - If p is an iterator for a vector object v, what is...Ch. 18.1 - Suppose v is a vector of ints. Write a for loop...Ch. 18.1 - Suppose the vector v contains the letters 'A',...Ch. 18.1 - Suppose the vector v contains the letters 'A',...Ch. 18.1 - Suppose you want to run the following code, where...Ch. 18.2 - Prob. 7STECh. 18.2 - Prob. 8STECh. 18.2 - Prob. 9STECh. 18.2 - Prob. 10STE
Ch. 18.2 - Prob. 11STECh. 18.2 - Prob. 12STECh. 18.2 - Prob. 13STECh. 18.2 - Prob. 14STECh. 18.2 - Prob. 15STECh. 18.2 - Prob. 16STECh. 18.3 - Prob. 17STECh. 18.3 - Prob. 18STECh. 18.3 - Prob. 19STECh. 18.3 - Suppose v is an object of the class vectorint. Use...Ch. 18.3 - Prob. 21STECh. 18.3 - Can you use the copy template function with vector...Ch. 18.3 - Prob. 23STECh. 18 - Prob. 1PCh. 18 - Prob. 2PCh. 18 - Prob. 3PCh. 18 - Prob. 4PCh. 18 - Write a program that allows the user to enter any...Ch. 18 - Prob. 3PPCh. 18 - Prob. 5PPCh. 18 - Solution to Programming Project 18.6 In this...Ch. 18 - Prob. 7PPCh. 18 - You have collected a file of movie ratings where...Ch. 18 - Prob. 9PPCh. 18 - Prob. 11PPCh. 18 - Write a program that uses regular expressions to...
Knowledge Booster
Similar questions
- Add the following functions and write a program to test these functions in the class linkedListType: a. Write the definition of a function that returns the data of the kth element of the linked list. If such element is not exist in the list, exit the program. b. Write the definition of a function that deletes the kth element of the linked list. If such element is not exist in the list, exit the program and display message as output. (Subject:Data stracture and algorithm )arrow_forwardC++arrow_forwardC++arrow_forward
- How does the function insertFirst of the class unorderedLinkedList differ from the function insertFirst of the class orderedLinkedList.arrow_forwardAdd the following functions and write a program to test these functions in the classlinkedListType:a. Write the definition of a function that returns the data of the kth element of the linked list. If suchelement is not exist in the list, exit the program. (05)b. Write the definition of a function that deletes the kth element of the linked list. If such element isnot exist in the list, exit the program and display message as output.arrow_forwardAdd the following operation to the class orderedLinkedList: void mergeLists(orderedLinkedList<Type> &list1, orderedLinkedList<Type> &list2); //This function creates a new list by merging the //elements of list1 and list2. //Postcondition: first points to the merged list // list1 and list2 are empty Consider the following statements: orderedLinkedList<int> newList; orderedLinkedList<int> list1; orderedLinkedList<int> list2; Suppose list1 points to the list with the elements 2 6 7, and list2 points to the list with the elements 3 5 8. The statement newList.mergeLists(list1, list2); creates a new linked list with the elements in the order 2 3 5 6 7 8, and the object newList points to this list. Also, after the preceding statement executes, list1 and list2 are empty. 2. Write the definition of the function template mergeLists to implement the operation mergeLists.arrow_forward
- In a new file named runner.cpp, define the Runner class, whose purpose is to hold the profile data for a user and maintain a record of their activities. The Runner class should have the following members • private variables for: username (string), age (integer, in years), weight (integer, in kg), height (integer, in cm), runList (list container of Run objects 2)arrow_forwardProgramming Language: C++ I need the codes for arrayListType.h, main.cpp, myString.cpp, myString.harrow_forwardCan template<typename T> be replaced by template<class T>?arrow_forward
- Suppose your program uses a class template named List, which is defined as template<class T> class List{// Members are declared here… }; Give an example of how you would use int as the data type in the declaration of a List object. (Assume the class has a default constructor.)arrow_forwardDesign a template class and derived from non-template class and calculate the area of cube.arrow_forwardUnordered Sets |As explained in this chapter, a set is a collection of distinct elements of the same type. Design the class unorderedSetType, derived from the class unorderedArrayListType, to manipulate sets. Note that you need to redefine only the functions insertAt, insertEnd, and replaceAt. If the item to be inserted is already in the list, the functions insertAt and insertEnd output an appropriate message, such as 13 is already in the set. Similarly, if the item to be replaced is already in the list, the function replaceAt outputs an appropriate message. Also, write a program to test your class.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning