Question 1228 – Nielit STA [02-12-2018]
November 5, 2023Database-Management-System
November 5, 2023Question 1229 – Nielit STA [02-12-2018]
Given an random unsorted array ‘A’ in which every element is at most ‘d’ distance from is position in sorted array where d<Size(A). If we applied the insertion sort over this array, then the time complexity of algorithm is:
Correct Answer: D
Question 9 Explanation:
→ Using insertion sort worst case time complexity is O(n2).
→ They are asking to find the atmost distance from every element. So, it will take O(n2*d) from every node.
Note: Using heap sort , time complexity will be O(nlogd) and most effective than insertion sort.
→ They are asking to find the atmost distance from every element. So, it will take O(n2*d) from every node.
Note: Using heap sort , time complexity will be O(nlogd) and most effective than insertion sort.
O(nlogd)
O(n2 logd)
O(nd)
O(n2d)
Subscribe
Login
0 Comments