Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can someone solve the todo parts of the following problem. #include #include VectorADT.h //GIVEN template VectorADT ::VectorADT() { dataArray= new T*[SIZE]; count=0; } // TODO

Can someone solve the todo parts of the following problem.

#include #include "VectorADT.h"

//GIVEN template VectorADT::VectorADT() { dataArray= new T*[SIZE]; count=0; }

// TODO // double the size of the dataArray // create a temporary dataArray of double the size

// copy over the current data Array and then delete it // use REM documentation template void VectorADT::resizeADT(){ // TODO //NOTE here is where the integer SIZE will get doubled }

// TODO // appends an element to the end of the VectorADT // increments count by 1 // if run out of SIZE, resize the vector // REM documentation template void VectorADT::push_back(T *v){ // TODO // if array is too small, use resizeADT() (that's the function above) }

// TODO // returns a copy of the element from the end of the VectorADT // does not delete any element // no resize of the vector // REM documentation template T * VectorADT::pop(){ // TODO // Use an if else statement to make sure that the array has an item // if it does, return the item in the array. If not, exit. }

// TODO // removes an element from the end of the VectorADT // decrements size by 1 // no resize of the vector // REM documentation template T * VectorADT::pop_back() { // TODO // This function does exactly what pop() does but it will // also remove the item from the end of the VectorADT }

// GIVEN template void VectorADT::printVectorADT(){ for (int i=0;i

// GIVEN template int VectorADT::size() const { return count; }

//FILL IN THE BLANK FOR COMPARISON template int VectorADT::sort(LessThan less){ int steps=0; T * minValue= new T(); int minIndex=0; for (int i=0;i

/*if () { minValue=dataArray[j]; minIndex=j; }*/

steps++; } dataArray[minIndex]=dataArray[i]; dataArray[i]=minValue; } return steps; }

//GIVEN template bool VectorADT:: empty(){ return (count<=0); }

//GIVEN template T* VectorADT:: get(int i) const{ if (i>=0 && i

//GIVEN template void VectorADT::set(int i, T * t) { if (i>=0 && i

// TODO // USE template // inserts the object at the given INDEX position NOT chart position // Does NOT adjust chart position // THROWS exception if index out of bounds // right adjusts the elements to the right of the inserted object // returns number of adjusted steps template int VectorADT::insert(T * v, int pos){ int adjustSteps=0; // TODO return adjustSteps; }

// TODO // USE template // removes the object at the given INDEX position NOT chart position // DOes NOT adjust chart position // THROWS exception if index out of bounds // left adjusts the elements to the right of the inserted object // returns number of adjusted steps template int VectorADT::remove(int pos){ int adjustSteps=0; // TODO return adjustSteps; }

// TODO // Linear search // use the overloaded == operator of the Song objects // returns -1 if not found else returns the found index template int VectorADT::searchByTitle(int& steps, T *v){ // TODO return -1; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

101 Database Exercises Text Workbook

Authors: McGraw-Hill

2nd Edition

0028007484, 978-0028007489

More Books

Students also viewed these Databases questions

Question

Solve for x : where -2 arctan(x) + arctan(-): x>0

Answered: 1 week ago