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

Slides:



Advertisements
Similar presentations
Algorithms (and Datastructures) Lecture 3 MAS 714 part 2 Hartmut Klauck.
Advertisements

Single Source Shortest Paths
Exam Review 3 Chapters 10 – 13, 15 CSC212 Section FG CS Dept, CCNY.
Transform and Conquer Chapter 6. Transform and Conquer Solve problem by transforming into: a more convenient instance of the same problem (instance simplification)
Search Trees: BSTs and B-Trees David Kauchak cs302 Spring 2013.
1 6.3 Binary Heap - Other Heap Operations There is no way to find any particular key without a linear scan through the entire heap. However, if we know.
Data Structures, Search and Sort Algorithms Kar-Hai Chu
Exam Review 3 Chapters 10 – 13, 15 CSC212 Section FG CS Dept, CCNY.
CSE332: Data Abstractions Lecture 12: Introduction to Sorting Tyler Robison Summer
Lecture 5: Linear Time Sorting Shang-Hua Teng. Sorting Input: Array A[1...n], of elements in arbitrary order; array size n Output: Array A[1...n] of the.
Midterm 2 Overview Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
TCSS 343, version 1.1 Algorithms, Design and Analysis Transform and Conquer Algorithms Presorting HeapSort.
Graphs & Exam Review 3 Chapter 10 – 13 CS211 CS Dept, MHC.
Review for Test 2 i206 Fall 2010 John Chuang. 2 Topics  Operating System and Memory Hierarchy  Algorithm analysis and Big-O Notation  Data structures.
CS 206 Introduction to Computer Science II 11 / 12 / 2008 Instructor: Michael Eckmann.
Shortest Path Problems Directed weighted graph. Path length is sum of weights of edges on path. The vertex at which the path begins is the source vertex.
Course Review COMP171 Spring Hashing / Slide 2 Elementary Data Structures * Linked lists n Types: singular, doubly, circular n Operations: insert,
CS 206 Introduction to Computer Science II 12 / 10 / 2008 Instructor: Michael Eckmann.
Data Structures, Spring 2004 © L. Joskowicz 1 DAST – Final Lecture Summary and overview What we have learned. Why it is important. What next.
Chapter 9: Graphs Spanning Trees Mark Allen Weiss: Data Structures and Algorithm Analysis in Java Lydia Sinapova, Simpson College.
DAST, Spring © L. Joskowicz 1 Data Structures – LECTURE 1 Introduction Motivation: algorithms and abstract data types Easy problems, hard problems.
Design and Analysis of Algorithms Non-comparison sort (sorting in linear time) Haidong Xue Summer 2012, at GSU.
C o n f i d e n t i a l Developed By Nitendra NextHome Subject Name: Data Structure Using C Title: Overview of Data Structure.
Instructor: Dr. Sahar Shabanah Fall Lectures ST, 9:30 pm-11:00 pm Text book: M. T. Goodrich and R. Tamassia, “Data Structures and Algorithms in.
Copyright © Wondershare Software Introduction to Data Structures Prepared by: Eng. Ahmed & Mohamed Taha.
Advanced Algorithms Analysis and Design Lecture 8 (Continue Lecture 7…..) Elementry Data Structures By Engr Huma Ayub Vine.
1 Hash Tables  a hash table is an array of size Tsize  has index positions 0.. Tsize-1  two types of hash tables  open hash table  array element type.
Using Dijkstra’s Algorithm to Find a Shortest Path from a to z 1.
Dijkstras Algorithm Named after its discoverer, Dutch computer scientist Edsger Dijkstra, is an algorithm that solves the single-source shortest path problem.
Data Structures ساختمان داده ها مظفر بگ محمدی دانشکده فنی دانشگاه ایلام.
1 Time Analysis Analyzing an algorithm = estimating the resources it requires. Time How long will it take to execute? Impossible to find exact value Depends.
HKOI 2006 Intermediate Training Searching and Sorting 1/4/2006.
10/20/20151 CS 3343: Analysis of Algorithms Review for final.
Sorting. Pseudocode of Insertion Sort Insertion Sort To sort array A[0..n-1], sort A[0..n-2] recursively and then insert A[n-1] in its proper place among.
 Analysis Wrap-up. What is analysis?  Look at an algorithm and determine:  How much time it takes  How much space it takes  How much programming.
CS Data Structures II Review & Final Exam. 2 Topics Review Final Exam.
Chapter 24: Single-Source Shortest Paths Given: A single source vertex in a weighted, directed graph. Want to compute a shortest path for each possible.
CS223 Advanced Data Structures and Algorithms 1 Review for Midterm Neil Tang 03/06/2008.
HASHING PROJECT 1. SEARCHING DATA STRUCTURES Consider a set of data with N data items stored in some data structure We must be able to insert, delete.
Elementary Data Organization. Outline  Data, Entity and Information  Primitive data types  Non primitive data Types  Data structure  Definition 
Runtime O(VE), for +/- edges, Detects existence of neg. loops
Review for Final Exam – cs411/511 Definitions (5 questions, 2 points each) Algorithm Analysis (3 questions, 3 points each) General Questions (3 questions,
Data Structure II So Pak Yeung Outline Review  Array  Sorted Array  Linked List Binary Search Tree Heap Hash Table.
CompSci 100E 30.1 Other N log N Sorts  Binary Tree Sort  Basic Recipe o Insert into binary search tree (BST) o Do Inorder Traversal  Complexity o Create:
CS223 Advanced Data Structures and Algorithms 1 Priority Queue and Binary Heap Neil Tang 02/09/2010.
CSS446 Spring 2014 Nan Wang.  to study trees and binary trees  to understand how binary search trees can implement sets  to learn how red-black trees.
FALL 2005CENG 213 Data Structures1 Priority Queues (Heaps) Reference: Chapter 7.
CSE 340: Review (at last!) Measuring The Complexity Complexity is a function of the size of the input O() Ω() Θ() Complexity Analysis “same order” Order.
Initializing A Max Heap input array = [-, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
CS6045: Advanced Algorithms Sorting Algorithms. Heap Data Structure A heap (nearly complete binary tree) can be stored as an array A –Root of tree is.
 Saturday, April 20, 8:30-11:00am in B9201  Similar in style to written midterm exam  May include (a little) coding on paper  About 1.5 times as long.
Chapter 9: Sorting1 Sorting & Searching Ch. # 9. Chapter 9: Sorting2 Chapter Outline  What is sorting and complexity of sorting  Different types of.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To introduce the basic concepts of linked lists ❏ To introduce the basic concepts.
CSE 589 Applied Algorithms Spring 1999 Prim’s Algorithm for MST Load Balance Spanning Tree Hamiltonian Path.
Introduction to Data Structure and Algorithms
FALL 2005CENG 213 Data Structures1 Review. FALL 2005CENG 213 Data Structures2 Collection of items Problems that must manage data by value. Some important.
1 Priority Queues (Heaps). 2 Priority Queues Many applications require that we process records with keys in order, but not necessarily in full sorted.
Final Exam Review COP4530.
Top 50 Data Structures Interview Questions
Courtsey & Copyright: DESIGN AND ANALYSIS OF ALGORITHMS Courtsey & Copyright:
Hashing Exercises.
Greedy Algorithms / Dijkstra’s Algorithm Yin Tat Lee
Priority Queue and Binary Heap Neil Tang 02/12/2008
Final Exam Review COP4530.
Graph Algorithms: Shortest Path
Implementation of Dijkstra’s Algorithm
Priority Queues Supports the following operations. Insert element x.
Analysis and design of algorithm
CS203 Lecture 14.
Chapter 9: Graphs Spanning Trees
Presentation transcript:

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

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?

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

4 Dijkstra ’ s algorithm Dijkstra’s algorithm on graphs Dijkstra’s algorithm on graphs Time complexity O(ElogE) Time complexity O(ElogE) advantages advantages

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.

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;

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?

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

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

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

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;

12 Thank you! Thank you!