Question: need help with a computer science C++ lab. this lab deals with recursion and we can not use any conditional statements for answering the questions.

need help with a computer science C++ lab.

this lab deals with recursion and we can not use any conditional statements for answering the questions.

here is the problem i need help with and it is in C++ language

Lab: Recursion Fun - TEST YOUR MIGHT! No loops allowed for this lab: -no for loops -no while loops -no do-while's -no while-do's -no for-while's -no while-for-do's #1: Write a method void lineOfStars(int n) that prints a line of n stars. You may not use a loop. lineOfStars(5); // should display: ***** #2: Write a method void stars(int n) that prints the weird shape below. You may not use a loop. You may call lineOfStars as a subroutine. stars(4); should display: **** *** ** * * ** *** **** #5: Write a recursive function 'void reverseArray(doulbe * numbers, int start, int end)' which reverses the order of elements in the given array from index start to index end (inclusive). #6: Write a function 'int threeSum(int n)' which returns the value 1+2+3+4+...+ 3n. #7: Write recursive "printForward(node *p)" and "printBackward(node * p)" methods for the linked list class provided below so that the following test code words as specified in the comments: linkedList list; list.push_front(8); list.push_front(7); list.push_front(6); list.push_front(5); list.push_front(4); list.push_front(3); list.push_front(2); list.push_front(1); list.printForwards(); //1,2,3,4,5,6,7,8, cout << endl; list.printBackwards(); //8,7,6,5,4,3,2,1, cout << endl; class linkedList { private: class node { public: double data; node * next; node(double x) { data = x; next = NULL; } }; node * head; //print the contents of the list from p to the end (no loops!) void printForwards(node * p) { } //print the contents of the list from p to the end but in reverse order! void printBackwards(node * p) { } public: linkedList() { head = NULL; } void push_front(double x) { node * babyNode = new node(x); babyNode->next = head; head = babyNode; } void printForwards() { printForwards(head); } void printBackwards() { printBackwards(head); } }; 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!