0% found this document useful (0 votes)
24 views2 pages

Key Data Structures Q&A Guide

Uploaded by

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

Key Data Structures Q&A Guide

Uploaded by

udyadav430
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Data Structures Important Questions

DATA STRUCTURE
> What is abstract data type? explain with the help of example.
> Differentiate array and linked list.
> What is the application of linked list and also write the algorithm how to add
two polynomials using LinkedIn list.
> Write a program in c to insert a node at any specified position in doubly linked
list.
> What is the difference between data and information?give one example.
> How to represent 2-D array in memory? Explain with the help of example.
> Write an algorithm to convert infix expression into postfix from using
[Link] evaluate the given postfix from using stack.
239*+23^-62/+
> Write a program in C to implementation of queue .
> What are the difference between
1. Height and depth
2. Order and degree
> Show that the maximum number of nodes in a binary tree of height h is
2^h+1--1.
> Construct the steps to configure a B-tree of order 5 for the following data:
78,21,11,97,85,74,63,45,42,57,20,16,19,32,30,31.
> Explain Dijkstra Algorithm with the help of example.
> Write a heap sort algorithm. Use heap sort algorithm to sort the following
element
DATA STRUCTURES.
> Differentiate internal sorting and external [Link] enlists the name of two
sorting techniques of each.
> Binary search is more efficient than linear search . Justify your answer.
> Write a short note on hashing and indexing.
> Describe Asymptotic notation in detail.
> What is recursion ? Explain in detail with example.
> Write short notes:-
1. Garbage collection
2. Backtracking
> Give the solution for the following recurrence
T(n)=2T[n/2]+ n login
> What do you understand about graph ? How the graph represented in memory
> Write the algorithm of insertion sort and find its time complexity.

Common questions

Powered by AI

Binary search is preferred over linear search for sorted arrays due to its efficiency. It reduces the search space by half with each comparison, resulting in a time complexity of O(log n), compared to linear search's O(n). This makes binary search significantly faster for large datasets .

Dijkstra's Algorithm finds the shortest path from a starting node to all other nodes in a weighted graph. It maintains a set of nodes whose shortest distance is known and iteratively selects the node with the smallest tentative distance, updating paths as more optimal paths are found. For example, starting from a node, paths are relaxed by checking adjacent nodes and updating distances accordingly .

Arrays are stored in contiguous memory locations, which allows for efficient indexing but requires a predetermined size. In contrast, a linked list consists of nodes, each containing data and a pointer to the next node, enabling dynamic memory allocation. Linked lists allow for easy modification of size without the need for reallocation but require sequential access to elements due to non-contiguous storage .

In tree structures, 'height' refers to the longest path from a node to a leaf, while 'depth' is the distance from the root to the node. The height of a tree is determined by its root node, whereas the depth is intrinsic to each node's position relative to the root .

To configure a B-tree of order 5, insert elements one by one, splitting nodes as necessary when they exceed the maximum of 4 keys. For the data set 78, 21, 11, etc., perform insertions maintaining sorted order within nodes and split nodes evenly, promoting median elements. The final B-tree structure should balance as keys are inserted without exceeding node constraints .

Recursion is a programming technique where a function calls itself to solve smaller instances of the same problem. One practical use is calculating factorials, where the factorial of n (n!) involves recursive calls to calculate (n-1)!. A recursive function terminates on reaching a base case like n=1 .

Asymptotic notations describe the performance of an algorithm as the input size goes to infinity. They are crucial in assessing the efficiency of algorithms beyond empirical testing. Examples include Big O (O(n)), Theta (Θ(n)), and Omega (Ω(n)), which classify algorithms based on upper, tight, and lower bounds of performance .

To convert an infix expression to postfix using a stack, operators are pushed onto a stack while operands are added directly to the postfix expression. Operators are popped from the stack and added to the postfix expression when a lower precedence operator appears. Evaluating the postfix expression '2 3 9 * + 2 3 ^ - 6 2 / +' results in 28.5 after performing the operations according to postfix order .

A 2-D array is stored in memory either in row-major or column-major order. In row-major order, the elements of each row are stored in consecutive memory locations, e.g., for a 2x2 array 'A', elements A[0][0], A[0][1] are stored first followed by A[1][0], A[1][1]. Similarly, column-major order stores elements column by column .

An abstract data type (ADT) encapsulates data and operations into a single logical unit without specifying the implementation details. This allows programmers to focus on high-level design rather than underlying mechanics. For example, a stack can be implemented as an ADT; it defines operations like push and pop without detailing whether the stack is implemented using arrays or linked lists .

You might also like