Examination#3 (Chapters 1-9) 60 points (FORM B S246 Data &File; Struetures Pleas
ID: 3700604 • Letter: E
Question
Examination#3 (Chapters 1-9) 60 points (FORM B S246 Data &File; Struetures Please read altlInstructions including thesej carefully You should look through the entire exam bafore getting started, in rdr 50 minutes to complete the exam. This exam is closed books and closed notes i provided on the exam. Make sure your solutions are neat and clearly marked. You may your strategy. You have se the backs of the exam pages as scratch paper AME: Last 4 digits of T8) (Print) Last First accordance with both the letter and spirit of the Honor Code, have neither given nor received assistance on the exam of queues by using arrays How do you initialize the pointers PRoNT and REA, PROT 2 Given the recursive unction (3 points) int Fune(- in int n) return 5 return 2 Funcin 1% what is the value of the expression Func(a) ? C) 40 D) 80 E) none-the result is infinte recursion use tiwo stacks You know that together they never have more than MAX elments You deoide epresentsation with both stacks residing in the same array but with two logical pointers to top top1 (for stackt) and top2 or ok2) Stackt grows from lelt to right, sack2 grows from right to left. Notice this is not a linked list. Use the following definitions and larations. Note that the stack is being passed as a parameter to these functions, they are not member functions of a class You may ume that when the parameter is stackt, the user passes the stack where the top is topf and that when the perameter is stack2, the us sses the stack where the top is top2. Fil in the blank in the code below (3 points each) const MAX-100 typedef int item Type; struct StackType l components on the stacks Item Type info[MAX] int topt int top2 l top for stack l top for stack2 void CreateStack1(StackTypes stackt) W Post stacki has been set to empty stack1 top1-1 void CreateStack2(StackType& stack2) l Post: stack2 has been set to empty Boolean IsFull(StackType stack) l Pre: stack has been created Il Post: return FALSE if there is room for another item; TRUE otherwiseExplanation / Answer
Qustion 1
The values initialised are
Front = -1
Rear = -1
Question 2
Answer is C 40
Explanantion
Every time the value of n is increaing and atlast when it reaches to 5 the calcultaion is returned
Question 3
if stack.top1==n-1
then stack1 is full
if stack.top2==n-1
then stack2 is full
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.