Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

S246 Data & File Structures 60 points FORMB Please read all instructions Ginclud

ID: 3700602 • Letter: S

Question

S246 Data & File Structures 60 points FORMB Please read all instructions Gincluding these) carefully. You should look through the entire axam before getting started, in order plan your strategy You 50 minutes to eomplete the exam. This exam is closed books and closed notes in the spaces provided on the exam. Make sure your solutions are neat and clearly marked. You may 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, I have neilther given nor received assistance on the exam of queues by using arrays. How do you initialize the pointers FRoNT and REAR,PRON EAR(2 points each) 2 Given the recursive tunction (3 points) int Funet F in int n return 2 Funcin 1 what is the value of the expression Func(2) C) 40 0) 80 E) none-the result is infinte recurion u know that together they never have more than MAX lements You deade representstion with both stacks residing in the same arrany but with two logical pointers to top top1 (for stackt) and top2 0or where you need to use two stacks. You Stackf grows from lelt to right, stack2 grows from right to left. Notice this is not a linked list. Use the following definitions and rations 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 parameter is stack2, the us sses the stack where the top is top2. Fill in the blank in the code below (3 points each) const MAX100: typedef int litem Type struct StackType f components on the stacks Item Type info[MAXJ; int top1 int top2 l top for stack # top for stack2 void CreateStack1(StackTypes stackt) l Post: stack1 has been set to empty stack1 top1-1 void CreateStack2/StackType& stack2) l Post: stack2 has been set to empty stack2 top2 MAX Boolean IsFull(StackType stack) l Pre: stack has been created l Post: return FALSE if there is room for another item; TRUE otherwise

Explanation / Answer

1. Front = -1, Rear = -1;
2. Recursion output : C) 40
3. return (stack.top1 == stack.top2-1);