Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

1. What is Data Structures and Algorithms (DSA)?

 Data Structures and Algorithms (DSA) is a fundamental concept in computer science


that deals with the organization and manipulation of data in an efficient and effective
manner. Data structures are used to store and organize data, while algorithms are used
to perform operations on that data.
2. What is the difference between a stack and a queue?
 A stack is a Last-In-First-Out (LIFO) data structure, where the last element added to the
stack is the first one to be removed. A queue, on the other hand, is a First-In-First-Out
(FIFO) data structure, where the first element added to the queue is the first one to be
removed.
3. What is a linked list?
 A linked list is a linear data structure where each element is a separate object, and each
element (or node) contains a reference to the next node in the sequence.
4. What is a binary tree?
 A binary tree is a hierarchical data structure where each node has at most two child
nodes, arranged in a way that the value of the left child node is less than or equal to the
parent node, and the value of the right child node is greater than or equal to the parent
node.
5. What is a hash table?
 A hash table is a data structure that uses a hash function to map keys to values, allowing
for fast lookup, insertion, and deletion of elements.
6. What is a graph?
 A graph is a non-linear data structure consisting of nodes (also called vertices) and
edges that connect them.
7. What is a depth-first search (DFS)?
 Depth-first search (DFS) is an algorithm for traversing or searching tree or graph data
structures. The algorithm starts at the root node (selecting some arbitrary node as the
root node in the case of a graph) and explores as far as possible along each branch
before backtracking.
8. What is a breadth-first search (BFS)?
 Breadth-first search (BFS) is an algorithm for traversing or searching tree or graph data
structures. It starts at the root node (selecting some arbitrary node as the root node in
the case of a graph), and explores all the neighboring nodes at the present depth prior
to moving on to nodes at the next depth level.
9. What is big O notation?
 Big O notation is a mathematical notation that describes the limiting behavior of a
function when the argument tends towards a particular value or infinity. In computer
science, it is commonly used to describe the performance or complexity of an algorithm.
10. What is the time complexity of binary search?
 The time complexity of binary search is O(log n), where n is the number of elements in
the sorted array.
11. What is the time complexity of insertion sort?
 The time complexity of insertion sort is O(n^2), where n is the number of elements in
the array.
12. What is the time complexity of merge sort?
 The time complexity of merge sort is O(n log n), where n is the number of elements in
the array.
13. What is the time complexity of quick sort?
 The time complexity of quick sort is O(n log n) in the average case, but it can degrade to
O(n^2) in the worst case.
14. What is dynamic programming?
 Dynamic programming is a technique for solving optimization problems by breaking
them down into smaller subproblems and solving each subproblem only once.
15. What is recursion?
 Recursion is a technique for solving problems where a function calls itself to solve
smaller instances of the same problem.
16. What is tail recursion?
 Tail recursion is a form of recursion where the recursive call is the last operation in the
function, allowing the compiler to optimize the recursion into a loop.
17. What is a greedy algorithm?
 A greedy algorithm is a simple algorithmic paradigm that follows the problem-solving
heuristic of making the locally optimal choice at each stage with the hope of finding a
global optimum.
18. What is a divide-and-conquer algorithm?
 A divide-and-conquer algorithm is a recursive algorithmic paradigm that solves a
problem by breaking it down into two or more subproblems of the same or related
type, until these become simple enough to be solved directly.
19. What is a brute force algorithm?
 A brute force algorithm is an algorithmic paradigm that tries all possible solutions until
a satisfactory solution is found.
20. What is a backtracking algorithm?
 A backtracking algorithm is a recursive algorithmic paradigm that tries all possible
solutions until a satisfactory solution is found, but it also has the ability to revert back to
the previous state if a solution is not found.
21. What is a recursive tree?
 A recursive tree is a tree data structure that is built recursively by adding child nodes to
a root node.
22. What is a binary heap?
 A binary heap is a complete binary tree that satisfies the heap property, which states
that the key of each node is greater than or equal to (max heap) or less than or equal to
(min heap) the keys of its children.
23. What is a trie?
 A trie, also called a prefix tree, is a tree data structure that is used to store a dynamic set
or associative array where the keys are strings.
24. What is a self-balancing binary search tree?
 A self-balancing binary search tree is a binary search tree that maintains its balance
automatically, ensuring that the height of the tree is logarithmic in the number of
nodes.
25. What is a red-black tree?
 A red-black tree is a self-balancing binary search tree where each node contains an extra
bit for denoting the color of the node, either red or black.
26. What is an AVL tree?
 An AVL tree is a self-balancing binary search tree where the height difference between
any two child subtrees of any node is at most one.
27. What is a splay tree?
 A splay tree is a self-adjusting binary search tree that performs a rotational operation,
called splaying, to move the recently accessed node to the root of the tree.
28. What is a B-tree?
 A B-tree is a self-balancing tree data structure that maintains sorted data and allows for
efficient search, insert, and delete operations.
29. What is a B+ tree?
 A B+ tree is a variation of the B-tree data structure where all the data is stored in the
leaf nodes, and the non-leaf nodes only store keys.
30. What is a hash function?
 A hash function is a mathematical function that maps data of arbitrary size to a fixed
size, which is used to index data in a hash table.
31. What is a collision?
 A collision is a situation that occurs when two different inputs to a hash function
produce the same hash value.
32. What is chaining?
 Chaining is a collision resolution technique used in hash tables where each hash value is
associated with a linked list of entries that have the same hash value.
33. What is open addressing?
 Open addressing is a collision resolution technique used in hash tables where collisions
are resolved by probing, or searching, for alternate locations in the array.
34. What is linear probing?
 Linear probing is a probing technique used in open addressing where the search for an
alternate location proceeds linearly through the array.
35. What is quadratic probing?
 Quadratic probing is a probing technique used in open addressing where the search for
an alternate location proceeds by adding an increment that is a quadratic function of
the number of probes.
36. What is double hashing?
 Double hashing is a probing technique used in open addressing where a second hash
function is used to compute the increment added to the probe sequence.
37. What is a topological sort?
 A topological sort is a linear ordering of the vertices in a directed acyclic graph (DAG)
such that for every directed edge (u, v), vertex u comes before vertex v in the ordering.
38. What is a strongly connected component?
 A strongly connected component is a maximal subset of vertices in a directed graph
such that there is a path between every pair of vertices in the subset.
39. What is a minimum spanning tree?
 A minimum spanning tree is a subset of the edges of a connected, weighted graph that
connects all the vertices with the minimum possible total edge weight.
40. What is Dijkstra's algorithm?
 Dijkstra's algorithm is a greedy algorithm for finding the shortest path between two
vertices in a weighted, directed graph.
41. What is Bellman-Ford's algorithm?
 Bellman-Ford's algorithm is an algorithm for finding the shortest path from a single
source vertex to all other vertices in a weighted, directed graph.
42. What is Floyd-Warshall's algorithm?
 Floyd-Warshall's algorithm is an algorithm for finding the shortest path between all
pairs of vertices in a weighted, directed graph.
43. What is Prim's algorithm?
 Prim's algorithm is a greedy algorithm for finding a minimum spanning tree in a
weighted, undirected graph.
44. What is Kruskal's algorithm?
 Kruskal's algorithm is a greedy algorithm for finding a minimum spanning tree in a
weighted, undirected graph.
45. What is a planar graph?
 A planar graph is a graph that can be drawn in the plane without any edges crossing.
46. What is a connected graph?
 A connected graph is a graph where there is a path between every pair of vertices.
47. What is a complete graph?
 A complete graph is a graph where every pair of vertices is connected by an edge.
48. What is a cycle?
 A cycle is a path in a graph that starts and ends at the same vertex.
49. What is a directed acyclic graph (DAG)?
 A directed acyclic graph (DAG) is a directed graph that has no cycles.
50. What is a simple graph?
 A simple graph is a graph that has no loops (edges that connect a vertex to itself) or
multiple edges between any two vertices.

You might also like