0% found this document useful (0 votes)
10 views7 pages

CIT Question Bank 1

The document is a question bank for a centralized internal test on Data Structures and Algorithms for B.E./B.Tech. students at K.L.N. College of Engineering. It includes theoretical questions, practical tasks, and definitions related to data structures such as linked lists, stacks, and queues, as well as complexity analysis. The document aims to assess students' understanding and application of these concepts.

Uploaded by

deviveeranan7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views7 pages

CIT Question Bank 1

The document is a question bank for a centralized internal test on Data Structures and Algorithms for B.E./B.Tech. students at K.L.N. College of Engineering. It includes theoretical questions, practical tasks, and definitions related to data structures such as linked lists, stacks, and queues, as well as complexity analysis. The document aims to assess students' understanding and application of these concepts.

Uploaded by

deviveeranan7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

K.L.N. COLLEGE OF ENGINEERING (AUTONOMOUS), POTTAPALAYAM – 630 612.

B.E. / B.Tech. DEGREE PROGRAMME

CENTRALIZED INTERNAL TEST – I


20CS302 – DATA STRUCTURES AND ALGORITHMS

Question Bank
1. Define space and time complexity.

2. What is the Asymptotic notation and its types?

3. Recall the advantages of linked list over arrays.

4. Define Abstract Data type. State the advantage of ADT

5. Compare and contrast singly linked lists and doubly linked list.

6. What are the applications of the stack?

7. What are the various operations performed on the Stack?

8. State the rules to be followed during infix to postfix conversion.

9. Distinguish between stack and queue.

10. What is a linked list ?

11. State the advantages of circular lists over doubly linked list.

12. What is circular linked list ?

13. What is queue?

14. What are the applications of queue?

15. Convert from infix into postfix expression


(i) (A + B) * (C – D) / E
(ii) (p+q)*(m-n)

15Marks

1.Derive an ADT to perform insertion and deletion in circular single linked list.

2. Given a list 10,20,30,40 generalize the steps along with the routine and pictorial representation
for doubly linked list

(i)to insert a node 5 at the beginning of the linked list,


(ii)to delete the last node in the list,

(iii)to insert the node with value 15 between 10 and 20 in a list


(iv)to delete the node 20 in the list

3. (i)Write an ADT to implement stack of size N using an array. The elements in the stack are to
be integers. The operations to be supported are PUSH, POP. Take into account the exceptions of
stack overflow and stack Underflow.
(ii) Evaluate the expression A * (B + C) – D for A = 10, B = 20, C = 15, D = 5 using stack.

4. A queue has a size of 4 and has two elements 7,8.Let F be the pointer to Front end and R be
the pointer to Rear end. Then series of operations are performed

i)Add the element 5

ii) Perform deletion

iii)Again add the element 6

iv)Now Display all the elements in the queue

Assess the sequence of steps with necessary diagrams and also explain the routine with the
value of F & R.

5. Derive an ADT to perform insertion and deletion in single linked list.


6. Explain the steps in arithmetic expression evaluation using stacks

7. Derive an ADT to perform enqueue and dequeue in Queue


8. Derive an ADT to perform insertion and deletion in Doubly linked list. 9.Derive an

ADT to perform insertion and deletion in linked list implementation of stack

1)Explain Space and Time Complexity


Time complexity and space complexity are used to analyze the efficiency of
algorithms and for optimizing algorithm performance.
Time complexity is a function that describes how long an algorithm takes to
complete as a function of the input size.
∙ It measures the number of elementary operations performed by an algorithm
and an estimate of the time required for that operation.
∙ Time complexity depends on external factors such as the compiler and the
processor's speed.
Space complexity is a function that describes how much memory (space) an
algorithm requires to complete as a function of the input size.
It measures the number of variables created to store values, including both the
inputs and the outputs.
2)Define Asymptotic Notation and its types

∙ Asymptotic Notations are mathematical tools used to analyze the performance


of algorithms by understanding how their efficiency changes as the input size
grows.
Types

-Refer class notes in notebook

3)Recall the advantages of linked list over arrays.

Linked lists have several advantages over arrays, including:


∙ Dynamic size
Linked lists can grow or shrink based on how many items are added to them,
while arrays have a fixed size.
∙ Efficient insertions and deletions
Linked lists can perform insertions and deletions at any position in constant time,
while arrays may need to shift elements, which can be more time-consuming.
∙ No wasted memory
Linked lists don't store data contiguously in primary memory, instead linking
each piece of data with pointers. This helps with memory management.
∙ Easy implementation
Linked lists can make it easier to implement stacks and queues.
However, linked lists can consume more memory than arrays

4)Define Abstract Data type. State the advantage of ADT

Advantages:
∙ Modularity: ADTs can be combined with other ADTs to form more
complex data structures, which can increase flexibility and modularity in
programming.

∙ Abstraction: ADTs allow users to work with data structures without having to
know the implementation details, which can simplify programming and
reduce errors.
∙ Encapsulation: ADTs provide a way to encapsulate data and operations into a
single unit, making it easier to manage and modify the data structure.
5)Compare and contrast singly linked lists and doubly linked list.
Singly linked lists Doubly linked lists
singly linked lists Contain a pointer Contain pointers to both the next
to the next node in the list, but not and previous nodes in the list.
the previous node

can only be traversed in one doubly linked lists can be traversed


direction, from the head to the tail. in both directions

Singly linked lists require less Doubly linked lists take up more
memory because they only store two space because they store data, the
members: data and the next node. next node, and the previous node.

Singly linked lists make it easy to Doubly linked lists make it easier to
deallocate or allocate memory iterate in both directions, delete
during execution, and insertion and nodes, and perform reverse
deletion don't require shifting all operations.
elements.

Implementation of simple queues Doubly linked lists have a wide


(FIFO structures). range of applications, including text
editors, undo/redo, and browsers.
6)State the rules to be followed during infix to postfix

conversion 7)Algorithm to evaluate postfix expression

8) Distinguish between stack and queue


r Stack Data Structure Queue Data Structure

Basics It is a linear data structure. It is also a linear data structure. The


The objects are removed or objects are removed and inserted from
inserted at the same end. two different ends.
Worki It follows the Last In, First It follows the First In, First Out
ng Out (LIFO) principle. It (FIFO) principle. It means that the
Princip means that the last inserted first added element gets removed
le element gets deleted at first. first from the list.

Pointers It has only one pointer It uses two pointers (in a simple queue)
the top. This pointer indicates for reading and writing data from both
the

the address of the topmost ends- the front and the rear. The rear one
element or the last inserted indicates the address of the last inserted
one of the stack. element, whereas the front pointer
indicates the address of the first inserted
element in a queue.

Operati push and pop as Queue uses enqueue and dequeue as


two of its operations. The two of its operations. The dequeue
pop operation functions to operation deletes the elements from the
remove the element from the queue, and the enqueue operation
list, while the push operation inserts the elements in a queue.
functions to insert the
element in a list.
Structure Insertion and deletion of It uses two ends- front and rear. Insertion
elements take place from uses the rear end, and deletion uses the
one end only. It is called front end.
the top.

9)State the advantages of circular lists over doubly linked list.

Circular linked lists (CLLs) and doubly linked lists (DLLs) have different
advantages:
Circular linked lists - any node can be a starting point, so you can traverse each
node from any point. This is useful for applications that repeatedly go around the
list, like implementing a queue. CLs also don't require a NULL assignment in the
code, and they never point to a NULL pointer unless fully deallocated.
Doubly linked lists -It can iterate in both directions, which is useful for
applications like music playlists, where songs can be changed by moving
backward and forward. DLLs can also shrink dynamically.
10)Some common applications of Queue data structure :
1. Task Scheduling: Queues can be used to schedule tasks based on priority or
the order in which they were received.
2. Resource Allocation: Queues can be used to manage and allocate
resources, such as printers or CPU processing time.
3. Batch Processing: Queues can be used to handle batch processing jobs, such
as data analysis or image rendering.
4. Message Buffering: Queues can be used to buffer messages in
communication systems, such as message queues in messaging systems or
buffers in computer networks.
5. Event Handling: Queues can be used to handle events in event-driven
systems, such as GUI applications or simulation systems.
6. Web servers: Web servers use queues to manage incoming requests from
clients. Requests are added to the queue as they are received, and they are
processed by the server in the order they were received.

You might also like