Professional Documents
Culture Documents
• Recursion
• Elementary Data Structures
T(n ) = 3 if n = 1
T(n - 1) + 7 otherwise,
…
S
0 1 2 t
Algorithm pop():
if isEmpty() then
throw EmptyStackException
else
e S[t]
s[t] null
tt1
return e
13
BITS Pilani, Pilani Campus
An example of a method stack
– Waiting lines
– Access to shared resources (e.g., printer)
– Multiprogramming
– Protocol Implementation in networks etc.,