Layered Heaps Beating Standard and Fibonacci Heaps in Practice

نویسنده

  • Peter Huggins
چکیده

We consider the classic problem of designing heaps. Standard binary heaps run faster in practice than Fibonacci heaps but have worse time guarantees. Here we present a new type of heap that runs faster in practice than both standard binary and Fibonacci heaps, but has asymptotic insert times arbitrarily better than O(logn), namely O((logn)) for arbitrary positive integer m. Our heap is defined recursively and maximum run time speed up occurs when a recursion depth of 1 is used, i.e. a heap of heaps. 1 Layered Heaps We will define M -layered heaps for arbitrary integer M ≥ 1. For M = 1 the M -ary heap is a standard binary heap stored in an array. For M ≥ 2, a kM -ary heap is used, with kM = 2 kM−1∗(M−1)/M . Then by inductive hypothesis, insert operations on the children heaps will be (logn)(M−1/M)∗(1/(M−1)) = (logn) . Furthermore the height of the M ary heap will also be (logn) . So insert operations take O((logn) ) time for any M we want. Pop/delete functions take standard O(logn) time, because we may need to do a children heap operation which takes (logn)(M−1)/M time a total of (logn) times, i.e. the height of the M -ary layered heap. The operations and running times for them are explained in the following pseudocode: INSERT INTO M-ARY HEAP A: Before swapping, start by placing the element at end of array (position n = N). Then do the following: • Set k = 2 (M−1)/M • While n > 0: – If A[n] > A[n/k] then swap their values – Else insert A[n] into children (M − 1)-ary layered heap that contains position n in the array. (Recursive) Then BREAK. 1 ar X iv :1 51 0. 03 36 7v 1 [ cs .D S] 1 2 O ct 2 01 5

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Pairing Heaps are Sub - optimalbyMichael

Pairing heaps were introduced as a self-adjusting alternative to Fibonacci heaps. They provably enjoy log n amortized costs for the standard heap operations. Although it has not been veri ed that pairing heaps perform the decrease key operation in constant amortized time, this has been conjectured and extensive experimental evidence supports this conjecture. Moreover, pairing heaps have been ob...

متن کامل

Resolving a Question about Randomized Fibonacci Heaps in the Negative

In this project, we study a randomized variant of Fibonacci heaps where instead of using mark bits, one flips coins in order to determine whether to cascade bringing nodes into the root list. Although it seems intuitive that such heaps should have the same expected performance as standard Fibonacci heaps—and Karger has conjectured as such—the only previous work was an O(log s) upper bound using...

متن کامل

Improved Upper Bounds for Pairing Heaps

Pairing heaps are shown to have constant amortized time Insert and Meld, thus showing that pairing heaps have the same amortized runtimes as Fibonacci heaps for all operations but Decrease-Key.

متن کامل

Rank-Pairing Heaps

We introduce the rank-pairing heap, a heap (priority queue) implementation that combines the asymptotic efficiency of Fibonacci heaps with much of the simplicity of pairing heaps. Unlike all other heap implementations that match the bounds of Fibonacci heaps, our structure needs only one cut and no other structural changes per key decrease; the trees representing the heap can evolve to have arb...

متن کامل

Quake Heaps: A Simple Alternative to Fibonacci Heaps

This note describes a data structure that has the same theoretical performance as Fibonacci heaps, supporting decrease-key operations in O(1) amortized time and delete-min operations in O(log n) amortized time. The data structure is simple to explain and analyze, and may be of pedagogical value.

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:
  • CoRR

دوره abs/1510.03367  شماره 

صفحات  -

تاریخ انتشار 2015