Viva Qs
Viva Qs
Used in data processing, sorting, searching, machine learning, optimization, cryptography, and more.
6. What is Flowchart?
Oval: Start/End.
Rectangle: Process.
Diamond: Decision.
Parallelogram: Input/Output.
Analyzing an algorithm involves evaluating its efficiency in terms of time and space complexity.
Sorting arranges elements in a specific order (ascending/descending). Techniques include Bubble Sort,
Selection Sort, Merge Sort, Quick Sort, and Insertion Sort.
Searching finds a specific element in a dataset, e.g., Linear Search and Binary Search.
Time Complexity: Measures the time required by an algorithm as a function of input size.
Big-O (O)
Big-Omega (Ω)
Big-Theta (Θ)
Constant (O(1))
Linear (O(n))
Quadratic (O(n²))
Exponential (O(2ⁿ))
A straightforward method to solve problems by trying all possibilities. Example: Linear Search.
A sorting algorithm that repeatedly selects the smallest element and places it in its correct position.
A search technique that checks each element in a list sequentially until the target is found.
A method to find a pattern in a text by checking every possible position in the text.
A problem to find the shortest route to visit all cities and return to the starting point.
A path in a graph that visits every vertex exactly once and returns to the starting vertex.
DFS is a graph traversal algorithm that explores as far as possible along each branch before backtracking.
BFS is a graph traversal algorithm that explores all neighbors of a vertex before moving to the next level.
It solves problems by reducing the size of the input, solving the smaller problem, and then extending the
solution.
A sorting algorithm that builds the final sorted array one item at a time by inserting elements into their
correct position.
An ordering of vertices in a directed acyclic graph (DAG) where each vertex comes before all vertices it
points to.
A technique that divides a problem into smaller subproblems, solves them recursively, and combines
their solutions.
A divide-and-conquer sorting algorithm that divides the array, sorts subarrays, and merges them.
A divide-and-conquer sorting algorithm that partitions the array and sorts the partitions recursively.
A search algorithm that divides the sorted dataset in half repeatedly to find a target value.
A method that makes the best local choice at each step. Example: Huffman coding.
Used in Dijkstra’s algorithm, Kruskal’s algorithm, Prim’s algorithm, and Huffman encoding.
A greedy algorithm to find the minimum spanning tree by starting from a vertex and adding the smallest
edge.
A subgraph that connects all vertices of a graph with minimal edges and no cycles.
A greedy algorithm to find the minimum spanning tree by sorting edges by weight and adding them if
they don’t form a cycle.
An algorithm to find the shortest path from a source vertex to all other vertices in a graph.
The shortest path from one source vertex to all other vertices in a graph.
A tree structure used for decision-making, where each node represents a decision point.
Problems as hard as any NP problem but may not be in NP. Example: TSP optimization.
56) What is NP-Complete Problem?
Problems in NP that are as hard as any other NP problem and have a polynomial-time solution if one NP
problem does.
Precision errors.
Stability of solutions.