Question: SOLVE PLEASE EXPERTS ONLY : Homework 1 ( Data Structures, Fall 2 0 2 4 ) Due: 1 6 t h September 2 0 2
SOLVE PLEASE EXPERTS ONLY :
Homework Data Structures, Fall Due: September : PM
Qa What's is the result of the following postfix? Show the stack at the various stages of scanning the input postfix, the way it was done in class. Each time the stack changes, show the stack
b In Onotation, what is the time complexity of this algorithm that evaluates postfix expressions Where is the length of the given postfix string
Qa Write a function: "reverseStackStack which prints the contents of the stack st in reverse ie the top of the stack is printed last
You are allowed only to use another stack, "Stack st That is you cannot use any arrays etc. The only functions you can use on stacks are pop push and emptyHint: You put the contents of one stack into another by popping and pushing. Is the order the same?
b Let be the length of the input stack. Let be the total number of times you had to push and pop from the two stacks. Express in terms of What is the complexity of this reversing algorithm in Onotation?
Q Consider the following nested loop:a How many times is jj executed? Do not ignore any constants, as we are not talking about the Onotation yetb In the code shown above, answer a if we replace jj with j jc Answer a if we make the following two changes to the code: We replace i with i as well as we replace jj with jj
Q Order the following functions in ascending order of growth That is the function that grows the slowest growing function comes first :
NOTE: klog and therefore have the same order of growth. However, of course has a different order of growth as you would already know.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
