Download presentation
Presentation is loading. Please wait.
Published byTodd Farmer Modified over 8 years ago
2
1 Const-time Search & Linear-time Sorting Shi-qing Xin & Guo-jin Wang 2006.10.25
3
2 Problem Description At most n numbers, with each formatted as K=k 1 k 2 …k w (0110…) At most n numbers, with each formatted as K=k 1 k 2 …k w (0110…) Two dimensions to describe complexity Two dimensions to describe complexity Max(a 1,a 2 ), Max(a 1,a 2,…a n ) Max(a 1,a 2 ), Max(a 1,a 2,…a n ) Linear-time sorting? Linear-time sorting? Maintain a priority queue without increasing time complexity? Maintain a priority queue without increasing time complexity?
4
3 Previous Methods Previous search algorithms Previous search algorithms Previous sorting algorithms Previous sorting algorithms Stable sorting, comparison sorting Stable sorting, comparison sorting Is O(nlogn) the lower bound? Is O(nlogn) the lower bound? Radix sorting: from end; euqal word length; extra space; repeated copy; array-based and not dynamic; higher average time complexity; Radix sorting: from end; euqal word length; extra space; repeated copy; array-based and not dynamic; higher average time complexity; Quick sorting and red-black tree Quick sorting and red-black tree
5
4 Dijkstra ’ s algorithm Dijkstra’s algorithm on graphs Dijkstra’s algorithm on graphs Time complexity O(ElogE) Time complexity O(ElogE) advantages advantages
6
5 An Ugly Method An O(n 2 ) method based on building a binary tree. An O(n 2 ) method based on building a binary tree.
7
6 Contradiction An O(E+nlogn) improved version An O(E+nlogn) improved version However, the improved algorithm isn’t essential. For example, However, the improved algorithm isn’t essential. For example, Let w ij += f ij (min(d i, d j )) for each edge, where f ij ( ۰ ) is a non-decreasing function. The definition is correct. The definition is correct. The improved version doesn’t work. The improved version doesn’t work. Another improved version by Tarjan; Another improved version by Tarjan;
8
7 Other Counter-intuitive Examples Our work on 3d shortest path problem Our work on 3d shortest path problem What is the best sorting algorithm? What is the best sorting algorithm? No one denies the possibility of const- time search and linear-time sorting; No one denies the possibility of const- time search and linear-time sorting; Unreasonable array & hash table; Unreasonable array & hash table; Unreasonable binary search & Fibonacci search; Unreasonable binary search & Fibonacci search; How do we percept? How do we percept?
9
8 Goal of Our Algorithm No empty position, linear space No empty position, linear space A limited depth indepent of n A limited depth indepent of n Dynamic search, deletion, insertion can be done in const time. Dynamic search, deletion, insertion can be done in const time. Extract the min/max element in const time. Extract the min/max element in const time. Linear-time traversal Linear-time traversal Visit k-th elem in const time Visit k-th elem in const time Reflect inherent similarity Reflect inherent similarity
10
9 Operations on RBT Search an elem Search an elem Insert an elem Insert an elem Delete a given elem Delete a given elem Extract the min/max element; Extract the min/max element; Read the k-th element Read the k-th element Traversal Traversal Extract a group of similar elements Extract a group of similar elements
11
10 Applications Complexity theory, graphs, computational geometry; for example, shortest path problem in 2D or 3D. Complexity theory, graphs, computational geometry; for example, shortest path problem in 2D or 3D. Design efficient algorithms Design efficient algorithms Computer design Computer design Database & data structure & language Database & data structure & language AI AI And so on And so on
12
11 Criticisms Array, hash table, B- tree & B+ tree, balanced tree, huffman tree, read-black tree, suffix array sorting, binary search, k-ary heap, Fibonacci heap, etc. Array, hash table, B- tree & B+ tree, balanced tree, huffman tree, read-black tree, suffix array sorting, binary search, k-ary heap, Fibonacci heap, etc. Computer design: excessively digitized; Computer design: excessively digitized;
13
12 Thank you! Thank you!
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.