优先队列的性能测试 - 博客 - 伯乐在线



优先队列的性能测试 - 博客 - 伯乐在线

g++ 内存——内存总量:484412 kB msvc++ 内存——内存总量:484412 kB 平台—— Windows XP Pro 编译器—— Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80×86 Copyright (C) Microsoft Corporation 1984-2002. All rights reserved local 内存——内存总量:484412 kB 平台—— Windows XP Pro 编译器—— g++ (GCC) 4.1.1 20060525 (Red Hat 4.1.1-1) Copyright (C) 2006 Free Software Foundation, Inc. 这是一个免费软件,可以查看源代码进行复制,未经授权不得用于商业或者其他特殊目的。 push pop modify erase join std::priority_queue [std note 2]与 [std note 1] 一样,也不是算法的属性,而是与STL实现相关。同样,如果优先级队列采用std::vector实现,也可以将复杂度降低到Θ(n),但是,是一个非常大的常数(必须调用std::make_heap,这个操作是一个开销很大的线性操作);如果优先级队列用std::deque实现,则不可能降低复杂度。 [thin_heap_note] 一个稀疏堆,最坏情况的修改时间总是为&Theta(log(n)),但是摊销时间依赖于操作的特性:I)如果是插入较大的key值(从优先队列的比较函数角度来看),摊销时间是O(1)。但是如果II)插入一个较小的key值,那么摊销时间和最坏的情况下是一样的。注意:在大多数算法中,I)很重要,II)并不重要。 摊销push和pop操作 如上表所示,受限制最小的底层数据结构是二叉堆和配对堆。因此,也就不奇怪他们在摊销常数上表现最好。 std::

Read full article from 优先队列的性能测试 - 博客 - 伯乐在线


No comments:

Post a Comment

Labels

Algorithm (219) Lucene (130) LeetCode (97) Database (36) Data Structure (33) text mining (28) Solr (27) java (27) Mathematical Algorithm (26) Difficult Algorithm (25) Logic Thinking (23) Puzzles (23) Bit Algorithms (22) Math (21) List (20) Dynamic Programming (19) Linux (19) Tree (18) Machine Learning (15) EPI (11) Queue (11) Smart Algorithm (11) Operating System (9) Java Basic (8) Recursive Algorithm (8) Stack (8) Eclipse (7) Scala (7) Tika (7) J2EE (6) Monitoring (6) Trie (6) Concurrency (5) Geometry Algorithm (5) Greedy Algorithm (5) Mahout (5) MySQL (5) xpost (5) C (4) Interview (4) Vi (4) regular expression (4) to-do (4) C++ (3) Chrome (3) Divide and Conquer (3) Graph Algorithm (3) Permutation (3) Powershell (3) Random (3) Segment Tree (3) UIMA (3) Union-Find (3) Video (3) Virtualization (3) Windows (3) XML (3) Advanced Data Structure (2) Android (2) Bash (2) Classic Algorithm (2) Debugging (2) Design Pattern (2) Google (2) Hadoop (2) Java Collections (2) Markov Chains (2) Probabilities (2) Shell (2) Site (2) Web Development (2) Workplace (2) angularjs (2) .Net (1) Amazon Interview (1) Android Studio (1) Array (1) Boilerpipe (1) Book Notes (1) ChromeOS (1) Chromebook (1) Codility (1) Desgin (1) Design (1) Divide and Conqure (1) GAE (1) Google Interview (1) Great Stuff (1) Hash (1) High Tech Companies (1) Improving (1) LifeTips (1) Maven (1) Network (1) Performance (1) Programming (1) Resources (1) Sampling (1) Sed (1) Smart Thinking (1) Sort (1) Spark (1) Stanford NLP (1) System Design (1) Trove (1) VIP (1) tools (1)

Popular Posts