Skip to main content
deleted 21 characters in body
Source Link
aaazalea
  • 689
  • 5
  • 19

In the C++ STL, priority_queue (heap) can be used with any underlying container, such as a deque (doubly linked list). How does the implementation stay O(log n) if deques don't swap an item in index a with index b in constant time?

In the C++ STL, priority_queue (heap) can be used with any underlying container, such as a deque (doubly linked list). How does the implementation stay O(log n) if deques don't swap an item in index a with index b in constant time?

In the C++ STL, priority_queue (heap) can be used with any underlying container, such as a deque. How does the implementation stay O(log n) if deques don't swap an item in index a with index b in constant time?

Tweeted twitter.com/#!/StackProgrammer/status/290851588153688064
Source Link
aaazalea
  • 689
  • 5
  • 19

How does a priority_queue maintain a heap on a deque efficiently?

In the C++ STL, priority_queue (heap) can be used with any underlying container, such as a deque (doubly linked list). How does the implementation stay O(log n) if deques don't swap an item in index a with index b in constant time?