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 D
Rate difficulty Rate difficulty:
Choose a difficulty.
Share this question
Share:
f(n) = 2n g(n) = n! ≅ nn h(n) = nlogn for larger value of n g(n) > f(n) > h(n) so we can conclude that f(n) = O(g(n)) or g(n) = Ω(f(n)) and h(n)= Of(n).
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.
The minimum number of comparison is logn.
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.

Recurrence relation for f1()is
T (n) = 2T (n–1) + 3 T (n–2)
After solving it would be Θ(1.6)n) so the largest
value among the options is Θ(2n).
f2() is simple loop executed n times.
So Θ(n)
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 C
Rate difficulty Rate difficulty:
Choose a difficulty.

Both function preform same operation so result is same 1640 & 1640
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 A
Rate difficulty Rate difficulty:
Choose a difficulty.
Found this useful?
Follow:

If there are n elements, then in worst case, total swaps will be (n-1) in selection sort. So the number of swaps is Θ(n).
Alternately
The selection sort is similar to bubble sort except it does not swap elements with every move. The sorting algorithm first finds the smallest element in the list and then puts it in to place in single swap. So n swap required for n elements.
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 →