SlideShare a Scribd company logo
1 of 3
Download to read offline
Expand upon selectionSortType so that you are no longer bound to a list of 1000 elements. Thus,
you'll be using pointers to create dynamic arrays.
template
void selectionSortType::setUnsortedList (const elemType list[], int size)
{
elementsInList = size;
for (int i=0; i
void selectionSortType::getUnsortedList(elemType list[], int& size) const
{
size = elementsInList;
for (int i=0; i
void selectionSortType::getSortedList(elemType list[], int& size) const
{
size = elementsInList;
for (int i=0; i
int selectionSortType::getLargestElement() const
{
return sortedList[elementsInList-1];
}
template
int selectionSortType::getSmallestElement() const
{
return sortedList[0];
}
template
float selectionSortType::getAverage() const
{
float sum = 0;
for (int i=0; i
void selectionSortType::printUnsortedList(std::ostream& output) const
{
for (int i=0; i
void selectionSortType::printSortedList(std::ostream& output) const
{
for (int i=0; i
bool selectionSortType::equalList(const selectionSortType& otherList) const
{
if (otherList.elementsInList != elementsInList)
return false;
for (int i=0; i
selectionSortType::selectionSortType(const elemType list[], int size)
{
setUnsortedList(list,size);
}
template
selectionSortType::selectionSortType() //default constructor
{
elementsInList = 0;
}
template
void selectionSortType::sortList()
{
for (int i=0; i
Solution
template
void selectionSortType::setUnsortedList (const elemType list[], int size)
{
elementsInList = size;
for (int i=0; i
void selectionSortType::getUnsortedList(elemType list[], int& size) const
{
size = elementsInList;
for (int i=0; i
void selectionSortType::getSortedList(elemType list[], int& size) const
{
size = elementsInList;
for (int i=0; i
int selectionSortType::getLargestElement() const
{
return sortedList[elementsInList-1];
}
template
int selectionSortType::getSmallestElement() const
{
return sortedList[0];
}
template
float selectionSortType::getAverage() const
{
float sum = 0;
for (int i=0; i
void selectionSortType::printUnsortedList(std::ostream& output) const
{
for (int i=0; i
void selectionSortType::printSortedList(std::ostream& output) const
{
for (int i=0; i
bool selectionSortType::equalList(const selectionSortType& otherList) const
{
if (otherList.elementsInList != elementsInList)
return false;
for (int i=0; i
selectionSortType::selectionSortType(const elemType list[], int size)
{
setUnsortedList(list,size);
}
template
selectionSortType::selectionSortType() //default constructor
{
elementsInList = 0;
}
template
void selectionSortType::sortList()
{
for (int i=0; i

More Related Content

More from arihantplastictanksh

describe the three major categorical theories of language developmen.pdf
describe the three major categorical theories of language developmen.pdfdescribe the three major categorical theories of language developmen.pdf
describe the three major categorical theories of language developmen.pdf
arihantplastictanksh
 
Compare the capabilities of the Microsoft Access, Microsoft SQL Serv.pdf
Compare the capabilities of the Microsoft Access, Microsoft SQL Serv.pdfCompare the capabilities of the Microsoft Access, Microsoft SQL Serv.pdf
Compare the capabilities of the Microsoft Access, Microsoft SQL Serv.pdf
arihantplastictanksh
 
case study of a female with a parasitic disease Here is a Microbiolog.pdf
case study of a female with a parasitic disease Here is a Microbiolog.pdfcase study of a female with a parasitic disease Here is a Microbiolog.pdf
case study of a female with a parasitic disease Here is a Microbiolog.pdf
arihantplastictanksh
 
are marine multicellular protists belonging to the larger brown alg.pdf
are marine multicellular protists belonging to the larger brown alg.pdfare marine multicellular protists belonging to the larger brown alg.pdf
are marine multicellular protists belonging to the larger brown alg.pdf
arihantplastictanksh
 
18. Identify (at least 5) and explain their meanings of reducing ble.pdf
18. Identify (at least 5) and explain their meanings of reducing ble.pdf18. Identify (at least 5) and explain their meanings of reducing ble.pdf
18. Identify (at least 5) and explain their meanings of reducing ble.pdf
arihantplastictanksh
 
Which THREE of the following statements about autotrophs and heterot.pdf
Which THREE of the following statements about autotrophs and heterot.pdfWhich THREE of the following statements about autotrophs and heterot.pdf
Which THREE of the following statements about autotrophs and heterot.pdf
arihantplastictanksh
 
1. Baking a potato takes a long time, even when cooking uses differe.pdf
1. Baking a potato takes a long time, even when cooking uses differe.pdf1. Baking a potato takes a long time, even when cooking uses differe.pdf
1. Baking a potato takes a long time, even when cooking uses differe.pdf
arihantplastictanksh
 

More from arihantplastictanksh (20)

describe the three major categorical theories of language developmen.pdf
describe the three major categorical theories of language developmen.pdfdescribe the three major categorical theories of language developmen.pdf
describe the three major categorical theories of language developmen.pdf
 
Compare the capabilities of the Microsoft Access, Microsoft SQL Serv.pdf
Compare the capabilities of the Microsoft Access, Microsoft SQL Serv.pdfCompare the capabilities of the Microsoft Access, Microsoft SQL Serv.pdf
Compare the capabilities of the Microsoft Access, Microsoft SQL Serv.pdf
 
case study of a female with a parasitic disease Here is a Microbiolog.pdf
case study of a female with a parasitic disease Here is a Microbiolog.pdfcase study of a female with a parasitic disease Here is a Microbiolog.pdf
case study of a female with a parasitic disease Here is a Microbiolog.pdf
 
are marine multicellular protists belonging to the larger brown alg.pdf
are marine multicellular protists belonging to the larger brown alg.pdfare marine multicellular protists belonging to the larger brown alg.pdf
are marine multicellular protists belonging to the larger brown alg.pdf
 
8-9 Which gene (C or D) is downstream in the pathway based on the ep.pdf
8-9 Which gene (C or D) is downstream in the pathway based on the ep.pdf8-9 Which gene (C or D) is downstream in the pathway based on the ep.pdf
8-9 Which gene (C or D) is downstream in the pathway based on the ep.pdf
 
4. Belief in God Religion Studies researchers were interested in ma.pdf
4. Belief in God Religion Studies researchers were interested in ma.pdf4. Belief in God Religion Studies researchers were interested in ma.pdf
4. Belief in God Religion Studies researchers were interested in ma.pdf
 
18. Identify (at least 5) and explain their meanings of reducing ble.pdf
18. Identify (at least 5) and explain their meanings of reducing ble.pdf18. Identify (at least 5) and explain their meanings of reducing ble.pdf
18. Identify (at least 5) and explain their meanings of reducing ble.pdf
 
With enough money, energy, and political will, the nations of the wo.pdf
With enough money, energy, and political will, the nations of the wo.pdfWith enough money, energy, and political will, the nations of the wo.pdf
With enough money, energy, and political will, the nations of the wo.pdf
 
Which members of the truss are zero-force members Solutionass.pdf
Which members of the truss are zero-force members  Solutionass.pdfWhich members of the truss are zero-force members  Solutionass.pdf
Which members of the truss are zero-force members Solutionass.pdf
 
Which THREE of the following statements about autotrophs and heterot.pdf
Which THREE of the following statements about autotrophs and heterot.pdfWhich THREE of the following statements about autotrophs and heterot.pdf
Which THREE of the following statements about autotrophs and heterot.pdf
 
What type of biometric error signifies that an authorized user has b.pdf
What type of biometric error signifies that an authorized user has b.pdfWhat type of biometric error signifies that an authorized user has b.pdf
What type of biometric error signifies that an authorized user has b.pdf
 
What is an unintended medical consequences What is an example of on.pdf
What is an unintended medical consequences What is an example of on.pdfWhat is an unintended medical consequences What is an example of on.pdf
What is an unintended medical consequences What is an example of on.pdf
 
What is the best explanation for large smooth regions on Saturns m.pdf
What is the best explanation for large smooth regions on Saturns m.pdfWhat is the best explanation for large smooth regions on Saturns m.pdf
What is the best explanation for large smooth regions on Saturns m.pdf
 
Thirty students recorded the colors of their eyes, choosing from the.pdf
Thirty students recorded the colors of their eyes, choosing from the.pdfThirty students recorded the colors of their eyes, choosing from the.pdf
Thirty students recorded the colors of their eyes, choosing from the.pdf
 
The probability that a randomly selected adult owns an e-reader is 0..pdf
The probability that a randomly selected adult owns an  e-reader is 0..pdfThe probability that a randomly selected adult owns an  e-reader is 0..pdf
The probability that a randomly selected adult owns an e-reader is 0..pdf
 
The following tables relates degree of interest in political electio.pdf
The following tables relates degree of interest in political electio.pdfThe following tables relates degree of interest in political electio.pdf
The following tables relates degree of interest in political electio.pdf
 
1. Baking a potato takes a long time, even when cooking uses differe.pdf
1. Baking a potato takes a long time, even when cooking uses differe.pdf1. Baking a potato takes a long time, even when cooking uses differe.pdf
1. Baking a potato takes a long time, even when cooking uses differe.pdf
 
The amount of phospahtidylinositol-4,5-bisphosphate in the membrane .pdf
The amount of phospahtidylinositol-4,5-bisphosphate in the membrane .pdfThe amount of phospahtidylinositol-4,5-bisphosphate in the membrane .pdf
The amount of phospahtidylinositol-4,5-bisphosphate in the membrane .pdf
 
Steps Involved in documenting patient records efficiently in EHR. Yo.pdf
Steps Involved in documenting patient records efficiently in EHR. Yo.pdfSteps Involved in documenting patient records efficiently in EHR. Yo.pdf
Steps Involved in documenting patient records efficiently in EHR. Yo.pdf
 
1. Let R be the event that it is a rainy day and let U be the event t.pdf
1. Let R be the event that it is a rainy day and let U be the event t.pdf1. Let R be the event that it is a rainy day and let U be the event t.pdf
1. Let R be the event that it is a rainy day and let U be the event t.pdf
 

Expand upon selectionSortType so that you are no longer bound to a l.pdf

  • 1. Expand upon selectionSortType so that you are no longer bound to a list of 1000 elements. Thus, you'll be using pointers to create dynamic arrays. template void selectionSortType::setUnsortedList (const elemType list[], int size) { elementsInList = size; for (int i=0; i void selectionSortType::getUnsortedList(elemType list[], int& size) const { size = elementsInList; for (int i=0; i void selectionSortType::getSortedList(elemType list[], int& size) const { size = elementsInList; for (int i=0; i int selectionSortType::getLargestElement() const { return sortedList[elementsInList-1]; } template int selectionSortType::getSmallestElement() const { return sortedList[0]; } template float selectionSortType::getAverage() const { float sum = 0; for (int i=0; i void selectionSortType::printUnsortedList(std::ostream& output) const { for (int i=0; i void selectionSortType::printSortedList(std::ostream& output) const { for (int i=0; i
  • 2. bool selectionSortType::equalList(const selectionSortType& otherList) const { if (otherList.elementsInList != elementsInList) return false; for (int i=0; i selectionSortType::selectionSortType(const elemType list[], int size) { setUnsortedList(list,size); } template selectionSortType::selectionSortType() //default constructor { elementsInList = 0; } template void selectionSortType::sortList() { for (int i=0; i Solution template void selectionSortType::setUnsortedList (const elemType list[], int size) { elementsInList = size; for (int i=0; i void selectionSortType::getUnsortedList(elemType list[], int& size) const { size = elementsInList; for (int i=0; i void selectionSortType::getSortedList(elemType list[], int& size) const { size = elementsInList; for (int i=0; i int selectionSortType::getLargestElement() const { return sortedList[elementsInList-1];
  • 3. } template int selectionSortType::getSmallestElement() const { return sortedList[0]; } template float selectionSortType::getAverage() const { float sum = 0; for (int i=0; i void selectionSortType::printUnsortedList(std::ostream& output) const { for (int i=0; i void selectionSortType::printSortedList(std::ostream& output) const { for (int i=0; i bool selectionSortType::equalList(const selectionSortType& otherList) const { if (otherList.elementsInList != elementsInList) return false; for (int i=0; i selectionSortType::selectionSortType(const elemType list[], int size) { setUnsortedList(list,size); } template selectionSortType::selectionSortType() //default constructor { elementsInList = 0; } template void selectionSortType::sortList() { for (int i=0; i