Print Fibonacci sequence using 2 variables

Problem Statement The problem “Print Fibonacci sequence using 2 variables” states that you need to print the Fibonacci sequence but there is a limitation of using only 2 variables. Example n = 5 0 1 1 2 3 5 Explanation The output sequence has the first five elements of the …

Read more

Implement Stack and Queue using Deque

Problem Statement The problem “Implement Stack and Queue using Deque” states to write an algorithm to implement Stack and Queue using a Deque(Doubly Ended Queue). Example (Stack) Push(1) Push(2) Push(3) Pop() isEmpty() Pop() Size() 3 false 2 1 Example (Queue) Enqueue(1) Enqueue(2) Enqueue(3) Dequeue isEmpty() Size() Dequeue() 1 false 2 …

Read more

Translate »