0% found this document useful (0 votes)
92 views

Data Structures: Unit - II

This document discusses various data structures concepts. It defines abstract data types, modularity, linked lists, stacks, queues and compares different data structures. Linked lists, stacks and queues are linear data structures that allow insertion and deletion of elements. Stacks follow LIFO order while queues follow FIFO order. The document provides examples and applications of these data structures.

Uploaded by

Sriram Senthil
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
92 views

Data Structures: Unit - II

This document discusses various data structures concepts. It defines abstract data types, modularity, linked lists, stacks, queues and compares different data structures. Linked lists, stacks and queues are linear data structures that allow insertion and deletion of elements. Stacks follow LIFO order while queues follow FIFO order. The document provides examples and applications of these data structures.

Uploaded by

Sriram Senthil
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 7

MAAMALLAN INSTITUTE OF TECH

DEPT OF CSE

DATA STRUCTURES
Unit –II
1. Define ADT.

ADT  Abstract Data Type. It is a set of operations such


as Union, Intersection, Complement etc., It is an extension of
modular design.

2. Define Modularity.

In programming, each problem can be divided in small


sub modules. Each module is a logical unit and do the specific
job & it will call another module.

3. Comparison between Linked list and Arrays.

S.N Linked List Arrays


o

1 Continuous memory Dynamic memory allocation


allocation

2 Size declared before Size declared during run time


compilation

3 Accessing the element is Accessing the element is


fast slow

4 Wastages of memory No wastages

5 Direct accessing the Direct accessing the element


element is possible is not possible

4. Define Linked list.

It is nothing but the collection of nodes. A node consists


of data field & address field.

5. What are the types of linked list?

Singly, doubly, & Circular linked list.


MAAMALLAN INSTITUTE OF TECH
DEPT OF CSE

6. What are the advantages & disadvantages of singly linked list


over doubly linked list?

List Advantages Disadvantages

Singly Less memory space. One Time complexity is less.


data & one address unit. Because we can travel only
one side.

Doubl We can travel both Extra memory unit for the


y directions. So accessing address of previous node.
the data is easy.

7. What are the advantages & disadvantages in Circular linked


list?

List Advantages Disadvantages

Circul To move immediately If we lose header position,


ar from Ist node to last may not be able to find out
node. where it begins & ends.

8. List out applications of Linked list.

a) Radix sort

b) Multi list

c) Polynomial ADT

9. What do u mean by cursor implementation of list?

It maintains a list of free cells called cursors space in


which slot 0 is considered as a header and next is equivalent
to the pointer which points to the next slot.

10. Define Stack.

It is a linear data structure. It is based on the concept of


Last In First Out ( LIFO). Insertion & deletion can be done at
same end called top.
MAAMALLAN INSTITUTE OF TECH
DEPT OF CSE

11. Define Top.

It is a position, where the insertion & deletion takes place


in stack called top.

12. What are the operations of stack & its exceptional


condition?

Push  to insert a new data in to the stack

Pop  to delete the data from the stack

Exceptional condition

Overflow  Stack is full. We can’t push new element

Underflow  Stack is empty. We can’t pop any data from the


stack.

13. List out the application of stack.

a) Convert infix to postfix

b) Balanced parenthesis

c) Towers of Hanoi

d) Evaluation of postfix expression

e) 8 Queen’s problem

14. Consider a stack of characters where STACK is allocated a


max_size of 6. The stack has the following elements

STACK : A,B,C,D,E, __

Describe the stack as following operations take place

a) POP item e ) PUSH S

b) POP item f) PUSH R

c) PUSH L g) POP item


MAAMALLAN INSTITUTE OF TECH
DEPT OF CSE

d) PUSH Z h) POP item (e)


(f) (g) S
E S
(a) (b) (C) (d)
Z Z
D Z
Z
L L L
C L
D L
L C
C C
B C
C C
C C B
B B
A B
B B
B B A
A A
A
A A
A A
15. What is the reverse polish notation & polish notation?

Polish notation  prefix notation, operators come before the


operands.

Reverse polish notation  postfix notation, operators come


after the operands.

16. Convert the following infix expressions in to postfix


expressions.

((A+B)/D) * ((E-F)*G) ((A*C) +B/D^E)*F)

AB+D/EF-G** AC*BDE^/+F*

17. To evaluate the postfix expression for the following


expressions.

632*+

2 X +

3 6

6 6 12 Result is 12

18. Define Queue.


MAAMALLAN INSTITUTE OF TECH
DEPT OF CSE

Queue is a linear data structure. It is based on the First In First


Out (FIFO) concept. Insert & Delete operations performed on
different ends called rear & Front respectively.

19. What are the operations in Queue?

Insert (or) Enqueue, Delete (or) Dequeue, Search

20. Give some applications for Queue.

a) Priority queue

b) Batch processing in an operating system

c) Queuing Theory

d) Computer networks in job scheduling

e) simulation

21. Consider the following queue of characters where QUEUE


is circular array, which is allocated N=6 memory

FRONT =2, REAR = 4, QUEUE : __,X,Y,Z,__ , __

Describe the queue as following operations take place

a) P is added to queue f)E is added to queue

b) 2 letters are deleted g) 2 letters are deleted

c) A,B, are added to queue h) H is added to queue.

d) R is added to queue. I) 3 letters are deleted.

e) 2 letters are deleted

(a) (b) (c) (d)


(g) (h)
A A
A A

P P P P

Z Z Z Z Z

Y Y E

X X R R R

B B B
B
MAAMALLAN INSTITUTE OF TECH
DEPT OF CSE

E E

R R

(i) (j) (k) Q is empty

22. Define DEQUE.

It refers to Double Ended Queue. Insertion & Deletion


operations are performed at both ends.
5 12 34 21

23. Define Circular Queue.

In Circular Queue, the insertion of new element is performed at


rear position. When the rear exceeds the max limit of an array,
it just goes back to the first position. If it is empty, the
element will be inserting into the first position of the array.
Otherwise, it is full.

24. What is mean by Priority Queue?


MAAMALLAN INSTITUTE OF TECH
DEPT OF CSE

It is a Queue, which inserting & deleting an element can


be performed from any position based on some priority.

(or)

It is a Queue, which is most higher priority element will be


executed first.

25. Compare Stack & Queue.

S.N STACK QUEUE


O

1 Linear Data Structure Linear Data Structure

2 LIFO FIFO

3 Insertion & Deletion is Insertion & Deletion is done at


done at only one end different ends

4 Operations are PUSH & Operations are Insert (or)


POP Enqueue, Delete (or) Dequeue

5 Top is a position where Insertion takes place at rear


insertion & deletion and Deletion takes place at
takes place Front.

You might also like