Question: Write a pseudocode algorithm that returns the average of the elements in a stack. Also, give the Big O of your algorithm. Your algorithm must
Write a pseudocode algorithm that returns the average of the elements in a stack. Also, give the Big O of your algorithm. Your algorithm must not change the final state of the stack ie the stack should be the same at the end of your function
For example, given the Stack with contents top would return The method signature should be calculateaverageStack list float.
Recall that the available methods for a stack are:
push
pop
peek
isEmpty
size
clear
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
