All functions should belong to a template class. Functions' code should be efficient as well as correct. For all linked lists, first points to the first node and it is the only pointer in the list (there is no last). For circular sorted lists first points to the largest element. Write a function, to be included in an unsorted linked list class, called replace item, that will receive two parameters, one called olditem, the other called newitem. The function will replace all occurrences of olditem with newitem ( if olditem exists !! ) and it will return the number of replacements done. Write a function, to be included in a sorted linked list class, called printPosition, that will receive a parameter and print its position within the list ( position 1 if first, position 2 if second...). If the item is not in the list, specify it in a printing. Consider efficiency. Write a function, to be included in an unsorted linked list class, called getLargest, that will return the largest item in the list.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter17: Linked Lists
Section: Chapter Questions
Problem 5PE
icon
Related questions
Question

C++

All functions should belong to a template class. Functions' code should be efficient as well as correct.
For all linked lists, first points to the first node and it is the only pointer in the list (there is no last).
For circular sorted lists first points to the largest element.
Write a function, to be included in an unsorted linked list class, called replace item, that will receive two
parameters, one called olditem, the other called newitem. The function will replace all occurrences of olditem
with newitem ( if olditem exists !! ) and it will return the number of replacements done.
Write a function, to be included in a sorted linked list class, called printPosition, that will receive a parameter
and print its position within the list (position 1 if first, position 2 if second...). If the item is not in the list,
specify it in a printing. Consider efficiency.
Write a function, to be included in an unsorted linked list class, called getLargest, that will return the largest
item in the list.
www
Transcribed Image Text:All functions should belong to a template class. Functions' code should be efficient as well as correct. For all linked lists, first points to the first node and it is the only pointer in the list (there is no last). For circular sorted lists first points to the largest element. Write a function, to be included in an unsorted linked list class, called replace item, that will receive two parameters, one called olditem, the other called newitem. The function will replace all occurrences of olditem with newitem ( if olditem exists !! ) and it will return the number of replacements done. Write a function, to be included in a sorted linked list class, called printPosition, that will receive a parameter and print its position within the list (position 1 if first, position 2 if second...). If the item is not in the list, specify it in a printing. Consider efficiency. Write a function, to be included in an unsorted linked list class, called getLargest, that will return the largest item in the list. www
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