About 267,000 results
Open links in new tab
  1. c++ - What is the time complexity of std::map - Stack Overflow

    Feb 12, 2014 · Yes, you can associate a complexity with std::map operations because they are written into the specification. In particular, a "sorted array" implementation of std::map is non …

  2. Time complexity analysis of map and unordered map in C++

    Jul 12, 2024 · With C++11, we finally received a hash set and hash map in std::unordered_set and std::unordered_map. This reduced the time complexity to O (1) for operation like insertion, …

  3. Analysis of time and space complexity of C++ STL containers

    Dec 13, 2022 · The map <int, int> M is the implementation of self-balancing Red-Black Trees. The unordered_map<int, int> M is the implementation of Hash Table which makes the complexity …

  4. Blowing up unordered_map, and how to stop getting hacked on it

    The complexity of your program with map<vector,int> is $$$O(n^2)$$$, assuming that $$$a_i \leq n$$$. Using an unordered_map will just remove a log factor, try improving your complexity by …

  5. c++ - multiset, map and hash map complexity - Stack Overflow

    For set, multiset, map, multimap the time complexity for insertion, deletion and retrieving information is O(logn) as they follow the balance binary tree to structure the data. For …

  6. What is the time complexity of retrieving the top K elements

    Apr 14, 2023 · To retrieve the top k elements, we need to perform k iterations of finding the maximum element and erasing it from the map, which takes O(log n) time per iteration. …

  7. map vs unordered_map in C++ - GeeksforGeeks

    Mar 13, 2023 · In C++, unordered_map is an unordered associative container that stores data in the form of unique key-value pairs. But unlike map, unordered map stores its elements using …

  8. unordered_map vs map in C++Complexity Analysis

    Based on practical evidence, the constant factor built into unordered_map is not that big. The problem is not in the constant factor, but in the fact that worst-case time complexity for a …

  9. Time complexity of map functions: erase - C++ Forum - C++

    Dec 9, 2009 · You'd have to prove that your implementation is significantly better so that you can justify the time spent. Then try your implementation with different compilers and see what …

  10. c++ - What is the time complexity for a clear function is std::map ...

    Jun 12, 2012 · O (N) just says that there exists an n and a k such that for N > n the thing being measured (time / CPU ticks) is less than kN. An O (1) process can satisfy this with whatever n …

Refresh