Question
1.
2.
3.
4.
Answer (Detailed Solution Below)
Option 1 : Insertion sort / इंसर्शन सॉर्ट
Advertisement
Detailed Solution
सही उत्तर Insertion sort / इंसर्शन सॉर्ट है।
Key Points
Helpful?
Question:
Which of the following sorting algorithms has a best-case time complexity of O(n)? / निम्नलिखित में से किस सॉर्टिंग एल्गोरिदम की सर्वोत्तम-स्थिति समय जटिलता O(n) है?
1.
Insertion sort / इंसर्शन सॉर्ट
2.
Merge sort / मर्ज सॉर्ट
3.
Heap sort / हीप सॉर्ट
4.
Quick sort / क्विक सॉर्ट
Correct Answer: Insertion sort / इंसर्शन सॉर्ट
Insertion sort runs in O(n) on an already-sorted input. Merge sort and heap sort are O(n log n) in all cases, and quick sort's best case is O(n log n) — a common misconception. / पहले से सॉर्ट किए गए इनपुट पर इंसर्शन सॉर्ट O(n) में चलता है। मर्ज सॉर्ट और हीप सॉर्ट सभी स्थितियों में O(n log n) हैं, और क्विक सॉर्ट की सर्वोत्तम स्थिति O(n log n) है — यह एक सामान्य भ्रांति है।
Downloaded from PrepSnap (prepsnap.in)