Question
Using inheritance, extend the template class indexList (posted on UR Courses) with the following functions: Concatenate two indexed lists. Sort an indexed list using the
Using inheritance, extend the template class indexList (posted on UR Courses) with the following functions:
Concatenate two indexed lists.
Sort an indexed list using the selection sort algorithm (declared in indexList but not implemented).
Find the position of a target using the binary search algorithm.
Write a driver program that will create two indexed lists of integers, concatenate the two lists, sort the resulting list and then display it. In addition, the driver will search for a target in the resulting list.
Hand In
1. The header, implementation and driver programs should be respectively named : IndexList.h, IndexList.cpp, ExtIndexList.h, ExtIndexList.cpp and TestExtIndexList.cpp. In the class indexList, include only the required member functions.
2. Your C++ programs SHOULD compile using CC (Sun compiler) under Hercules.
A sample run follows List 1 of type "int" Enter number of list items: 4 Enter next item: 11 Enter next item Enter next item: 5 Enter next item: 34 List 2 of type "int" Enter number of list items: 3 Enter next item: 0 Enter next item: 2 Enter next item: 49 List 3: List 1 concatenated to List 2 11, 7, 5, 34, 0, 2, 49 List 3 sorted in ascending order 0, 2, 5, 7, 11, 34, 49 Enter the number to search in List 3: 11 11 is at position 5
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started