title: Brodal queue
text: # Brodal queue
  
  In computer science, the Brodal queue is a heap/priority queue structure with very low worst case time bounds: $O(1)$ for insertion, find-minimum, meld (merge two queues) and decrease-key and $O(\mathrm {log} (n))$ for delete-minimum and general deletion. They are the first heap variant to achieve these bounds without resorting to amortization of operational costs. Brodal queues are named after their inventor Gerth Stølting Brodal.
  
  While having better asymptotic bounds than other priority queue structures, they are, in the words of Brodal himself, "quite complicated" and "[not] applicable in practice." Brodal and Okasaki describe a persistent (purely functional) version of Brodal queues.
  
  ## Summary of running times
  
  Here are time complexities of various heap data structures. Function names assume a min-heap. For the meaning of "O(f)" and "Θ(f)" see Big O notation.
  
  | Operation | find-min | delete-min | insert | decrease-key | meld |
  | - | - | - | - | - | - |
  | Binary | Θ(1) | Θ(log n) | O(log n) | O(log n) | Θ(n) |
  | Leftist | Θ(1) | Θ(log n) | Θ(log n) | O(log n) | Θ(log n) |
  | Binomial | Θ(1) | Θ(log n) | Θ(1) | Θ(log n) | O(log n) |
  | Skew binomial | Θ(1) | Θ(log n) | Θ(1) | Θ(log n) | O(log n) |
  | Pairing | Θ(1) | O(log n) | Θ(1) | o(log n) | Θ(1) |
  | Rank-pairing | Θ(1) | O(log n) | Θ(1) | Θ(1) | Θ(1) |
  | Fibonacci | Θ(1) | O(log n) | Θ(1) | Θ(1) | Θ(1) |
  | Strict Fibonacci | Θ(1) | O(log n) | Θ(1) | Θ(1) | Θ(1) |
  | Brodal | Θ(1) | O(log n) | Θ(1) | Θ(1) | Θ(1) |
  | 2–3 heap | O(log n) | O(log n) | O(log n) | Θ(1) | ? |
  
  * 1 2 3 4 5 6 7 8 9 Amortized time.
  * ↑ Brodal and Okasaki describe a technique to reduce the worst-case complexity of meld to Θ(1); this technique applies to any heap datastructure that has insert in Θ(1) and find-min, delete-min, meld in O(log n).
  * ↑ Lower bound of $\Omega (\log \log n),$ upper bound of $O(2^{2{\sqrt {\log \log n}}}).$
  * ↑ Brodal and Okasaki later describe a persistent variant with the same bounds except for decrease-key, which is not supported. Heaps with n elements can be constructed bottom-up in O(n).
  