Question 32
Consider the following sorting algorithm which sorts any given unsorted array of numbers in ascending order. What would be its time complexity? (Assume appending and deleting an element from an array does not affect time complexity)
Step 1: Create an empty array.
Step 2: Find the element in the unsorted array with the minimum value.
Step 3: Append this element to the array created in step 1.
Step 4: Delete this element from the unsorted array.
Step 5: Repeat steps 1 to 4 until the unsorted array is empty.
O(logN)
O(N)
O(NlogN)
O(N²)