0 votes 0 votes Given an sorted array in descending order, what will be the time complexity to delete the minimum element from this array? DS algorithms time-complexity array data-structures + – iarnav asked Jun 12, 2018 • edited Jun 15, 2022 by Arjun iarnav 873 views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
3 votes 3 votes Constant time. Because you directly know that the minimum element in an array sorted in decreasing order has to be the last element in the array. Lakshay Kakkar answered Jun 12, 2018 Lakshay Kakkar comment Share Follow See all 3 Comments See all 3 3 Comments reply iarnav commented Jun 12, 2018 reply Follow Share @Lakshay Kakkar Therefore it's O(1)? we can directly go to last element/index in O(1) and delete it in O(1) time. So, it's O(1) * O(1) = O(1) is that what you mean? 0 votes 0 votes Lakshay Kakkar commented Jun 12, 2018 i edited by Lakshay Kakkar Jun 12, 2018 reply Follow Share See you don't need to do anything. Simply decrease the size of the sorted array by 1. Done. 1 votes 1 votes srestha commented Jun 12, 2018 reply Follow Share yes, that will be reason. O(1) will be ans 1 votes 1 votes Please log in or register to add a comment.