Top 10 Questions on Sorting Algorithms and Divide and Conquer Approach Top 10 Questions on Sorting Algorithms and Divide and Conquer Approach Understanding basic sorting algorithms and the divide and conquer approach is crucial for every computer science student. Below are the most frequently asked questions with answers from Module 1: Introduction to Algorithms . 1. What is Selection Sort and how does it work? Selection Sort is a comparison-based algorithm that divides the array into a sorted and unsorted part. It repeatedly selects the minimum element from the unsorted section and moves it to the beginning. Time Complexity: O(n²) Stable: No In-place: Yes 2. What are the steps involved in Insertion Sort? Insertion Sort builds the sorted array one element at a time by inserting each new element into its correct position among the previously sorted elements. Best Case: O(n) Worst Case: O(n²) Stable: Ye...
1. What is an Operating System? An Operating System (OS) is system software that acts as a bridge between users and computer hardware. It manages hardware resources and provides services to application software. An OS handles tasks like memory management, process scheduling, and device control. It ensures that programs and users can run smoothly without interfering with each other. Examples include Windows, Linux, macOS, and Android. The OS also provides a user interface, either graphical (GUI) or command-line (CLI). Without an OS, a computer would be unusable. It organizes files, maintains security, and manages system performance. In short, the OS is the heart of any computing device. 2. What are the main functions of an Operating System? The primary functions of an Operating System are process management, memory management, file system management, and device management. It ensures efficient execution of processes by scheduling CPU time. Memory management keeps track of ea...
Algorithm Viva Questions and Answers Algorithm Viva Questions and Detailed Answers 2. Divide and Conquer Approach Q1. What is the Divide and Conquer strategy? It is an algorithmic paradigm that breaks a problem into subproblems, solves them recursively, and then combines their results. Examples include Merge Sort, Quick Sort, and Binary Search. Q2. Explain Finding Minimum and Maximum using Divide and Conquer. The array is split into halves. Recursively, min and max of each half are found, and finally the overall min and max are determined using a comparison of results from the halves. Q3. Describe Merge Sort. Merge Sort divides the list into halves, recursively sorts them, and merges the sorted halves. It has a time complexity of O(n log n) and is stable but not in-place. Q4. Explain Quick Sort. Quick Sort selects a pivot, partitions the array such that elements lesser are on the left and greater on the right, then recursively sort...
Comments
Post a Comment