#include [removed]
using namespace std;
class cList {
public:
cList();
~cList();
cList(int n);
int getNum();
cList *previous;
cList *next;
private:
int num;
};
cList::cList() // Question c).
cList::~cList() { } // Question d).
cList::cList(int n) // Question e).
int cList::getNum() {
return num;
}
int function1(int m) {
return (m%3);
}
int main() {
cList *p1 = new cList(21);
cList *p2 = new cList(3);
cList *p3 = new cList(80);
cList *p4 = new cList(16);
p1→previous = p4;
p1→next = p2;
p2→previous = p1;
p2→next = p3;
p3→previous = p2;
p3→next = p4;
p4→next = p1;
p4→previous = p3;
cList *current = p3;
while (current→next != p3) {
cout << function1(current→getNum()) << “n”;
current = current→next;
}
while (current→previous != p2) {
cout << function1(current→getNum()) << “n”;
for (int i=0; i[removed]= 1.
c. Implement a function that returns the value of the nth number in this sequence.
9. Suppose there are seven players playing Halo3. They are CatchMeIfYouCan, Halo4, Fake1, SweetGirl, NaughtyBoy, GoldenFinger, and FireBall. Their scores are as indicated in the following Table 1,
Name Score
CatchMeIfYouCan 1500
Halo4 3500
Fake1 1000
SweetGirl 2200
NaughtyBoy 1960
GoldenFinger 12900
FireBall 5800
Table 1. Players and Scores
Now use BubbleSort algorithm to sort the players in the descending order of their scores. Write down/ draw the table of each intermediate step/ round and determine how many steps/ rounds BubbleSort uses totally. (15 points)
CatchMeIfYouCan
Halo4
Fake1
SweetGirl
NaughtyBoy
GoldenFinger
FireBall
GoldenFinger
CatchMeIfYouCan
Halo4
Fake1
SweetGirl
NaughtyBoy
FireBall
GoldenFinger
FireBall
CatchMeIfYouCan
Halo4
Fake1
SweetGirl
NaughtyBoy
GoldenFinger
FireBall
Halo4
CatchMeIfYouCan
SweetGirl
Fake1
NaughtyBoy
GoldenFinger
FireBall
Halo4
SweetGirl
CatchMeIfYouCan
NaughtyBoy
Fake1
GoldenFinger
FireBall
Halo4
SweetGirl
NaughtyBoy
CatchMeIfYouCan
Fake1
10. (Bonus points) Is there repetitive/ unnecessary step/ round in the above BubbleSort? If there is, how will you suggest avoiding repetitive/ unnecessary step/ round in the BubbleSort algorithm? (10 points)
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more