0% found this document useful (0 votes)
4 views

Assignment 1 DAA

assignment

Uploaded by

xefel44664
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Assignment 1 DAA

assignment

Uploaded by

xefel44664
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

VISION INSTITUTE OF TECHNOLOGY,

B.Tech CSE All 5th Sem


SUBJECT: DAA ASSIGNMENT-1

Question1 : Define time complexity and space complexity and explain why both are
critical in the analysis of algorithms. Provide examples of algorithms with varying time
complexities (e.g., O(1),O(log⁡n),O(n),O(n2),O(2n)O(1), O(\log n), O(n), O(n^2),
O(2^n)O(1),O(logn),O(n),O(n2),O(2n)) and discuss scenarios where each would be
preferred.

Question2 : Explain Big-O notation and how it is used to represent the growth rate of
functions. Compare O(n)O(n)O(n) and O(log⁡n)O(\log n)O(logn) and discuss why one
might be more efficient than the other in certain contexts.

Question 3 : Describe the Big-O, Big-Theta (Θ\ThetaΘ), and Big-Omega


(Ω\OmegaΩ) notations. Provide examples of each and discuss how they represent
different aspects of an algorithm's performance.

Question:4 Discuss the different methods for evaluating the performance of an


algorithm, including benchmarking and asymptotic analysis. Explain scenarios where
one approach might be favored over the other.

Question5: Describe the Shell Sort algorithm, including its incremental approach to
sorting. Explain how different increment sequences impact its time complexity and
efficiency.

Question 6: Explain the Quick Sort algorithm and discuss the impact of pivot selection
on its efficiency. Suggest methods for choosing an optimal pivot and discuss how this
affects the algorithm's time complexity.

Question 7: Explain the Merge Sort algorithm using the divide-and-conquer strategy.
Analyze its time complexity and discuss its efficiency compared to other sorting
methods, particularly with large datasets.

Question 8: Describe the Heap Sort algorithm and the role of the heap data structure
in this sorting process. Explain how the max-heap or min-heap structure helps achieve
the sorted order.

Question 9: Compare the time and space complexities of Shell Sort, Quick Sort,
Merge Sort, and Heap Sort. Discuss scenarios where each algorithm would be the best
choice based on data size and characteristics.

Question 10: Define what it means to sort in linear time. Describe the Counting Sort .

Question 11 Problem: Given a function with the following code snippet, calculate its time
complexity:

python

def sample_function(n):
for i in range(n):
for j in range(i):
print("Iteration")

Explain each step in your calculation and determine the asymptotic complexity in Big-O
notation.
Question 12 Problem: Perform a step-by-step analysis of the Merge Sort algorithm on
the following array: [38, 27, 43, 3, 9, 82, 10]. Show each division and merging stepand
determine the total number of comparisons.

Question 13 Problem: Apply the Heap Sort algorithm on the following list of integers:
[12, 11, 13, 5, 6, 7]. Construct the max heap and show each step of the sorting process,
documenting each transformation of the list.

Question 14 Problem: Apply the Quick Sort algorithm on the array [29, 10, 14, 37, 13]
using the first element, the last element, and the median of three as pivot choices. Calculate and
compare the number of comparisons for each pivot choice.

Question15 Problem: Problem: Insert the following sequence of keys into an initially empty B-Tree
of order 3: 15,10,20,25,30,5,7,215, 10, 20, 25, 30, 5, 7, 215,10,20,25,30,5,7,2

You might also like