English 中文(简体)
是否支持减少作业?
原标题:Does a binary heap support the decrease-key operation?

根据http://en.wikipedia.org/wiki/Heap_%28data_ruct%29#Comparison_of_theoretic_ contras_for_variants”http://en.wikipedia.org/wiki/Heap_%28data_onstitu%29#Comparison_of_theoretic_spanishs_for_variants , ,它使用Θ(logn) (向O(logn)翻译,以开展减少关键业务。 然而,似乎没有一个站点,其中包括一个双双双向安装,同时减少关键操作。

因此,鉴于网络上缺乏执行,能否在双轨制下开展削减关键行动?

最佳回答

我是这样说的:

  • In order to perform a decrease-key in O(logn), we have to know the location of the corresponding element in advance. A hash map and a good hash function can guarantee O(1) amortized time. After each modification, we have to update the hash map, which takes O(logn).
  • After determining the location of our element, we move our element up in case it has a greater priority than its parent (in a similar manner to insertion) or down if it has a lower priority than one of its children (in a similar manner to deletion) and update the modified elements locations in the hash map.
问题回答

暂无回答




相关问题
The Fastest DataStructure to Filter with in C#

Currently we are filtering and sorting data with a datatable. /// <summary> /// Filters the data table and returns a new data table with only the filtered rows. /// </summary>...

Efficient queue in Haskell

How can I efficiently implement a list data structure where I can have 2 views to the head and end of the list, that always point to a head a tail of a list without expensive calls to reverse. i.e: ...

Java large datastructure for storing a matrix

I need to store a 2d matrix containing zip codes and the distance in km between each one of them. My client has an application that calculates the distances which are then stored in an Excel file. ...

Holding onto items after a postback

I have an ASP.NET web application and I want to be able to take items from a master list and store them temporarliy into one of four other lists. The other lists need to survive post backs so that ...

negative number in the stack

I am a new student in the compilers world ^_^ and I want to know is legal represent negative number in the stack. For example: infix: 1-5=-4 postfix: 15- The statements are: push(1) push(5) x=...

What type of struct/container would you use in this instance?

I am trying to figure out what type of structure or container I should use for a quick project. I need to have an unknown number of sets that will be entered from the GUI (each one will have a name, ...

热门标签