Avatto > UGC NET COMPUTER SCIENCE > PRACTICE QUESTIONS > Data Structures and Algorithms > Performance Analysis of Algorithms and Recurrences

Data Structures and Algorithms MCQ - Performance Analysis of Algorithms and Recurrences

Correct AnswerOption A
Rate difficulty Rate difficulty:
Choose a difficulty.

20, 24, 30, 35, 50
Step 1 : We take

Comparisons = (20 + 24 – 1) Max = 43
Step 2 :

Total comparison = 43 + (65 – 44) = 64
Step 3 :

Total comparison = 64 + 19 = 83
Step 4 :

Total comparison = 93 + 65 = 158
= 158 + 93 + 64 + 43 = 358
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *

Correct AnswerOption D
Rate difficulty Rate difficulty:
Choose a difficulty.
Found this useful?
Follow:

Selection sort = O (n2)
Insertion sort = O (n2) or (O(n) in best case)
Binary Search = O (logn)
Merge Sort = O (n logn)
None of the options is true
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *

Correct AnswerOption D
Rate difficulty Rate difficulty:
Choose a difficulty.

When we have ‘n’ numbers stored in an array, we have to swap all positive number with negative number so in worst case positive numbers will be n/2,
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *

Correct AnswerOption D
Rate difficulty Rate difficulty:
Choose a difficulty.

T(n) = T(n–1)+n ⇒ O(n2)
T(n) = T(n/2) + n ⇒ O(n)
T(n) = T(n/2) + n logn ⇒ O(n logn)
T(n) = T(n–1) + logn ⇒ O(log2n)
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *

Correct AnswerOption B
Rate difficulty Rate difficulty:
Choose a difficulty.

There are n(n-1)/2 pairs. So average inversions are
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *

Why Practice with Avatto?
High Quality MCQsExam-focused questions with accurate answers
Detailed ExplanationsStep-by-step explanations to enhance learning
Latest Exam PatternBased on updated syllabus and pattern
Performance AnalyticsTrack performance and improve weak areas
100% Free PracticePractice unlimited questions for free
Boost Your PreparationAttempt mock tests, previous year papers and topic-wise quizzes.Explore All Tests →