Computer Science, asked by dwivediashutosh393, 1 month ago

How are stacks push and pop operations performed in recursive algorithms? Write a non- recursive function, using stack, for generating a term in Fibonacci series.​

Answers

Answered by anshdeepsinghisking
1

Answer:

please mark as brainiliest

Explanation:

Given a stack, sort it using recursion. ... push(S) : Adds new element to the stack. pop(S) : Removes top element from the stack. top(S) : Returns value of the top element.

f(0) = 1;

f(1) = 3;

f(n) = 3 * f(n - 1) - f(n - 2); // for n >= 2.

Similar questions