0% found this document useful (0 votes)
27 views6 pages

Viva Qs

An algorithm is a step-by-step procedure to solve problems, characterized by finiteness, definiteness, input, output, and effectiveness. Algorithms are widely used in various fields such as data processing, sorting, searching, and machine learning, with advantages like improved problem-solving and disadvantages like time consumption. Key concepts include pseudo code, flowcharts, time and space complexity, sorting and searching techniques, and various algorithmic strategies like divide and conquer and greedy algorithms.

Uploaded by

Kavya
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)
27 views6 pages

Viva Qs

An algorithm is a step-by-step procedure to solve problems, characterized by finiteness, definiteness, input, output, and effectiveness. Algorithms are widely used in various fields such as data processing, sorting, searching, and machine learning, with advantages like improved problem-solving and disadvantages like time consumption. Key concepts include pseudo code, flowcharts, time and space complexity, sorting and searching techniques, and various algorithmic strategies like divide and conquer and greedy algorithms.

Uploaded by

Kavya
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
You are on page 1/ 6

1. What is an Algorithm?

An algorithm is a step-by-step procedure or set of rules to solve a specific problem or perform a


computation.

2. What are the characteristics of an Algorithm?

 Finiteness: Must terminate after a finite number of steps.

 Definiteness: Clear and unambiguous steps.

 Input: Accepts input values.

 Output: Produces at least one output.

 Effectiveness: Simple and feasible steps.

3. What are the Advantages and Disadvantages of an Algorithm?

Advantages: Improves problem-solving, ensures accuracy, and is reusable.


Disadvantages: Can be time-consuming to develop and may require significant computational resources.

4. Where Algorithms are used?

Used in data processing, sorting, searching, machine learning, optimization, cryptography, and more.

5. What is Pseudo code?

Pseudo code is a high-level, human-readable description of an algorithm, using structured language.

6. What is Flowchart?

A flowchart is a visual representation of a process or algorithm using symbols to denote steps.

7. Name the Symbols used to draw the Flowchart.

 Oval: Start/End.

 Rectangle: Process.

 Diamond: Decision.

 Arrow: Flow of control.

 Parallelogram: Input/Output.

8. What is analyzing an Algorithm?

Analyzing an algorithm involves evaluating its efficiency in terms of time and space complexity.

9. What are the factors to analyze an Algorithm?

 Time Complexity: Execution time.

 Space Complexity: Memory usage.


10. What is sorting? Name the sorting techniques.

Sorting arranges elements in a specific order (ascending/descending). Techniques include Bubble Sort,
Selection Sort, Merge Sort, Quick Sort, and Insertion Sort.

11. What is searching?

Searching finds a specific element in a dataset, e.g., Linear Search and Binary Search.

12. What is string processing?

String processing involves manipulating and analyzing sequences of characters.

13. What is Time complexity and Space complexity?

 Time Complexity: Measures the time required by an algorithm as a function of input size.

 Space Complexity: Measures the memory usage of an algorithm.

14. What is the use of Algorithm?

Algorithms provide a systematic approach to solve problems efficiently and effectively.

15. What are Best, Average and Worst case efficiencies?

 Best Case: Minimum effort required.

 Average Case: Expected effort for typical inputs.

 Worst Case: Maximum effort required.

16. What is Asymptotic Notations?

Asymptotic notations describe the efficiency of an algorithm as input size grows.

17. Name the Asymptotic notation.

 Big-O (O)

 Big-Omega (Ω)

 Big-Theta (Θ)

18. What are the basic asymptotic efficiency classes?

 Constant (O(1))

 Logarithmic (O(log n))

 Linear (O(n))

 Quadratic (O(n²))

 Exponential (O(2ⁿ))

19. What is recursion function?


A recursive function calls itself to solve smaller subproblems.

20. What is Brute Force technique? Give example.

A straightforward method to solve problems by trying all possibilities. Example: Linear Search.

21. What is Selection Sort?

A sorting algorithm that repeatedly selects the smallest element and places it in its correct position.

22. What is Sequential search?

A search technique that checks each element in a list sequentially until the target is found.

23. What is Brute Force string matching?

A method to find a pattern in a text by checking every possible position in the text.

24. What is the Travelling Salesman Problem (TSP)?

A problem to find the shortest route to visit all cities and return to the starting point.

25. What is Hamiltonian Circuit?

A path in a graph that visits every vertex exactly once and returns to the starting vertex.

26. What are the Advantages and Disadvantages of Exhaustive Search?

Advantages: Guarantees optimal solution.


Disadvantages: Computationally expensive and impractical for large inputs.

27. What is Knapsack problem?

A problem of maximizing value by selecting items within a weight limit.

28. What is Depth First Search (DFS)?

DFS is a graph traversal algorithm that explores as far as possible along each branch before backtracking.

29) What is Breadth First Search?

BFS is a graph traversal algorithm that explores all neighbors of a vertex before moving to the next level.

30) What is Decrease and Conquer?

It solves problems by reducing the size of the input, solving the smaller problem, and then extending the
solution.

31) What is Insertion Sort?

A sorting algorithm that builds the final sorted array one item at a time by inserting elements into their
correct position.

32) What are the characteristics of Insertion Sort?

 Simple and easy to implement.


 Works well for small datasets.

 Adaptive: Performs well on partially sorted arrays.

33) What is Topological Sorting?

An ordering of vertices in a directed acyclic graph (DAG) where each vertex comes before all vertices it
points to.

34) What is DAG?

A Directed Acyclic Graph is a graph with directed edges and no cycles.

35) What is In-Degree and Out-Degree?

 In-Degree: Number of edges directed into a vertex.

 Out-Degree: Number of edges directed out of a vertex.

36) What is Feasible and Optimal Solution?

 Feasible Solution: Meets all constraints of a problem.

 Optimal Solution: Best among all feasible solutions.

37) What are Directed, Undirected and Weighted Graphs?

 Directed Graph: Edges have direction.

 Undirected Graph: Edges have no direction.

 Weighted Graph: Edges have weights/costs.

38) What is Adjacency Matrix?

A 2D matrix representation of a graph where 1 represents an edge and 0 represents no edge.

39) What is Divide and Conquer?

A technique that divides a problem into smaller subproblems, solves them recursively, and combines
their solutions.

40) What is Merge Sort?

A divide-and-conquer sorting algorithm that divides the array, sorts subarrays, and merges them.

41) What is Quick Sort?

A divide-and-conquer sorting algorithm that partitions the array and sorts the partitions recursively.

42) What is Binary Search?

A search algorithm that divides the sorted dataset in half repeatedly to find a target value.

43) What are Tree Traversals? Name the Tree Traversals.


Tree traversal is visiting all nodes of a tree systematically. Types: Pre-order, In-order, Post-order, and
Level-order.

44) What is Pre-Order, In-Order, and Post-Order Traversals?

 Pre-Order: Visit root, left, right.

 In-Order: Visit left, root, right.

 Post-Order: Visit left, right, root.

45) What is Greedy Technique? Give Example.

A method that makes the best local choice at each step. Example: Huffman coding.

46) What are the applications of Greedy Algorithm?

Used in Dijkstra’s algorithm, Kruskal’s algorithm, Prim’s algorithm, and Huffman encoding.

47) What is Prim’s Algorithm?

A greedy algorithm to find the minimum spanning tree by starting from a vertex and adding the smallest
edge.

48) What is Spanning Tree?

A subgraph that connects all vertices of a graph with minimal edges and no cycles.

49) What is Kruskal’s Algorithm?

A greedy algorithm to find the minimum spanning tree by sorting edges by weight and adding them if
they don’t form a cycle.

50) What is Dijkstra’s Algorithm?

An algorithm to find the shortest path from a source vertex to all other vertices in a graph.

51) What is Single Source Shortest Path?

The shortest path from one source vertex to all other vertices in a graph.

52) What is a Decision Tree?

A tree structure used for decision-making, where each node represents a decision point.

53) What is P Problem? Give Example.

Problems solvable in polynomial time. Example: Sorting (O(n log n)).

54) What is NP Problem? Give Example.

Problems verifiable in polynomial time. Example: Hamiltonian cycle.

55) What is NP-Hard Problem? Give Example.

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.

57) What is Lower Bound Argument?

A theoretical minimum limit on the time or space required to solve a problem.

58) What are the challenges of Numerical Algorithm?

 Precision errors.

 Stability of solutions.

 High computational costs for large problems.

You might also like