About 50 results
Open links in new tab
  1. How can building a heap be O (n) time complexity? - Stack Overflow

    Mar 18, 2012 · 943 Can someone help explain how can building a heap be O (n) complexity? Inserting an item into a heap is O (log n), and the insert is repeated n/2 times (the remainder …

  2. What's the time complexity of functions in heapq library

    Aug 8, 2016 · Then you need to study the concepts priority queue and heap and perhaps binary tree before answering this question. If the size of the heap named heap is n then the …

  3. Time complexity of the Heap pop operation - Stack Overflow

    Sep 28, 2018 · For a long time, I have been assuming that the time complexity of the pop operation on a Heap is O(1). Is it O(1) or O(log(n)) ?

  4. algorithm - Search an element in a heap - Stack Overflow

    4 In the worst case, the time complexity for finding elements in heap is still O (n). You should use a binary search tree for O (logn) time complexity if you have to find a particular element Heap …

  5. What is the time complexity of heapq.nlargest? - Stack Overflow

    Nov 29, 2020 · For Heapq t largest or t smallest, the time complexity will be O(nlog(t)) Heapq will build the heap for the first t elements, then later on it will iterate over the remaining elements …

  6. Time complexity of memory allocation - Stack Overflow

    Nov 12, 2008 · The time complexity for a heap allocator can be different on different systems, depending on what they might be optimizing for. On desktop systems, the heap allocator …

  7. How to delete in a heap data structure? - Stack Overflow

    Feb 18, 2016 · But to answer your questions: 1) In a standard binary heap, O (log n) is the optimal complexity. 2) Deleting from the middle of the heap will never be more expensive than deleting …

  8. java - build heap time complexity worst case vs upper bound / …

    Jan 13, 2015 · HERE it is said that the worst case time complexity of building a heap is O(nlogn) but upper bound is O(n). How is a upper bound different from worst case time complexity and …

  9. Time complexity of inserting in to a heap - Stack Overflow

    Mar 3, 2015 · I am trying to mostly understand the reasoning behind the Big O and Omega of inserting a new element in a heap. I know I can find answers online but I really like having a …

  10. Understanding Time complexity calculation for Dijkstra Algorithm

    Jun 27, 2016 · As per my understanding, I have calculated time complexity of Dijkstra Algorithm as big-O notation using adjacency list given below. It didn't come out as it was supposed to …