What will be the time complexity of the code to find a minimum element from an array of size n and uses square root decomposition(exclude pre processing time)?
What will be the time complexity of the code to find a minimum element from an array of size n and uses square root decomposition(exclude pre processing time)? Correct Answer O(√n)
For finding the minimum element in a given array of size n using square root decomposition we first divide the array into √n chunks and calculate the result for them individually. So for a given query, the result of middle blocks has to be calculated along with the extreme elements. This takes O(√n) time in the worst case.
মোঃ আরিফুল ইসলাম
Feb 20, 2025