Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
34 views

Data Structures and Algorithms

This document provides an overview of topics covered in Module 2 of the CS 010 403: Data Structures and Algorithms tutorial, including how to: (1) reverse elements of a stack using only push and pop operations; (2) efficiently implement a queue using two stacks and analyze running times; (3) efficiently implement a stack using two queues and analyze running times; and (4) implement two stacks using a single array. It also covers how to: (5) find the transpose of a sparse matrix; (6) discuss different queue types and their uses; and (7) perform addition of polynomials represented by arrays.

Uploaded by

Raji Pillai
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

Data Structures and Algorithms

This document provides an overview of topics covered in Module 2 of the CS 010 403: Data Structures and Algorithms tutorial, including how to: (1) reverse elements of a stack using only push and pop operations; (2) efficiently implement a queue using two stacks and analyze running times; (3) efficiently implement a stack using two queues and analyze running times; and (4) implement two stacks using a single array. It also covers how to: (5) find the transpose of a sparse matrix; (6) discuss different queue types and their uses; and (7) perform addition of polynomials represented by arrays.

Uploaded by

Raji Pillai
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 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