DS Experiment Questions
DS Experiment Questions
Exp 1
1) What happens if you try to find a substring that is longer than the original string?
2) Can you modify the palindrome function to ignore spaces and case sensitivity?
3) How would you modify the compare function to return the length difference instead of
character differences?
Exp 2
1) Why is it essential to use structures for managing records in a database? Discuss how
structures improve data organization and accessibility.
2) What are the differences between linear search and binary search when searching for records
in a database? Under what conditions is each search algorithm most effective?
3) Compare the advantages and disadvantages of using static arrays versus dynamic
memory allocation with pointers when implementing a database using structures. When
would you prefer one method over the other?
Exp 3
1) What are the key characteristics of a stack data structure? Describe the concepts of "push"
and "pop" operations, and explain how they contribute to the Last In, First Out (LIFO)
principle.
2) Explain the fundamental operations of a queue data structure. What are the differences
between "enqueue" and "dequeue" operations, and how do they support the First In, First
Out (FIFO) principle?
3) What are the limitations of implementing stacks and queues using arrays? Discuss issues
related to fixed size, overflow, and underflow, and how these limitations might affect the
usability of the data structures in real-world applications.
Exp 4
1) What is a singly linked list, and how is it structured? Discuss the benefits of using a singly
linked list compared to an array for dynamic data storage.
2) What are the common operations performed on a singly linked list? Briefly explain the
processes of insertion, deletion, and traversal, highlighting their time complexities.
3) How does memory management in a singly linked list differ from that in an array? Discuss
the implications of dynamic memory allocation for insertion and deletion operations in
terms of efficiency and fragmentation.
Exp 5
1) What is a binary search tree (BST)? Describe its key properties and how they
differentiate it from other tree data structures.
2) Explain the processes of inserting and deleting nodes in a binary search tree. What
are the key considerations to keep in mind during these operations to maintain the
BST properties?
3) What are the different traversal methods for a binary search tree (e.g., in-order,
pre-order, post-order)? How do these traversal methods affect the order in which
the nodes are visited, and what are their typical use cases?
Exp 6
1) What is an adjacency matrix, and how is it used to represent a graph? Discuss its
advantages and disadvantages compared to other graph representation methods,
such as adjacency lists.
2) Describe the Breadth-First Search (BFS) algorithm. How does it traverse a graph
using an adjacency matrix, and what are its key applications in computer science?
3) Explain the Depth-First Search (DFS) algorithm. How does it differ from BFS in
terms of traversal strategy and memory usage, and what are some common use
cases for DFS?
Exp 7
1) How can polynomials be represented using linked lists? Describe the structure
of a linked list node for a polynomial term and the significance of storing both
coefficient and exponent.
2) What is the algorithm for adding two polynomials represented as linked lists?
Outline the steps involved in traversing the linked lists and combining like
terms.
3) What is the time complexity of adding two polynomials using linked lists?
Discuss how the efficiency of this approach compares to other methods, such
as using arrays or nested loops.
Exp 8
1) What is postfix notation, and how does it differ from infix notation?
Explain the advantages of using postfix notation in expression
evaluation.
2) Describe the algorithm for evaluating a postfix expression. What
data structure is typically used to facilitate this evaluation, and how
do operators and operands interact during the process?
3) What is the time and space complexity of evaluating a postfix expression
using a stack? Discuss any factors that may influence these complexities
in practical implementations.
Exp 9
1) What is the basic mechanism of the Quicksort algorithm? Explain the role
of the pivot and how the array is partitioned during the sorting process.
2) What is the average and worst-case time complexity of Quicksort? Discuss
the factors that can affect its performance in different scenarios.
3) How does Quicksort achieve in-place sorting, and what are the
implications of this characteristic for memory usage compared to other
sorting algorithms, like Merge Sort?
Exp 10
Instructions:
Write short answer for each questions (You can write as write-up or you can
prepare soft copy of it Both is allowed)
Prepare separate document for each experiment & attach it at the end of
Experiment