Multidimensional Range Search - Advanced Data Structures - Lecture Slides, Slides of Computer Science

These are the Lecture Slides of Advanced Data Structures which includes Split Algorithm, Unbalanced Binary Search Trees, Forward Pass, Forward Pass Example, Backward Cleanup Pass, Retrace Path, Current Nodes, Roots of Respective Tries, Branch Nodes etc. Key important points are: Multidimensional Range Search, Static Collection of Records, Multidimensional Query, Data Structures, Unordered Sequential List, Sorted Tables, Performance Measures, Shape of Query

Typology: Slides

2012/2013

Uploaded on 03/19/2013

dharmakeerti
dharmakeerti 🇮🇳

4.2

(27)

89 documents

1 / 15

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Multidimensional Range Search
Static collection of records.
No inserts, deletes, changes.
Only queries.
Each record has k key fields.
Multidimensional query.
Given k ranges [li, ui], 1 <= i <= k.
Report all records in collection such that
li<= ki<= ui, 1 <= i <= k.
Multidimensional Range Search
All employees whose age is between 30 and 40
and whose salary is between $40K and $70K.
All cities with an annual rainfall between 40
and 60 inches, population between 100K and
200K, average temperature >= 70F, and number
of horses between 1025 and 2500.
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Multidimensional Range Search - Advanced Data Structures - Lecture Slides and more Slides Computer Science in PDF only on Docsity!

Multidimensional Range Search

  • Static collection of records.  No inserts, deletes, changes.  Only queries.
  • Each record has k key fields.
  • Multidimensional query.

 Given k ranges [ l i, ui], 1 <= i <= k.  Report all records in collection such that l i <= ki <= ui, 1 <= i <= k.

Multidimensional Range Search

  • All employees whose age is between 30 and 40 and whose salary is between $40K and $70K.
  • All cities with an annual rainfall between 40 and 60 inches, population between 100K and 200K, average temperature >= 70F, and number of horses between 1025 and 2500.

Data Structures For Range Search

  • Unordered sequential list.
  • Sorted tables.  k tables.  Table i is sorted by i’th key.
  • Cells.

k-d trees.

Range trees.

  • k-fold trees.
  • k-ranges.

Performance Measures

  • P(n,k).  Preprocessing time to construct search structure for n records, each has k key fields.  For many applications, this time needs only to be reasonable.
  • S(n,k).  Total space needed by the search structure.
  • Q(n,k).  Time needed to answer a query.

Performance

  • P(n,k) = O(n log n).  O(log n) levels.  O(n) time to find all medians at each level of the tree.

a

b

d e

c

f g

Performance

  • S(n,k) = O(n).  O(n) needed for the n records.  Tree takes O(n) space.

a

b

d e

c

f g

Performance

  • Q(n,k) depends on shape of query.  O(n1-1/k^ + s), where s is number of records that satisfy the query. Bound on worst-case query time.  O(log n + s), average time when query is almost cubical and a small fraction of the n records satisfy the query.  O(s), average time when query is almost cubical and a large fraction of the n records satisfy the query.

Range Trees—k=

  • Sorted array on single key.

 P(n,1) = O(n log n).  S(n,1) = O(n).  Q(n,1) = O(log n + s).

10 12 15 20 24 26 27 29 35 40 50 55

Example

  • a-g are x values.
  • x-range of a node begins at min x value in subtree and ends at max x value in subtree.

a SA

b c

d e f g

Example—Search

  • If x-range of root is contained in x-range of query, search SA for records that satisfy y-range of query. Done.
  • If entire x-range of query <= x (> x)value in root, recursively search left (right) subtree.

a SA

b c

d e f g

Example—Search

  • If x-range of query contains value in root, recursively search left and right subtrees.

a SA

b c

d e f g

Performance

  • P(n,2) = O(n log n).  O(n log n) – sort all records by y for the SAs.  O(n) time to find all medians at each level of the tree.

a SA

b c

d e f g

Performance

  • Q(n,2) = O(log^2 n + s).  At each level of the binary search tree, at most 2 SAs are searched.  O(log n) levels.

a SA

b c

d e f g

Range Trees—k=

  • Let the three key fields be w, x and y.
  • Binary search tree on w.
  • w value used in a node is the median w value for all records in that subtree.
  • Records with w value <= median in left subtree.
  • Records with larger w value in right subtree.

Range Trees—k=

  • Each node has a 2-d range tree on x and y of all records in the subtree.
  • Stop partitioning when # records in a partition is small enough (say 8).

Example

  • a-g are w values.
  • w-range of a node begins at min w value in subtree and ends at max w value in subtree.

a (^) 2-d

b

d e f g

cc

Performance —3-d Range Tree

  • P(n,3) = O(n log^2 n).  O(n) time to find all medians at each level of the tree.

a (^) 2-d

b c

d e f g

cc

Performance —3-d Range Tree

  • P(n,3) = O(n log^2 n).

a (^) 2-d

b c

d e f g

cc

 O(n log n) time to construct 2-d range trees at each level of the tree from data at preceding level.  O(log n) levels.

Performance —3-d Range Tree

  • S(n,3) = O(n log^2 n).  O(n log n) needed for the 2-d range trees and nodes at each level.  O(log n) levels.

a (^) 2-d

b c

d e f g

cc

Performance —3-d Range Tree

  • Q(n,3) = O(log^3 n + s).  At each level of the binary search tree, at most 2 2-d range trees are searched.  O(log^2 n + si) time to search each 2-d range tree. si is # records in the searched 2-d range tree that satisfy query.  O(log n) levels.