function SortSmallestToLargest (entries): sorted_entries = {} while entries is not empty: smallest_entry = entries[0] fo
Posted: Mon May 09, 2022 7:00 am
EXPLAIN THE LOGIC BEHIND PROPERLY. NOT JUST THE ANSWER OR
DOWNVOTE !!!!!!!!!!!!
function SortSmallestToLargest (entries): sorted_entries = {} while entries is not empty: smallest_entry = entries[0] foreach entry in entries: if (entry <smallest_entry): smallest_entry = entry sorted_entries.add(smallest_entry) // 0(1) entries.remove(smallest_entry) // 0(1) return sorted_entries Which of the below answers describes the time complexity of the above code most accurately? Pick ONE option O(n) O(n) O(nlogn) O(logn)
DOWNVOTE !!!!!!!!!!!!
function SortSmallestToLargest (entries): sorted_entries = {} while entries is not empty: smallest_entry = entries[0] foreach entry in entries: if (entry <smallest_entry): smallest_entry = entry sorted_entries.add(smallest_entry) // 0(1) entries.remove(smallest_entry) // 0(1) return sorted_entries Which of the below answers describes the time complexity of the above code most accurately? Pick ONE option O(n) O(n) O(nlogn) O(logn)