Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

can some one please help me with these questions? Exam 2: November, 2018 CSCI 6620 Data Structures 4. Heaps (10 points) 14 2 | 4

image text in transcribedcan some one please help me with these questions?

Exam 2: November, 2018 CSCI 6620 Data Structures 4. Heaps (10 points) 14 2 | 4 | 3 | 5 | 6 | 3 | 8 29 | 14 | 25 | 19 | 32 | 61|21|16 | 30 | 38 | 15 The diagram above is a min-heap of integers (a) (4) Insert the number 13 into this heap. Redraw the array on your answer paper (b) (6) Starting the result from part (a). Delete the top item on the heap and readjust the rest according to the deletion algorithm. Redraw the heap as you do each change. 5. Postfix (4 points) Calculate the answer and SHOW YOUR WORK, step by step: (a) given this postfix expression: a b * c d e-+ * f g % + (b) and given these values for the variables: a#3, b-2, c"1, d-7, e-3, f-10, g-5 6. Recursion (10 points) 1 #include next ); if (t > L->value) return t; else return L->value; List junk; // junk is filled up, as hown below int answer - m(junk); 23 24 junk 17 35 24 Look over the code and the diagram above. The diagram shows storage for the variable "junk". The main program calls the recursive function mm) (a) (8) On the right side of the page, simulate execution of the function call on line 24. Starting with main), show each stack frame that is built, with its contents and the value returned later for the function call. When you deallocate a frame, make a big X over it; don't erase it. In making your diagrams, you will have to draw pointers to cells; do this by writing ">35" to represent a pointer to the cell that has a 35 in it. (b) (2) What is stored in ansver after return from calling mm(Junk)? Scanned with CamScanner Exam 2: November, 2018 CSCI 6620 Data Structures 4. Heaps (10 points) 14 2 | 4 | 3 | 5 | 6 | 3 | 8 29 | 14 | 25 | 19 | 32 | 61|21|16 | 30 | 38 | 15 The diagram above is a min-heap of integers (a) (4) Insert the number 13 into this heap. Redraw the array on your answer paper (b) (6) Starting the result from part (a). Delete the top item on the heap and readjust the rest according to the deletion algorithm. Redraw the heap as you do each change. 5. Postfix (4 points) Calculate the answer and SHOW YOUR WORK, step by step: (a) given this postfix expression: a b * c d e-+ * f g % + (b) and given these values for the variables: a#3, b-2, c"1, d-7, e-3, f-10, g-5 6. Recursion (10 points) 1 #include next ); if (t > L->value) return t; else return L->value; List junk; // junk is filled up, as hown below int answer - m(junk); 23 24 junk 17 35 24 Look over the code and the diagram above. The diagram shows storage for the variable "junk". The main program calls the recursive function mm) (a) (8) On the right side of the page, simulate execution of the function call on line 24. Starting with main), show each stack frame that is built, with its contents and the value returned later for the function call. When you deallocate a frame, make a big X over it; don't erase it. In making your diagrams, you will have to draw pointers to cells; do this by writing ">35" to represent a pointer to the cell that has a 35 in it. (b) (2) What is stored in ansver after return from calling mm(Junk)? Scanned with CamScanner

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Databases With Application To GIS

Authors: Philippe Rigaux, Michel Scholl, Agnès Voisard

1st Edition

1558605886, 978-1558605886

More Books

Students also viewed these Databases questions

Question

how do I create the graphs for the basic visualizations?

Answered: 1 week ago

Question

How do Dimensional Database Models differ from Relational Models?

Answered: 1 week ago

Question

What type of processing do Relational Databases support?

Answered: 1 week ago

Question

Describe several aggregation operators.

Answered: 1 week ago