Consider the following piece of pseudocode: function Thing(n) if n <3 then return 1 end if new Stack s PUSH[1, s] PUSH[1, s] for 3

Algebra & Trigonometry with Analytic Geometry
13th Edition
ISBN:9781133382119
Author:Swokowski
Publisher:Swokowski
Chapter9: Systems Of Equations And Inequalities
Section9.6: The Algebra Of Matrices
Problem 35E
icon
Related questions
Question
. Consider the following piece of pseudocode:
function Thing(n)
if n < 3 then
return 1
end if
new Stack s
PUSH[1, s]
PUSH[1, s]
for 3 ≤ i ≤n do
x ← TOP [s]
POP[s]
y ← TOP[s]
PUSH[x, s]
PUSH(x + y, s]
end for
return TOP[s]
end function
What is returned by the function call Thing(7)?
Transcribed Image Text:. Consider the following piece of pseudocode: function Thing(n) if n < 3 then return 1 end if new Stack s PUSH[1, s] PUSH[1, s] for 3 ≤ i ≤n do x ← TOP [s] POP[s] y ← TOP[s] PUSH[x, s] PUSH(x + y, s] end for return TOP[s] end function What is returned by the function call Thing(7)?
Expert Solution
steps

Step by step

Solved in 7 steps with 44 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Algebra & Trigonometry with Analytic Geometry
Algebra & Trigonometry with Analytic Geometry
Algebra
ISBN:
9781133382119
Author:
Swokowski
Publisher:
Cengage
Algebra: Structure And Method, Book 1
Algebra: Structure And Method, Book 1
Algebra
ISBN:
9780395977224
Author:
Richard G. Brown, Mary P. Dolciani, Robert H. Sorgenfrey, William L. Cole
Publisher:
McDougal Littell
Mathematics For Machine Technology
Mathematics For Machine Technology
Advanced Math
ISBN:
9781337798310
Author:
Peterson, John.
Publisher:
Cengage Learning,
Elementary Linear Algebra (MindTap Course List)
Elementary Linear Algebra (MindTap Course List)
Algebra
ISBN:
9781305658004
Author:
Ron Larson
Publisher:
Cengage Learning
Linear Algebra: A Modern Introduction
Linear Algebra: A Modern Introduction
Algebra
ISBN:
9781285463247
Author:
David Poole
Publisher:
Cengage Learning
Intermediate Algebra
Intermediate Algebra
Algebra
ISBN:
9781285195728
Author:
Jerome E. Kaufmann, Karen L. Schwitters
Publisher:
Cengage Learning