Const-time Search & Linear-time Sorting

12
1 Const-time Search Const-time Search & & Linear-time Sorting Linear-time Sorting Shi-qing Xin & Guo-jin Wang Shi-qing Xin & Guo-jin Wang 2006.10.25 2006.10.25

description

Const-time Search & Linear-time Sorting. Shi-qing Xin & Guo-jin Wang 2006.10.25. Problem Description. At most n numbers, with each formatted as K=k 1 k 2 …k w (0110…) Two dimensions to describe complexity Max(a 1 ,a 2 ), Max(a 1 ,a 2 ,…a n ) Linear-time sorting? - PowerPoint PPT Presentation

Transcript of Const-time Search & Linear-time Sorting

Page 1: Const-time Search  &  Linear-time Sorting

1

Const-time Search Const-time Search &&

Linear-time Sorting Linear-time Sorting

Shi-qing Xin & Guo-jin WangShi-qing Xin & Guo-jin Wang

2006.10.252006.10.25

Page 2: Const-time Search  &  Linear-time Sorting

2

Problem DescriptionProblem Description At most n numbers, with each At most n numbers, with each

formatted as K=kformatted as K=k11kk22…k…kw w (0110…)(0110…) Two dimensions to describe Two dimensions to describe

complexitycomplexity Max(aMax(a11,a,a22), Max(a), Max(a11,a,a22,…a,…ann)) Linear-time sorting? Linear-time sorting? Maintain a priority queue without Maintain a priority queue without

increasing time complexity?increasing time complexity?

Page 3: Const-time Search  &  Linear-time Sorting

3

Previous MethodsPrevious Methods

Previous search algorithmsPrevious search algorithms Previous sorting algorithmsPrevious sorting algorithms Stable sorting, comparison sorting Stable sorting, comparison sorting Is O(Is O(nnloglognn) the lower bound?) the lower bound? Radix sorting: from end; euqal word Radix sorting: from end; euqal word

length; extra space; repeated copy; length; extra space; repeated copy; array-based and not dynamic; higher array-based and not dynamic; higher average time complexity; average time complexity;

Quick sorting and red-black treeQuick sorting and red-black tree

Page 4: Const-time Search  &  Linear-time Sorting

4

Dijkstra’s algorithmDijkstra’s algorithm

Dijkstra’s algorithm on graphsDijkstra’s algorithm on graphs Time complexity O(ElogE)Time complexity O(ElogE) advantagesadvantages

Page 5: Const-time Search  &  Linear-time Sorting

5

An Ugly MethodAn Ugly Method

An O(nAn O(n22) method based on building a ) method based on building a binary tree.binary tree.

Page 6: Const-time Search  &  Linear-time Sorting

6

ContradictionContradiction

An O(E+nlogn) improved versionAn O(E+nlogn) improved version However, the improved algorithm isn’t However, the improved algorithm isn’t

essential. For example,essential. For example,

Let wLet wij ij += f+= fijij(min(d(min(dii, d, djj)) for each edge, )) for each edge, where fwhere fijij((۰۰) is a non-decreasing function.) 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;

Page 7: Const-time Search  &  Linear-time Sorting

7

Other Counter-intuitive Other Counter-intuitive ExamplesExamples

Our work on 3d shortest path problemOur 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-No one denies the possibility of const-

time search and linear-time sorting;time search and linear-time sorting; Unreasonable array & hash table;Unreasonable array & hash table; Unreasonable binary search & Unreasonable binary search &

Fibonacci search;Fibonacci search; How do we percept?How do we percept?

Page 8: Const-time Search  &  Linear-time Sorting

8

Goal of Our AlgorithmGoal of Our Algorithm

No empty position, linear spaceNo empty position, linear space A limited depth indepent of n A limited depth indepent of n Dynamic search, deletion, insertion can be Dynamic search, deletion, insertion can be

done in const time.done in const time. Extract the min/max element in const Extract the min/max element in const

time.time. Linear-time traversalLinear-time traversal Visit k-th elem in const timeVisit k-th elem in const time Reflect inherent similarityReflect inherent similarity

Page 9: Const-time Search  &  Linear-time Sorting

9

Operations on RBTOperations on RBT

Search an elemSearch an elem Insert an elemInsert an elem Delete a given elemDelete a given elem Extract the min/max element;Extract the min/max element; Read the k-th elementRead the k-th element TraversalTraversal Extract a group of similar elementsExtract a group of similar elements

Page 10: Const-time Search  &  Linear-time Sorting

10

ApplicationsApplications

Complexity theory, graphs, Complexity theory, graphs, computational geometry; for example, computational geometry; for example, shortest path problem in 2D or 3D.shortest path problem in 2D or 3D.

Design efficient algorithmsDesign efficient algorithms Computer designComputer design Database & data structure & languageDatabase & data structure & language AIAI And so onAnd so on

Page 11: Const-time Search  &  Linear-time Sorting

11

CriticismsCriticisms Array, hash table, B- tree & B+ tree, Array, hash table, B- tree & B+ tree,

balanced tree, huffman tree, read-balanced tree, huffman tree, read-black tree, suffix array sorting, binary black tree, suffix array sorting, binary search, k-ary heap, Fibonacci heap, search, k-ary heap, Fibonacci heap, etc.etc.

Computer design: excessively Computer design: excessively digitized; digitized;

Page 12: Const-time Search  &  Linear-time Sorting

12

Thank you!Thank you!