Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

CS 010 403: DATA STRUCTURES AND ALGORITHMS

Tutorial

Module 2
TOPICS: Stacks & Queues

1. Given a stack, how to reverse the elements of stack using only stack operations
(push & pop)?
2. Show how to implement one queue efficiently using two stacks. Analyze the running
time of queue operations.
3. Show how to implement one stack efficiently using two queues. Analyze the running
time of stack operations.
4. How do we implement 2 stacks using only one array? ( Hint: Our stack routines
should not indicate an exception unless every slot in the array is used.)
5. Write a program to find the transpose of a sparse matrix.
6. Discuss upon the different types of queues used in programming and point out the
scenarios in which each of those queues would be useful.
7. Write an algorithm to perform addition of two polynomials, represented using
arrays.

You might also like