5 Spatial Access Methods

Size: px
Start display at page:

Download "5 Spatial Access Methods"

Transcription

1 5 Spatial Access Methods 5.1 Quadtree 5.2 R-tree 5.3 K-d tree 5.4 BSP tree 3 27 A 17 5 G E B J K 5.5 Grid file Summary D C F H Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 419

2 5 Spatial Access Methods Speeding up queries by well-directed access on relevant tuples Query types Point query Range query Nearest neighbour query Problems Maintenance of the topological structure Density of objects varies strongly Dynamic reorganisation Representation of objects: points as well as extended objects Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 420

3 5 Spatial Access Methods For one-dimensional data: B-Tree Upper (U) and lower (L) bound for number of links usually : 2*L = U nsertion All insertions happen at the leaf nodes key value data pointer tree node node pointers Nodes are split during insertion as soon as they contain more than U-2 keys The median is chosen from among the leaf's elements and the new element The splitting may go all the way up to the root Deletion Rebalancing necessary if node contains less than L keys Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 421

4 5 Spatial Access Methods Very efficient data structure for disk storage O(log n) for all operations Even better Guaranteed maximum node-accesses to locate a key is Balanced binary tree guarantees only Accessing a node is expensive on disks huge improvement No degenerated cases Self-balancing rarely necessary as most updates affect just one node Wasted space decreased due to guaranteed minimal fill factor Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 422

5 5 Spatial Access Methods B + -Tree Different nodes for leaf nodes and internal nodes Data pointers only in leaf nodes All leafs are linked to each other in-order Advantages mproved traversal performance ncreased search efficiency ncreased memory efficiency Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 423

6 5 Spatial Access Methods Why not use B-Tree or B + -Tree for indexing twodimensional data? Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 424

7 5 Spatial Access Methods One-dimensional orderings Mapping multidimensional data to one dimension Try to preserve object proximity Use a uniform grid to partition the space Assign a unique number to each cell in a way that Adjacent cells get similar numbers t can be defined by a recursion of any depth Each cell can be refined separately without disturbing the order of the other numbers Space filling curve Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 425

8 5 Spatial Access Methods Examples for space filling curves: Z-order Gray code Hilbert s curve Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 426

9 5 Spatial Access Methods Example of point-shaped objects: weather stations Attributes Position Owner Year of construction Analog/digital D A E H F C K J B G Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 427

10 5 Spatial Access Methods Sorting points by Z-order Recursive decomposition of space in quadrants until every quadrant contains at most one point A C D F E H K B G J Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 428

11 5 Spatial Access Methods Sorting points by Z-order Recursive decomposition of space in quadrants until every quadrant contains at most one point A C D F E H K B G J Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 428

12 5 Spatial Access Methods Sorting points by Z-order Recursive decomposition of space in quadrants until every quadrant contains at most one point A C D F E H K B G J Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 428

13 5 Spatial Access Methods Sorting points by Z-order Recursive decomposition of space in quadrants until every quadrant contains at most one point A C 01 D F E H 11 K B 00 G 10 J Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 428

14 5 Spatial Access Methods Sorting points by Z-order Recursive decomposition of space in quadrants until every quadrant contains at most one point A 0101 C 0100 D 0111 E F 0110 H K B 00 G J Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 428

15 5 Spatial Access Methods Sorting points by Z-order Recursive decomposition of space in quadrants until every quadrant contains at most one point A 0101 C 0100 D 0111 E F 0110 H K 1110 B 00 G J Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 428

16 5 Spatial Access Methods Sorting points by Z-order Recursive decomposition of space in quadrants until every quadrant contains at most one point A 0101 C 0100 D 0111 E F 0110 H K 1110 B 00 G 1000 J 1011 Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 428

17 5 Spatial Access Methods Sorting points by Z-order Recursive decomposition of space in quadrants until every quadrant contains at most one point A 0101 C D 0111 E F 0110 H K 1110 B, C, A, F, D, E, G, J, H, K, B 00 G 1000 J 1011 Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 428

18 5 Spatial Access Methods A more realistic example (150 points) Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 429

19 5 Spatial Access Methods A more realistic example (200 points) Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 429

20 5 Spatial Access Methods A more realistic example (250 points) Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 429

21 5 Spatial Access Methods Efficient calculation of the Z-value by bitinterleaving The Z-value of a quadrant consists of alternating bits from the binary representations of its x and y coordinate values, 11 i.e.: x-coordinate y-coordinate Z-value Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 430

22 5 Spatial Access Methods Example: range query Calculate Z-values of the query window: Min=16, Max=30 Search for Min Check all points whose Z-values Max A C Min B D Max E F G H J K B C A F D E G J H K Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 431

23 5 Spatial Access Methods Problems Only suitable for points False positives, the solutions supplied by the index have to be verified Adequacy depends on the position of the query window Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 432

24 5 Spatial Access Methods ndexes can be classified according to Data types, which can be indexed Points (Point Access Method) or extended objects (Spatial Access Method) Principle of space decomposition: structure dependant on the insertion order data-driven (tree) yes space-driven (trie) no indexing dead space no yes guaranteed storage utilization yes no Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 433

25 5.1 Quadtree Main principle: Successive decomposing of space into quadrants Search tree whose nodes have four children each Decomposition may be space- or data-driven Can be used for points as well as for extended objects Not balanced, can degenerate nw sw ne se Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 434

26 5.1 Quadtree Point quadtree (data-driven) ndexing of points Data pointers in leaf and internal nodes nsertion Search ends at Nil node, replace this node with the new node containing the element Deletion of internal nodes difficult Remove the subtree whose root is the node to be deleted Re-insert nodes of the subtree tree node key value data pointer node pointer Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 435

27 5.1 Quadtree Example: insertion F A C D E F H K B G J Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 436

28 5.1 Quadtree Example: insertion E F A C D E F H K B G J Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 436

29 5.1 Quadtree Example: insertion E F A C D E F H K J D A B G Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 436

30 5.1 Quadtree Example: insertion E C F A C D E F H K J D A B G Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 436

31 5.1 Quadtree Example: insertion E C F A C D E F H K J D A B B G Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 436

32 5.1 Quadtree Example: insertion E C J 5 15 F A C D E F H K J D A B G K H B G Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 436

33 5.1 Quadtree Range query: Min(x, y), Max(x,y) 4 comparisons per node skip N skip W skip E skip S Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 437

34 5.1 Quadtree Range query: Min(5, 16), Max(20,19) 4 comparisons per node x < Min.x skip w D F y < Min.y skip s x > Max.x skip e y > Max.y skip n A C Min E F Max H K E C J J B G D A B G K H Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 438

35 5.1 Quadtree Range query: Min(5, 16), Max(20,19) 4 comparisons per node x < Min.x skip w D F y < Min.y skip s x > Max.x skip e y > Max.y skip n A C Min E F Max H K E C J J B G D A B G K H Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 438

36 5.1 Quadtree Range query: Min(5, 16), Max(20,19) 4 comparisons per node x < Min.x skip w D F y < Min.y skip s x > Max.x skip e y > Max.y skip n A C Min E F Max H K E C J J B G D A B G K H Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 438

37 5.1 Quadtree Range query: Min(5, 16), Max(20,19) 4 comparisons per node x < Min.x skip w D F y < Min.y skip s x > Max.x skip e y > Max.y skip n A C Min E F Max H K E C J J B G D A B G K H Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 438

38 5.1 Quadtree Range query: Min(5, 16), Max(20,19) 4 comparisons per node x < Min.x skip w D F y < Min.y skip s x > Max.x skip e y > Max.y skip n A C Min E F Max H K E C J J B G D A B G K H Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 438

39 5.1 Quadtree Range query: Min(5, 16), Max(20,19) 4 comparisons per node x < Min.x skip w D F y < Min.y skip s x > Max.x skip e y > Max.y skip n A C Min E F Max H K E C J J B G D A B G K H Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 438

40 5.1 Quadtree Range query: Min(5, 16), Max(20,19) 4 comparisons per node x < Min.x skip w D F y < Min.y skip s x > Max.x skip e y > Max.y skip n A C Min E F Max H K E C J J B G D A B G K H Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 438

41 5.1 Quadtree Range query: Min(5, 16), Max(20,19) 4 comparisons per node x < Min.x skip w D F y < Min.y skip s x > Max.x skip e y > Max.y skip n A C Min E F Max H K E C J J B G D A B G K H Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 438

42 5.1 Quadtree Range query: Min(5, 16), Max(20,19) 4 comparisons per node x < Min.x skip w D F y < Min.y skip s x > Max.x skip e y > Max.y skip n A C Min E F Max H K E C J J B G D A B G K H Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 438

43 5.1 Quadtree Range query: Min(5, 16), Max(20,19) 4 comparisons per node x < Min.x skip w D F y < Min.y skip s x > Max.x skip e y > Max.y skip n A C Min E F Max H K E C J J B G D A B G K H Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 438

44 5.1 Quadtree Range query: Min(5, 16), Max(20,19) 4 comparisons per node x < Min.x skip w D F y < Min.y skip s x > Max.x skip e y > Max.y skip n A C Min E F Max H K E C J J B G D A B G K H Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 438

45 5.1 Quadtree Unfavorable insertion order 2 19 A 15 6 G E B 23 9 J K A C Min D E F Max H K 8 23 D 5 15 C B G J F H Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 439

46 5.1 Quadtree Example: locations of 400 weather stations in Germany Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 440

47 5.1 Quadtree unfavorable insertion order optimal insertion order visualization tool: [Bu10] Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 441

48 5.1 Quadtree unfavorable insertion order (bucket size = 20) optimal insertion order visualization tool: [Bu10] Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 442

49 5.1 Quadtree Disadvantages High storage usage 4 Nil nodes per leaf at least, additional ones may be in internal nodes Deletion expensive K comparisons for point queries, 2k for range queries per node Variants: Pseudo-Quadtree Using arbitrary points for the partitioning process Data pointers only in leaf nodes 9 20 D E A F 6 10 C B K G J H Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 443

50 5.1 Quadtree Point quadtree (space-driven) Recursive subdivision of the space into quadrants until every quadrant contains at most the given number of points Extent of space has to be known B A C D E F H K A C F G J H K D E B G J Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 444

51 5.1 Quadtree nternal nodes contain only node pointer Data pointer only in leaf nodes Structure depends on the location of points nsertion Search ends at Nil node: insert new leaf node Search ends at leaf node: replace leaf with a new internal node, insert both points as new leaves Deletion Only leaves are deleted f an internal node has only one child after deletion it is replaced by its child Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 445

52 5.1 Quadtree Region quadtree (space-driven) ndexing of surfaces Decomposition of space until the quadrants are empty or completely covered by an object X X Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 446

53 5.1 Quadtree Region quadtree (space-driven) ndexing of surfaces Decomposition of space until the quadrants are empty or completely covered by an object X X Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 446

54 5.1 Quadtree Region quadtree (space-driven) ndexing of surfaces Decomposition of space until the quadrants are empty or completely covered by an object X X Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 446

55 5.1 Quadtree Region quadtree (space-driven) ndexing of surfaces Decomposition of space until the quadrants are empty or completely covered by an object X X Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 446

56 5.1 Quadtree Region quadtree (space-driven) ndexing of surfaces Decomposition of space until the quadrants are empty or completely covered by an object X X Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 446

57 5.1 Quadtree Region quadtree (space-driven) ndexing of surfaces Decomposition of space until the quadrants are empty or completely covered by an object X X Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 446

58 5.1 Quadtree Region quadtree (space-driven) ndexing of surfaces Decomposition of space until the quadrants are empty or completely covered by an object X / X Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 446

59 5.1 Quadtree Region quadtree (space-driven) ndexing of surfaces Decomposition of space until the quadrants are empty or completely covered by an object X / X Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 446

60 5.1 Quadtree Region quadtree (space-driven) ndexing of surfaces Decomposition of space until the quadrants are empty or completely covered by an object X / X X X X Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 446

61 5.1 Quadtree Region quadtree (space-driven) ndexing of surfaces Decomposition of space until the quadrants are empty or completely covered by an object X / X X X X X X Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 446

62 5.2 R-tree The R-tree is the prototype of a multidimensional extension of the B-tree The root has at least two child nodes Every internal node has got between m and M child nodes (multiway tree) M and m M are predisposed For each entry of an internal node the MBR containing all the rectangles of its child nodes is stored Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 447 node pointer MBR data pointer internal node leaf

63 5.2 R-tree Overlapping clusters (the more overlap the less efficient) Objects are stored in leaves, internal nodes for navigation only Height balanced tree Dynamic index structure (supports insert, update, delete) Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 448

64 5.2 R-tree Construction a e f c g j b h i d Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 449

65 5.2 R-tree Construction a e B A f c g j b h D i C d a c f e g j b d h i Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 449

66 5.2 R-tree Construction a e B A f c g j b h D i C d A B C D a c f e g j b d h i Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 449

67 5.2 R-tree Construction a e B A f c g j b h D i C d A B C D a c f e g j b d h i Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 449

68 5.2 R-tree Search Recursively from the root to the leaves One path at a time f the object has not been found in this subtree, the next search path will be traversed The traversal order of paths is arbitrary Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 450

69 5.2 R-tree Good performance is not guaranteed n the worst case all paths have to be searched (because of overlap) Search algorithms try to skip as many irrelevant subtrees as possible (pruning) Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 451

70 5.2 R-tree Search in internal node: Check for each entry if its MBR intersects S For all intersecting entries continue searching in all its child nodes Search in leaf nodes: Check for each entry if its MBR intersects S For all intersecting entries check if the original objects satisfy the search condition, if so they belong to the solution Search algorithms for R-trees are the most efficient if overlap and coverage are minimized Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 452

71 5.2 R-tree Example: a e B A f c S g j b h D i C d A B C D a c f e g j b d h i Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 453

72 5.2 R-tree Example: a e B A f c S g j b h D i C d A B C D a c f e g j b d h i Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 453

73 5.2 R-tree Example: a e B A f c S g j b h D i C d A B C D a c f e g j b d h i Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 453

74 5.2 R-tree Example: a e B A f c S g j b h D i C d A B C D a c f e g j b d h i Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 453

75 5.2 R-tree Example: a e B A f c S g j b h D i C d A B C D a c f e g j b d h i Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 453

76 5.2 R-tree Example: a e B A f c S g j b h D i C d A B C D a c f e g j b d h i Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 453

77 5.2 R-tree Example: a e B A f c S g j b h D i C d A B C D a c f e g j b d h i Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 453

78 5.2 R-tree nsertion Search the best leaf node, according to spatial criteria (ChooseLeaf) f the node contains less than M entries, insert the object there Otherwise overflow handling is necessary and the node is split (SplitNode), so that overlap and coverage are minimized Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 454

79 5.2 R-tree MBR of the parent node has to be enlarged if the new object is not entirely inside (AdjustTree) f the root is splitted create a new root whose children are the splitted nodes of the old root Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 455

80 nsert k either into C or into D f D is chosen the added area is bigger, but there is no overlap Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig R-tree a b c d e g f h i j k A B C D a b c d e g f h i j k A B C D

81 5.2 R-tree Heuristic Always insert a new object into the node resulting in smallest increase in volume f it lies inside a MBR no enlargement is necessary f there is more than one possibility, choose the node with the smallest volume the Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 457

82 5.2 R-tree Overflow f a new entry should be inserted into a full node than M+1 entries have to be distributed to two nodes During subsequent searches it should not be necessary to search both subtrees The smaller the MBRs the less overlap Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 458

83 5.2 R-tree Calculate the sum of the area of both rectangles and minimize the dead space The volume of both MBRs should be as small as possible Decision how to split is not trivial There are many possibilities to distribute the objects to two MBRs: x 2 n 1 1 Compare all possible distributions takes exponential time (practically impossible) Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 459

84 5.2 R-tree Example: possible distributions for 5 objects Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 460

85 5.2 R-tree visualization tool: [Sp10] Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 461

86 5.2 R-tree Example: possible distributions for 6 objects visualization tool: [Sp10] Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 462

87 5.2 R-tree Overflow handling with a quadratic complexity For each pair of objects calculate the area of their MBR and choose the pair with the largest MBR As these objects should not belong to the same node they are used as seed points of two new nodes Calculate for all other objects the difference in increase in volume in respect of both MBRs nsert the object with the largest difference into the adequate MBR and update it Repeat this process for the remaining objects Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 463

88 5.2 R-tree Determining the seeds with a linear complexity For each dimension: Find the rectangle with the highest low edge and the rectangle with the lowest high edge Calculate the distance between them and normalise it by dividing it by the width of the MBR of the overflowing node The final seeds are the two objects having the greatest normalized separation This linear cost algorithm is usually sufficient as the quality of the splits i.e. the minimality of overlaps is similar to that of the quadratic cost algorithm Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 464

89 5.2 R-tree Example Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 465

90 5.2 R-tree Example Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 465

91 5.2 R-tree Example Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 465

92 5.2 R-tree Example Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 465

93 5.2 R-tree Example Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 465

94 5.2 R-tree Example Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 465

95 5.2 Example Overflow Handling m A B C D a e B A f c g j a c f b d k e g j h i b h D i C d k Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 466

96 5.2 Example Overflow Handling m A B C D e g j a c f b d k e g j h i Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 466

97 5.2 Example Overflow Handling X-direction: Choose e and j 9 m d x = 2/11 0,18 Y-direction: e 3,5 Choose m and j d y = 3,5/9 0,43 g 2 j As d y > d x choose m and j 11 Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 467

98 5.2 Example Overflow Handling X-direction: Choose e and j 9 m d x = 2/11 0,18 Y-direction: e 3,5 Choose m and j d y = 3,5/9 0,43 g 2 j As d y > d x choose m and j 11 Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 467

99 5.2 Example Overflow Handling nsert g to m: 24 9 m to j: 41,5 Difference: 17,5 e 3,5 nsert e to m: 14 g 2 j to j: Difference: 38 Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 468

100 5.2 Example Overflow Handling nsert g to m: 24 9 m to j: 41,5 Difference: 17,5 e 3,5 nsert e to m: 14 g 2 j to j: Difference: 38 Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 468

101 5.2 Example Overflow Handling nsert g to m: 24 9 m to j: 41,5 Difference: 17,5 e 3,5 nsert e to m: 14 g 2 j to j: Difference: 38 Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 468

102 5.2 Example Overflow Handling Result a E e m A f c g j B b h D i A B E C D C d k j a c f e m g b d k h i Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 469

103 5.2 R-tree Deletion Search for the leaf containing the entry (FindLeaf) Delete the entry from the leaf (DeleteRecord) Condense the tree if the node contains less than m entries, i.e. the node is deleted completely and the other entries are reinserted (CondenseTree) f only one child of the root is left this child becomes the new root Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 470

104 5.2 R-tree Updates f an object is updated its MBR might change n that case the corresponding entry has to be deleted, updated and reinserted Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 471

105 5.2 R-tree Updates f an object is updated its MBR might change n that case the corresponding entry has to be deleted, updated and reinserted Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 471

106 5.2 R-tree Updates f an object is updated its MBR might change n that case the corresponding entry has to be deleted, updated and reinserted Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 471

107 5.2 R-tree Updates f an object is updated its MBR might change n that case the corresponding entry has to be deleted, updated and reinserted Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 471

108 5.2 R-tree R + tree Overlap of adjacent MBRs is forbidden Several leaves may contain an entry for one object Search is more efficient, but its scalability is similar to R-trees b C a A f d c E e k h g j D i B A B E C D a e e g j c f b d h i k Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 472

109 5.2 R-tree Differences between R + trees and R-trees nsertion: object may be inserted in more than one leaf nsertion: propagation of splits down the tree as overlaps are not allowed Deletion: there is no minimum number of child nodes anymore a e e g j c f b d h i k The biggest advantage of R + -trees is the improved search efficiency as only a single path has to be searched for a point query A disadvantage is that nodes are often under-filled due to many splits A B E C D Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 473

110 5.3 K-d tree K-dimensional, binary search tree On every level the space is decomposed perpendicular to one dimension one comparison ndexing of points Variant for extended objects: Bintree Not balanced key value A K-d tree for n points Needs O(n) space May be constructed in O(n log n) time data pointer discriminant: dimension used for splitting node pointer tree node Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 474

111 5.3 K-d tree Example: data driven, alternating splits in x- and y-dimension B C 8 17 D y J F x y K A C D E F H K 4 7 x 9 31 x x x J A 3 27 y E y G 17 5 y H y B G Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 475

112 5.3 K-d tree Split at data points or at arbitrary points Choice of split dimension Alternating or dimension with the largest extent Choice of split position Median or average Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 476

113 5.3 K-d tree Determination of the split plane Calculation of the median of n elements necessary Complex algorithm to determine the median in O(n) or: Sort all points in two lists one according to the x- and one to the y-coordinate After a split these lists are splited respectively traversal in linear time possible Determining the median in O(1) and creation of sublists in O(n) time Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 477

114 5.3 K-d tree Bintree Like the region quadtree, but the space is not divided into quadrants but into half-spaces 20 x y 20 y 4 x 8 x 23 x 28 x 24 X y 8 y 24 y 10 y 24 y 2 x 2 x 8 x 4 x x X 12 X 8 y / 16 y 8 y X 4 23 Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 478

115 5.3 K-d tree Deletion Similar to binary search tree: the node to delete is replaced by its immediate predecessor or successor Problem: Several different orderings of the elements F (one for each dimension) Solution: Search the node which is the immediate predecessor or successor with respect to the discriminant of the node to delete A B x C y Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig D 9 31 E y x y J x G x y y K x H y

116 5.3 K-d tree Deletion Similar to binary search tree: the node to delete is replaced by its immediate predecessor or successor Problem: Several different orderings of the elements F (one for each dimension) Solution: Search the node which is the immediate predecessor or successor with respect to the discriminant of the node to delete A B x C y Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig D 9 31 E y x y J x G x y y K x H y

117 5.3 K-d tree Deletion Similar to binary search tree: the node to delete is replaced by its immediate predecessor or successor Problem: Several different orderings of the elements F (one for each dimension) Solution: Search the node which is the immediate predecessor or successor with respect to the discriminant of the node to delete B 4 7 x A Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig D 9 31 E y x y J x G x y y K x H y

118 5.4 BSP tree Binary Space Partitioning (BSP) Recursive bipartitioning of the n-dimensional space by (arbitrary) (n-1)-dimensional hyperplanes (in 2d: lines) generalized k-d tree Usually used to index surfaces or lines Class variables of a BSP tree node class Node{ Hyperplane ph; Node leftchild; Node rightchild; Set oset; } //split plane (instead of the discriminant) //left child, is in front of the split plane //right child, is behind the split plane //set of objects in the plane Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 480

119 5.4 BSP tree Pseudocode for the construction of a BSP tree Node buildbsptree(o) { // o is set of objects if o.isempty() return null; Node N = new Node(); N.ph = choosepartitioninghyperplane(o); Set fset = new Set(); //to save the objects in front of ph Set bset = new Set(); //to save the objects behind ph for each Object z in o do{ if z is coincident to ph, add z to N.oSet; if z is in front of ph, add z to fset; if z is behind ph, add z to bset; if z spans ph, split z and add pieces to fset and bset; }N.leftChild = buildbsptree(fset); N.rightChild = buildbsptree(bset); return N; } Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 481

120 5.4 BSP tree Determining the position of an object z relative to a split plane g 2-dimensional split line: ax + by + c = 0 Calculate ax + by + c for all points of z f all values < 0 z is in front of g f all values > 0 z is behind g f all values = 0 z lies on g Otherwise z intersects the split line and has to be splitted 4 2 y x split line: 4x 3y +3 = 0 nsert the points of O1 (3,3) (5,2) = =17 Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 482 O2 split line O1

121 5.4 BSP tree Goals for the choice of split planes Balanced tree Avoid splitting of objects Split planes orthogonal to the axes Heuristic to estimate the costs of a split plane Difference between the number of objects in front of and behind the split plane 15 * number of splitted objects 5 if split plane is not orthogonal to one of the axes Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 483

122 5.4 BSP tree A split plane which do not divide any objects is called Free Partition f a part of a boundary of an object which already intersects a BSP region is chosen as a split plane, it is a free partition in respect of that region Under the assumption that there are no intersections between objects object region split line Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 484

123 5.4 BSP tree Application in computer graphics E.g. visibility computation, ray tracing Surfaces on the same side as the observer May cover surfaces on the other side Cannot be covered by surfaces on the other side Determination of the drawing order Back-to-front: background objects are drawn first and are painted over by objects in the foreground 1 wanted: ordering of the objects with respect to their relative distance from the observer Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 485

124 5.4 BSP tree For each node, determine on which side of it the observer lies norder traversal defines the order of the objects 1. Subtree on the opposite side from the observer 2. Node 3. Subtree on the same side as the observer norder traversal on a binary search tree 1. Left subtree 2. Node 3. Right subtree Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 486

125 5.4 BSP tree Example Construction of a BSP tree by a sequence of insertion operations (without application of the heuristic) 3-dimensional objects (upright walls) 0 0 Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 487

126 5.4 BSP tree Example Construction of a BSP tree by a sequence of insertion operations (without application of the heuristic) 3-dimensional objects (upright walls) Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 487

127 5.4 BSP tree Example Construction of a BSP tree by a sequence of insertion operations (without application of the heuristic) 3-dimensional objects (upright walls) Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 487

128 5.4 BSP tree Example Construction of a BSP tree by a sequence of insertion operations (without application of the heuristic) 3-dimensional objects (upright walls) Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 487

129 5.4 BSP tree Example Construction of a BSP tree by a sequence of insertion operations (without application of the heuristic) 3-dimensional objects (upright walls) b 4f 3 2 4b 2 1 4f Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 487

130 5.4 BSP tree Example Construction of a BSP tree by a sequence of insertion operations (without application of the heuristic) 3-dimensional objects (upright walls) b 4f 3 5b 2 5f 4b 2 1 5f 4f 5b Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 487

131 5.4 BSP tree Example Construction of a BSP tree by a sequence of insertion operations (without application of the heuristic) 3-dimensional objects (upright walls) b 4f 3 5b 2 5f 4b 2 1 5f 4f 5b 6f 6b Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 487

132 5.4 BSP tree Example Construction of a BSP tree by a sequence of insertion operations (without application of the heuristic) 3-dimensional objects (upright walls) b 4f 3 5b 2 5f 4b 2 1 5f 6ff 4f 6fb 6b 5b 6ff 6fb 6b Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 487

133 5.4 BSP tree Drawing order: 3, 4b, 5b, 0, 2, 6ff, 4f, 6fb, 1, 5f, 6b 6fb 6ff f 4b 3 Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 488

134 5.5 Grid file Main idea: k-dimensional, dynamic array as index (on disk) ndex contains (except for management information where necessary) only pointers to data pages (buckets) Data is stored in (big) buckets Two disk accesses for exact match queries: ndependent of the distribution of values and the number of stored objects For points only Data-driven partitioning of space Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 489

135 5.5 Grid file Components: K scales S i (with i from 1 to k) define the grid on the k- dimensional data space D Cell or grid directory (GD): dynamic k-dimensional matrix to map D on the buckets Bucket: storage of the points of one or more cells (bucket region BR) data space cell scales S 1 S 2 d 2 grid directory threshold in data space position in GD d 1 buckets Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 490

136 5.5 Grid file Properties 1:1-relation between cells and elements of GD Element of GD = bucket pointer n:1-relation between cells and buckets Cells have to form a rectangle in order to be assigned to the same bucket Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 491

137 5.5 Grid file Exact match query Search the scales (binary search) for the position of the grid cell that covers the point ( no disk access, if the scales fit into find (10.3,52.2) main memory) Read the grid directory to identify the bucket ( 1st disk access) Read the bucket ( 2nd disk access) S , 54.3 Kiel 10.3, 52.2 Braunschweig 11.5, 51.0 Jena 55 4 S Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 492

138 5.5 Grid file nsertion Search for the point to be inserted and if possible put it in the found bucket n case of bucket overflow Add new bucket, update GD f a grid refinement is necessary, update scales Choice of dimension for the grid refinement e.g. alternating or longest interval Choice of split position e.g. middle or local median Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 493

139 5.5 Grid file Example: insertion with bucket overflow without grid refinement d 2 D A E H S F S ADE HG BCF B C G J Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig d 1

140 5.5 Grid file Example: insertion with bucket overflow without grid refinement d 2 D A E H S F S ADE HG BCF V B C G J Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig d 1

141 5.5 Grid file Example: insertion with bucket overflow without grid refinement d 2 D A E H S F S ADE HG JG BCF H V B C G J Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig d 1

142 5.5 Grid file Example: insertion with bucket overflow and grid refinement D d 2 A E H S 1 S ADE 10 C F K H JG BCF V B G J Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig d 1

143 5.5 Grid file Example: insertion with bucket overflow and grid refinement D d 2 A E H S 1 S ADE H JG BCF V V 10 Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 495 B C F 6 G K J d 1

144 5.5 Grid file Example: insertion with bucket overflow and grid refinement D d 2 A E H S 1 S ADE H JG BCF V V 10 5 Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 495 B C F 6 G K J d 1

145 5.5 Grid file Example: insertion with bucket overflow and grid refinement D d 2 A E H S 1 S ADE H JG BCF V V 10 5 Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 495 B C F 6 G K J d 1

146 5.5 Grid file Example: insertion with bucket overflow and grid refinement D d 2 A E H S 1 S ADE H JG BCF V V 10 5 Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 495 B C F 6 G K J d 1

147 5.5 Grid file Example: insertion with bucket overflow and grid refinement D d 2 A E H S 1 S ADE H JG BCF V V 10 5 Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 495 B C F 6 G K J d 1

148 5.5 Grid file Example: insertion with bucket overflow and grid refinement D S 1 S ADE V 2 H 1 JG K 1 2 BCF V d Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 495 A B C E F 6 G K H J d 1

149 5.5 Grid file Deletion Merging of buckets deally the buckets to be merged were split at some earlier point and none of them was split again buddy system With adjacent cells, complex Not always possible Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 496

150 5.6 Summary One-dimensional orderings mpose a linear ordering on multidimensional points Z-order, Hilbert s curve, Gray code Quadtree Point quadtree: construction, range query Region quadtree R-tree Construction Search nsertion, overflow handling R + -tree Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 497

151 5.6 Summary K-d tree Choice of split plane Deletion Bintree BSP tree Data structure Choice of split plane Rendering Grid file nsertion, overflow handling Deletion y 4 2 O2 split line 2 O1 4 6 x Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 498

152 5.6 Summary collect GS visualize manage analyze objects query evaluation geometry indexes vector approximations Spatial Databases and GS Karl Neumann, Sarah Tauscher fis TU Braunschweig 499

5 Spatial Access Methods

5 Spatial Access Methods 5 Spatial Access Methods 5.1 Quadtree 5.2 R-tree 5.3 K-d tree 5.4 BSP tree 3 27 A 17 5 G E 4 7 13 28 B 26 11 J 29 18 K 5.5 Grid file 9 31 8 17 24 28 5.6 Summary D C 21 22 F 15 23 H Spatial Databases and

More information

Wolf-Tilo Balke Silviu Homoceanu Institut für Informationssysteme Technische Universität Braunschweig

Wolf-Tilo Balke Silviu Homoceanu Institut für Informationssysteme Technische Universität Braunschweig Multimedia Databases Wolf-Tilo Balke Silviu Homoceanu Institut für Informationssysteme Technische Universität Braunschweig http://www.ifis.cs.tu-bs.de 13 Indexes for Multimedia Data 13 Indexes for Multimedia

More information

Multimedia Databases 1/29/ Indexes for Multimedia Data Indexes for Multimedia Data Indexes for Multimedia Data

Multimedia Databases 1/29/ Indexes for Multimedia Data Indexes for Multimedia Data Indexes for Multimedia Data 1/29/2010 13 Indexes for Multimedia Data 13 Indexes for Multimedia Data 13.1 R-Trees Multimedia Databases Wolf-Tilo Balke Silviu Homoceanu Institut für Informationssysteme Technische Universität Braunschweig

More information

Advanced Implementations of Tables: Balanced Search Trees and Hashing

Advanced Implementations of Tables: Balanced Search Trees and Hashing Advanced Implementations of Tables: Balanced Search Trees and Hashing Balanced Search Trees Binary search tree operations such as insert, delete, retrieve, etc. depend on the length of the path to the

More information

Carnegie Mellon Univ. Dept. of Computer Science Database Applications. SAMs - Detailed outline. Spatial Access Methods - problem

Carnegie Mellon Univ. Dept. of Computer Science Database Applications. SAMs - Detailed outline. Spatial Access Methods - problem Carnegie Mellon Univ. Dept. of Computer Science 15-415 - Database Applications Lecture #26: Spatial Databases (R&G ch. 28) SAMs - Detailed outline spatial access methods problem dfn R-trees Faloutsos 2

More information

Data Structures and Algorithms " Search Trees!!

Data Structures and Algorithms  Search Trees!! Data Structures and Algorithms " Search Trees!! Outline" Binary Search Trees! AVL Trees! (2,4) Trees! 2 Binary Search Trees! "! < 6 2 > 1 4 = 8 9 Ordered Dictionaries" Keys are assumed to come from a total

More information

SPATIAL DATA MINING. Ms. S. Malathi, Lecturer in Computer Applications, KGiSL - IIM

SPATIAL DATA MINING. Ms. S. Malathi, Lecturer in Computer Applications, KGiSL - IIM SPATIAL DATA MINING Ms. S. Malathi, Lecturer in Computer Applications, KGiSL - IIM INTRODUCTION The main difference between data mining in relational DBS and in spatial DBS is that attributes of the neighbors

More information

Dictionary: an abstract data type

Dictionary: an abstract data type 2-3 Trees 1 Dictionary: an abstract data type A container that maps keys to values Dictionary operations Insert Search Delete Several possible implementations Balanced search trees Hash tables 2 2-3 trees

More information

On multi-scale display of geometric objects

On multi-scale display of geometric objects Data & Knowledge Engineering 40 2002) 91±119 www.elsevier.com/locate/datak On multi-scale display of geometric objects Edward P.F. Chan *, Kevin K.W. Chow Department of Computer Science, University of

More information

Advanced Data Structures

Advanced Data Structures Simon Gog gog@kit.edu - Simon Gog: KIT University of the State of Baden-Wuerttemberg and National Research Center of the Helmholtz Association www.kit.edu Predecessor data structures We want to support

More information

Advanced Data Structures

Advanced Data Structures Simon Gog gog@kit.edu - Simon Gog: KIT The Research University in the Helmholtz Association www.kit.edu Predecessor data structures We want to support the following operations on a set of integers from

More information

LAYERED R-TREE: AN INDEX STRUCTURE FOR THREE DIMENSIONAL POINTS AND LINES

LAYERED R-TREE: AN INDEX STRUCTURE FOR THREE DIMENSIONAL POINTS AND LINES LAYERED R-TREE: AN INDEX STRUCTURE FOR THREE DIMENSIONAL POINTS AND LINES Yong Zhang *, Lizhu Zhou *, Jun Chen ** * Department of Computer Science and Technology, Tsinghua University Beijing, China, 100084

More information

Wolf-Tilo Balke Silviu Homoceanu Institut für Informationssysteme Technische Universität Braunschweig

Wolf-Tilo Balke Silviu Homoceanu Institut für Informationssysteme Technische Universität Braunschweig Multimedia Databases Wolf-Tilo Balke Silviu Homoceanu Institut für Informationssysteme Technische Universität Braunschweig http://www.ifis.cs.tu-bs.de 14 Indexes for Multimedia Data 14 Indexes for Multimedia

More information

Dictionary: an abstract data type

Dictionary: an abstract data type 2-3 Trees 1 Dictionary: an abstract data type A container that maps keys to values Dictionary operations Insert Search Delete Several possible implementations Balanced search trees Hash tables 2 2-3 trees

More information

AVL Trees. Manolis Koubarakis. Data Structures and Programming Techniques

AVL Trees. Manolis Koubarakis. Data Structures and Programming Techniques AVL Trees Manolis Koubarakis 1 AVL Trees We will now introduce AVL trees that have the property that they are kept almost balanced but not completely balanced. In this way we have O(log n) search time

More information

Fundamental Algorithms

Fundamental Algorithms Fundamental Algorithms Chapter 5: Searching Michael Bader Winter 2014/15 Chapter 5: Searching, Winter 2014/15 1 Searching Definition (Search Problem) Input: a sequence or set A of n elements (objects)

More information

Nearest Neighbor Search with Keywords in Spatial Databases

Nearest Neighbor Search with Keywords in Spatial Databases 776 Nearest Neighbor Search with Keywords in Spatial Databases 1 Sphurti S. Sao, 2 Dr. Rahila Sheikh 1 M. Tech Student IV Sem, Dept of CSE, RCERT Chandrapur, MH, India 2 Head of Department, Dept of CSE,

More information

Binary Search Trees. Motivation

Binary Search Trees. Motivation Binary Search Trees Motivation Searching for a particular record in an unordered list takes O(n), too slow for large lists (databases) If the list is ordered, can use an array implementation and use binary

More information

State of the art Image Compression Techniques

State of the art Image Compression Techniques Chapter 4 State of the art Image Compression Techniques In this thesis we focus mainly on the adaption of state of the art wavelet based image compression techniques to programmable hardware. Thus, an

More information

12 Review and Outlook

12 Review and Outlook 12 Review and Outlook 12.1 Review 12.2 Outlook http://www-kdd.isti.cnr.it/nwa Spatial Databases and GIS Karl Neumann, Sarah Tauscher Ifis TU Braunschweig 926 What are the basic functions of a geographic

More information

INF2220: algorithms and data structures Series 1

INF2220: algorithms and data structures Series 1 Universitetet i Oslo Institutt for Informatikk I. Yu, D. Karabeg INF2220: algorithms and data structures Series 1 Topic Function growth & estimation of running time, trees (Exercises with hints for solution)

More information

Data Structures and Algorithms

Data Structures and Algorithms Data Structures and Algorithms Spring 2017-2018 Outline 1 Sorting Algorithms (contd.) Outline Sorting Algorithms (contd.) 1 Sorting Algorithms (contd.) Analysis of Quicksort Time to sort array of length

More information

Efficient Spatial Data Structure for Multiversion Management of Engineering Drawings

Efficient Spatial Data Structure for Multiversion Management of Engineering Drawings Efficient Structure for Multiversion Management of Engineering Drawings Yasuaki Nakamura Department of Computer and Media Technologies, Hiroshima City University Hiroshima, 731-3194, Japan and Hiroyuki

More information

Succinct Data Structures for Approximating Convex Functions with Applications

Succinct Data Structures for Approximating Convex Functions with Applications Succinct Data Structures for Approximating Convex Functions with Applications Prosenjit Bose, 1 Luc Devroye and Pat Morin 1 1 School of Computer Science, Carleton University, Ottawa, Canada, K1S 5B6, {jit,morin}@cs.carleton.ca

More information

SEARCHING THROUGH SPATIAL RELATIONSHIPS USING THE 2DR-TREE

SEARCHING THROUGH SPATIAL RELATIONSHIPS USING THE 2DR-TREE SEARCHING THROUGH SPATIAL RELATIONSHIPS USING THE DR-TREE Wendy Osborn Department of Mathematics and Computer Science University of Lethbridge 0 University Drive W Lethbridge, Alberta, Canada email: wendy.osborn@uleth.ca

More information

Insert Sorted List Insert as the Last element (the First element?) Delete Chaining. 2 Slide courtesy of Dr. Sang-Eon Park

Insert Sorted List Insert as the Last element (the First element?) Delete Chaining. 2 Slide courtesy of Dr. Sang-Eon Park 1617 Preview Data Structure Review COSC COSC Data Structure Review Linked Lists Stacks Queues Linked Lists Singly Linked List Doubly Linked List Typical Functions s Hash Functions Collision Resolution

More information

Spatial Database. Ahmad Alhilal, Dimitris Tsaras

Spatial Database. Ahmad Alhilal, Dimitris Tsaras Spatial Database Ahmad Alhilal, Dimitris Tsaras Content What is Spatial DB Modeling Spatial DB Spatial Queries The R-tree Range Query NN Query Aggregation Query RNN Query NN Queries with Validity Information

More information

ENS Lyon Camp. Day 2. Basic group. Cartesian Tree. 26 October

ENS Lyon Camp. Day 2. Basic group. Cartesian Tree. 26 October ENS Lyon Camp. Day 2. Basic group. Cartesian Tree. 26 October Contents 1 Cartesian Tree. Definition. 1 2 Cartesian Tree. Construction 1 3 Cartesian Tree. Operations. 2 3.1 Split............................................

More information

AN EFFICIENT INDEXING STRUCTURE FOR TRAJECTORIES IN GEOGRAPHICAL INFORMATION SYSTEMS SOWJANYA SUNKARA

AN EFFICIENT INDEXING STRUCTURE FOR TRAJECTORIES IN GEOGRAPHICAL INFORMATION SYSTEMS SOWJANYA SUNKARA AN EFFICIENT INDEXING STRUCTURE FOR TRAJECTORIES IN GEOGRAPHICAL INFORMATION SYSTEMS By SOWJANYA SUNKARA Bachelor of Science (Engineering) in Computer Science University of Madras Chennai, TamilNadu, India

More information

Optimal Color Range Reporting in One Dimension

Optimal Color Range Reporting in One Dimension Optimal Color Range Reporting in One Dimension Yakov Nekrich 1 and Jeffrey Scott Vitter 1 The University of Kansas. yakov.nekrich@googlemail.com, jsv@ku.edu Abstract. Color (or categorical) range reporting

More information

Multiple-Site Distributed Spatial Query Optimization using Spatial Semijoins

Multiple-Site Distributed Spatial Query Optimization using Spatial Semijoins 11 Multiple-Site Distributed Spatial Query Optimization using Spatial Semijoins Wendy OSBORN a, 1 and Saad ZAAMOUT a a Department of Mathematics and Computer Science, University of Lethbridge, Lethbridge,

More information

Alpha-Beta Pruning: Algorithm and Analysis

Alpha-Beta Pruning: Algorithm and Analysis Alpha-Beta Pruning: Algorithm and Analysis Tsan-sheng Hsu tshsu@iis.sinica.edu.tw http://www.iis.sinica.edu.tw/~tshsu 1 Introduction Alpha-beta pruning is the standard searching procedure used for 2-person

More information

Biased Quantiles. Flip Korn Graham Cormode S. Muthukrishnan

Biased Quantiles. Flip Korn Graham Cormode S. Muthukrishnan Biased Quantiles Graham Cormode cormode@bell-labs.com S. Muthukrishnan muthu@cs.rutgers.edu Flip Korn flip@research.att.com Divesh Srivastava divesh@research.att.com Quantiles Quantiles summarize data

More information

SPATIAL INDEXING. Vaibhav Bajpai

SPATIAL INDEXING. Vaibhav Bajpai SPATIAL INDEXING Vaibhav Bajpai Contents Overview Problem with B+ Trees in Spatial Domain Requirements from a Spatial Indexing Structure Approaches SQL/MM Standard Current Issues Overview What is a Spatial

More information

Chapter 5 Data Structures Algorithm Theory WS 2017/18 Fabian Kuhn

Chapter 5 Data Structures Algorithm Theory WS 2017/18 Fabian Kuhn Chapter 5 Data Structures Algorithm Theory WS 2017/18 Fabian Kuhn Priority Queue / Heap Stores (key,data) pairs (like dictionary) But, different set of operations: Initialize-Heap: creates new empty heap

More information

B- TREE. Michael Tsai 2017/06/06

B- TREE. Michael Tsai 2017/06/06 B- TREE Michael Tsai 2017/06/06 2 B- Tree Overview Balanced search tree Very large branching factor Height = O(log n), but much less than that of RB tree Usage: Large amount of data to be stored - - Partially

More information

Alpha-Beta Pruning: Algorithm and Analysis

Alpha-Beta Pruning: Algorithm and Analysis Alpha-Beta Pruning: Algorithm and Analysis Tsan-sheng Hsu tshsu@iis.sinica.edu.tw http://www.iis.sinica.edu.tw/~tshsu 1 Introduction Alpha-beta pruning is the standard searching procedure used for 2-person

More information

Randomized Sorting Algorithms Quick sort can be converted to a randomized algorithm by picking the pivot element randomly. In this case we can show th

Randomized Sorting Algorithms Quick sort can be converted to a randomized algorithm by picking the pivot element randomly. In this case we can show th CSE 3500 Algorithms and Complexity Fall 2016 Lecture 10: September 29, 2016 Quick sort: Average Run Time In the last lecture we started analyzing the expected run time of quick sort. Let X = k 1, k 2,...,

More information

16. Binary Search Trees. [Ottman/Widmayer, Kap. 5.1, Cormen et al, Kap ]

16. Binary Search Trees. [Ottman/Widmayer, Kap. 5.1, Cormen et al, Kap ] 418 16. Binary Search Trees [Ottman/Widmayer, Kap. 5.1, Cormen et al, Kap. 12.1-12.3] 419 Dictionary implementation Hashing: implementation of dictionaries with expected very fast access times. Disadvantages

More information

Math Models of OR: Branch-and-Bound

Math Models of OR: Branch-and-Bound Math Models of OR: Branch-and-Bound John E. Mitchell Department of Mathematical Sciences RPI, Troy, NY 12180 USA November 2018 Mitchell Branch-and-Bound 1 / 15 Branch-and-Bound Outline 1 Branch-and-Bound

More information

Analysis of Algorithms. Outline 1 Introduction Basic Definitions Ordered Trees. Fibonacci Heaps. Andres Mendez-Vazquez. October 29, Notes.

Analysis of Algorithms. Outline 1 Introduction Basic Definitions Ordered Trees. Fibonacci Heaps. Andres Mendez-Vazquez. October 29, Notes. Analysis of Algorithms Fibonacci Heaps Andres Mendez-Vazquez October 29, 2015 1 / 119 Outline 1 Introduction Basic Definitions Ordered Trees 2 Binomial Trees Example 3 Fibonacci Heap Operations Fibonacci

More information

16. Binary Search Trees. [Ottman/Widmayer, Kap. 5.1, Cormen et al, Kap ]

16. Binary Search Trees. [Ottman/Widmayer, Kap. 5.1, Cormen et al, Kap ] 423 16. Binary Search Trees [Ottman/Widmayer, Kap. 5.1, Cormen et al, Kap. 12.1-12.3] Dictionary implementation 424 Hashing: implementation of dictionaries with expected very fast access times. Disadvantages

More information

Each internal node v with d(v) children stores d 1 keys. k i 1 < key in i-th sub-tree k i, where we use k 0 = and k d =.

Each internal node v with d(v) children stores d 1 keys. k i 1 < key in i-th sub-tree k i, where we use k 0 = and k d =. 7.5 (a, b)-trees 7.5 (a, b)-trees Definition For b a an (a, b)-tree is a search tree with the following properties. all leaves have the same distance to the root. every internal non-root vertex v has at

More information

Data Mining Classification: Basic Concepts and Techniques. Lecture Notes for Chapter 3. Introduction to Data Mining, 2nd Edition

Data Mining Classification: Basic Concepts and Techniques. Lecture Notes for Chapter 3. Introduction to Data Mining, 2nd Edition Data Mining Classification: Basic Concepts and Techniques Lecture Notes for Chapter 3 by Tan, Steinbach, Karpatne, Kumar 1 Classification: Definition Given a collection of records (training set ) Each

More information

data structures and algorithms lecture 2

data structures and algorithms lecture 2 data structures and algorithms 2018 09 06 lecture 2 recall: insertion sort Algorithm insertionsort(a, n): for j := 2 to n do key := A[j] i := j 1 while i 1 and A[i] > key do A[i + 1] := A[i] i := i 1 A[i

More information

1 Probability Review. CS 124 Section #8 Hashing, Skip Lists 3/20/17. Expectation (weighted average): the expectation of a random quantity X is:

1 Probability Review. CS 124 Section #8 Hashing, Skip Lists 3/20/17. Expectation (weighted average): the expectation of a random quantity X is: CS 24 Section #8 Hashing, Skip Lists 3/20/7 Probability Review Expectation (weighted average): the expectation of a random quantity X is: x= x P (X = x) For each value x that X can take on, we look at

More information

Alpha-Beta Pruning: Algorithm and Analysis

Alpha-Beta Pruning: Algorithm and Analysis Alpha-Beta Pruning: Algorithm and Analysis Tsan-sheng Hsu tshsu@iis.sinica.edu.tw http://www.iis.sinica.edu.tw/~tshsu 1 Introduction Alpha-beta pruning is the standard searching procedure used for solving

More information

Erik G. Hoel. Hanan Samet. Center for Automation Research. University of Maryland. November 7, Abstract

Erik G. Hoel. Hanan Samet. Center for Automation Research. University of Maryland. November 7, Abstract Proc. of the 21st Intl. Conf. onvery Large Data Bases, Zurich, Sept. 1995, pp. 606{618 Benchmarking Spatial Join Operations with Spatial Output Erik G. Hoel Hanan Samet Computer Science Department Center

More information

Lower Bounds for Dynamic Connectivity (2004; Pǎtraşcu, Demaine)

Lower Bounds for Dynamic Connectivity (2004; Pǎtraşcu, Demaine) Lower Bounds for Dynamic Connectivity (2004; Pǎtraşcu, Demaine) Mihai Pǎtraşcu, MIT, web.mit.edu/ mip/www/ Index terms: partial-sums problem, prefix sums, dynamic lower bounds Synonyms: dynamic trees 1

More information

8 Priority Queues. 8 Priority Queues. Prim s Minimum Spanning Tree Algorithm. Dijkstra s Shortest Path Algorithm

8 Priority Queues. 8 Priority Queues. Prim s Minimum Spanning Tree Algorithm. Dijkstra s Shortest Path Algorithm 8 Priority Queues 8 Priority Queues A Priority Queue S is a dynamic set data structure that supports the following operations: S. build(x 1,..., x n ): Creates a data-structure that contains just the elements

More information

Algorithms for Scientific Computing

Algorithms for Scientific Computing Algorithms for Scientific Computing Parallelization using Space-Filling Curves Michael Bader Technical University of Munich Summer 2016 Parallelisation using Space-filling Curves Problem setting: mesh

More information

The Fast Optimal Voltage Partitioning Algorithm For Peak Power Density Minimization

The Fast Optimal Voltage Partitioning Algorithm For Peak Power Density Minimization The Fast Optimal Voltage Partitioning Algorithm For Peak Power Density Minimization Jia Wang, Shiyan Hu Department of Electrical and Computer Engineering Michigan Technological University Houghton, Michigan

More information

Dynamic Ordered Sets with Exponential Search Trees

Dynamic Ordered Sets with Exponential Search Trees Dynamic Ordered Sets with Exponential Search Trees Arne Andersson Computing Science Department Information Technology, Uppsala University Box 311, SE - 751 05 Uppsala, Sweden arnea@csd.uu.se http://www.csd.uu.se/

More information

CS6375: Machine Learning Gautam Kunapuli. Decision Trees

CS6375: Machine Learning Gautam Kunapuli. Decision Trees Gautam Kunapuli Example: Restaurant Recommendation Example: Develop a model to recommend restaurants to users depending on their past dining experiences. Here, the features are cost (x ) and the user s

More information

HW #4. (mostly by) Salim Sarımurat. 1) Insert 6 2) Insert 8 3) Insert 30. 4) Insert S a.

HW #4. (mostly by) Salim Sarımurat. 1) Insert 6 2) Insert 8 3) Insert 30. 4) Insert S a. HW #4 (mostly by) Salim Sarımurat 04.12.2009 S. 1. 1. a. 1) Insert 6 2) Insert 8 3) Insert 30 4) Insert 40 2 5) Insert 50 6) Insert 61 7) Insert 70 1. b. 1) Insert 12 2) Insert 29 3) Insert 30 4) Insert

More information

A Deterministic Algorithm for Summarizing Asynchronous Streams over a Sliding Window

A Deterministic Algorithm for Summarizing Asynchronous Streams over a Sliding Window A Deterministic Algorithm for Summarizing Asynchronous Streams over a Sliding Window Costas Busch 1 and Srikanta Tirthapura 2 1 Department of Computer Science Rensselaer Polytechnic Institute, Troy, NY

More information

Graphs and Trees Binary Search Trees AVL-Trees (a,b)-trees Splay-Trees. Search Trees. Tobias Lieber. April 14, 2008

Graphs and Trees Binary Search Trees AVL-Trees (a,b)-trees Splay-Trees. Search Trees. Tobias Lieber. April 14, 2008 Search Trees Tobias Lieber April 14, 2008 Tobias Lieber Search Trees April 14, 2008 1 / 57 Graphs and Trees Binary Search Trees AVL-Trees (a,b)-trees Splay-Trees Tobias Lieber Search Trees April 14, 2008

More information

Skylines. Yufei Tao. ITEE University of Queensland. INFS4205/7205, Uni of Queensland

Skylines. Yufei Tao. ITEE University of Queensland. INFS4205/7205, Uni of Queensland Yufei Tao ITEE University of Queensland Today we will discuss problems closely related to the topic of multi-criteria optimization, where one aims to identify objects that strike a good balance often optimal

More information

Online Sorted Range Reporting and Approximating the Mode

Online Sorted Range Reporting and Approximating the Mode Online Sorted Range Reporting and Approximating the Mode Mark Greve Progress Report Department of Computer Science Aarhus University Denmark January 4, 2010 Supervisor: Gerth Stølting Brodal Online Sorted

More information

Fast Sorting and Selection. A Lower Bound for Worst Case

Fast Sorting and Selection. A Lower Bound for Worst Case Presentation for use with the textbook, Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 0 Fast Sorting and Selection USGS NEIC. Public domain government image. A Lower Bound

More information

CS 273 Prof. Serafim Batzoglou Prof. Jean-Claude Latombe Spring Lecture 12 : Energy maintenance (1) Lecturer: Prof. J.C.

CS 273 Prof. Serafim Batzoglou Prof. Jean-Claude Latombe Spring Lecture 12 : Energy maintenance (1) Lecturer: Prof. J.C. CS 273 Prof. Serafim Batzoglou Prof. Jean-Claude Latombe Spring 2006 Lecture 12 : Energy maintenance (1) Lecturer: Prof. J.C. Latombe Scribe: Neda Nategh How do you update the energy function during the

More information

T U M I N S T I T U T F Ü R I N F O R M A T I K. Binary Search on Two-Dimensional Data. Riko Jacob

T U M I N S T I T U T F Ü R I N F O R M A T I K. Binary Search on Two-Dimensional Data. Riko Jacob T U M I N S T I T U T F Ü R I N F O R M A T I K Binary Search on Two-Dimensional Data Riko Jacob ABCDE FGHIJ KLMNO TUM-I08 21 Juni 08 T E C H N I S C H E U N I V E R S I T Ä T M Ü N C H E N TUM-INFO-06-I0821-0/1.-FI

More information

Data Structures in Java

Data Structures in Java Data Structures in Java Lecture 20: Algorithm Design Techniques 12/2/2015 Daniel Bauer 1 Algorithms and Problem Solving Purpose of algorithms: find solutions to problems. Data Structures provide ways of

More information

Binary Search Trees. Lecture 29 Section Robb T. Koether. Hampden-Sydney College. Fri, Apr 8, 2016

Binary Search Trees. Lecture 29 Section Robb T. Koether. Hampden-Sydney College. Fri, Apr 8, 2016 Binary Search Trees Lecture 29 Section 19.2 Robb T. Koether Hampden-Sydney College Fri, Apr 8, 2016 Robb T. Koether (Hampden-Sydney College) Binary Search Trees Fri, Apr 8, 2016 1 / 40 1 Binary Search

More information

CS Data Structures and Algorithm Analysis

CS Data Structures and Algorithm Analysis CS 483 - Data Structures and Algorithm Analysis Lecture VII: Chapter 6, part 2 R. Paul Wiegand George Mason University, Department of Computer Science March 22, 2006 Outline 1 Balanced Trees 2 Heaps &

More information

Lecture 4: Divide and Conquer: van Emde Boas Trees

Lecture 4: Divide and Conquer: van Emde Boas Trees Lecture 4: Divide and Conquer: van Emde Boas Trees Series of Improved Data Structures Insert, Successor Delete Space This lecture is based on personal communication with Michael Bender, 001. Goal We want

More information

arxiv: v2 [cs.ds] 3 Oct 2017

arxiv: v2 [cs.ds] 3 Oct 2017 Orthogonal Vectors Indexing Isaac Goldstein 1, Moshe Lewenstein 1, and Ely Porat 1 1 Bar-Ilan University, Ramat Gan, Israel {goldshi,moshe,porately}@cs.biu.ac.il arxiv:1710.00586v2 [cs.ds] 3 Oct 2017 Abstract

More information

25. Minimum Spanning Trees

25. Minimum Spanning Trees 695 25. Minimum Spanning Trees Motivation, Greedy, Algorithm Kruskal, General Rules, ADT Union-Find, Algorithm Jarnik, Prim, Dijkstra, Fibonacci Heaps [Ottman/Widmayer, Kap. 9.6, 6.2, 6.1, Cormen et al,

More information

25. Minimum Spanning Trees

25. Minimum Spanning Trees Problem Given: Undirected, weighted, connected graph G = (V, E, c). 5. Minimum Spanning Trees Motivation, Greedy, Algorithm Kruskal, General Rules, ADT Union-Find, Algorithm Jarnik, Prim, Dijkstra, Fibonacci

More information

D B M G Data Base and Data Mining Group of Politecnico di Torino

D B M G Data Base and Data Mining Group of Politecnico di Torino Data Base and Data Mining Group of Politecnico di Torino Politecnico di Torino Association rules Objective extraction of frequent correlations or pattern from a transactional database Tickets at a supermarket

More information

Exam 1. March 12th, CS525 - Midterm Exam Solutions

Exam 1. March 12th, CS525 - Midterm Exam Solutions Name CWID Exam 1 March 12th, 2014 CS525 - Midterm Exam s Please leave this empty! 1 2 3 4 5 Sum Things that you are not allowed to use Personal notes Textbook Printed lecture notes Phone The exam is 90

More information

Decision Tree Learning Lecture 2

Decision Tree Learning Lecture 2 Machine Learning Coms-4771 Decision Tree Learning Lecture 2 January 28, 2008 Two Types of Supervised Learning Problems (recap) Feature (input) space X, label (output) space Y. Unknown distribution D over

More information

An efficient 3D R-tree spatial index method for virtual geographic environments

An efficient 3D R-tree spatial index method for virtual geographic environments ISPRS Journal of Photogrammetry & Remote Sensing 62 (2007) 217 224 www.elsevier.com/locate/isprsjprs An efficient 3D R-tree spatial index method for virtual geographic environments Qing Zhu a,, Jun Gong

More information

past balancing schemes require maintenance of balance info at all times, are aggresive use work of searches to pay for work of rebalancing

past balancing schemes require maintenance of balance info at all times, are aggresive use work of searches to pay for work of rebalancing 1 Splay Trees Sleator and Tarjan, Self Adjusting Binary Search Trees JACM 32(3) 1985 The claim planning ahead. But matches previous idea of being lazy, letting potential build up, using it to pay for expensive

More information

CSE 417T: Introduction to Machine Learning. Final Review. Henry Chai 12/4/18

CSE 417T: Introduction to Machine Learning. Final Review. Henry Chai 12/4/18 CSE 417T: Introduction to Machine Learning Final Review Henry Chai 12/4/18 Overfitting Overfitting is fitting the training data more than is warranted Fitting noise rather than signal 2 Estimating! "#$

More information

Association Rules. Fundamentals

Association Rules. Fundamentals Politecnico di Torino Politecnico di Torino 1 Association rules Objective extraction of frequent correlations or pattern from a transactional database Tickets at a supermarket counter Association rule

More information

The Complexity of Constructing Evolutionary Trees Using Experiments

The Complexity of Constructing Evolutionary Trees Using Experiments The Complexity of Constructing Evolutionary Trees Using Experiments Gerth Stlting Brodal 1,, Rolf Fagerberg 1,, Christian N. S. Pedersen 1,, and Anna Östlin2, 1 BRICS, Department of Computer Science, University

More information

Outline. 1 Merging. 2 Merge Sort. 3 Complexity of Sorting. 4 Merge Sort and Other Sorts 2 / 10

Outline. 1 Merging. 2 Merge Sort. 3 Complexity of Sorting. 4 Merge Sort and Other Sorts 2 / 10 Merge Sort 1 / 10 Outline 1 Merging 2 Merge Sort 3 Complexity of Sorting 4 Merge Sort and Other Sorts 2 / 10 Merging Merge sort is based on a simple operation known as merging: combining two ordered arrays

More information

D B M G. Association Rules. Fundamentals. Fundamentals. Elena Baralis, Silvia Chiusano. Politecnico di Torino 1. Definitions.

D B M G. Association Rules. Fundamentals. Fundamentals. Elena Baralis, Silvia Chiusano. Politecnico di Torino 1. Definitions. Definitions Data Base and Data Mining Group of Politecnico di Torino Politecnico di Torino Itemset is a set including one or more items Example: {Beer, Diapers} k-itemset is an itemset that contains k

More information

D B M G. Association Rules. Fundamentals. Fundamentals. Association rules. Association rule mining. Definitions. Rule quality metrics: example

D B M G. Association Rules. Fundamentals. Fundamentals. Association rules. Association rule mining. Definitions. Rule quality metrics: example Association rules Data Base and Data Mining Group of Politecnico di Torino Politecnico di Torino Objective extraction of frequent correlations or pattern from a transactional database Tickets at a supermarket

More information

Search Trees. EECS 2011 Prof. J. Elder Last Updated: 24 March 2015

Search Trees. EECS 2011 Prof. J. Elder Last Updated: 24 March 2015 Search Trees < 6 2 > 1 4 = 8 9-1 - Outline Ø Binary Search Trees Ø AVL Trees Ø Splay Trees - 2 - Learning Outcomes Ø From this lecture, you should be able to: q Define the properties of a binary search

More information

Problem. Problem Given a dictionary and a word. Which page (if any) contains the given word? 3 / 26

Problem. Problem Given a dictionary and a word. Which page (if any) contains the given word? 3 / 26 Binary Search Introduction Problem Problem Given a dictionary and a word. Which page (if any) contains the given word? 3 / 26 Strategy 1: Random Search Randomly select a page until the page containing

More information

Premaster Course Algorithms 1 Chapter 3: Elementary Data Structures

Premaster Course Algorithms 1 Chapter 3: Elementary Data Structures Premaster Course Algorithms 1 Chapter 3: Elementary Data Structures Christian Scheideler SS 2018 23.04.2018 Chapter 3 1 Overview Basic data structures Search structures (successor searching) Dictionaries

More information

Decision Trees (Cont.)

Decision Trees (Cont.) Decision Trees (Cont.) R&N Chapter 18.2,18.3 Side example with discrete (categorical) attributes: Predicting age (3 values: less than 30, 30-45, more than 45 yrs old) from census data. Attributes (split

More information

RESEARCH ON THE DISTRIBUTED PARALLEL SPATIAL INDEXING SCHEMA BASED ON R-TREE

RESEARCH ON THE DISTRIBUTED PARALLEL SPATIAL INDEXING SCHEMA BASED ON R-TREE RESEARCH ON THE DISTRIBUTED PARALLEL SPATIAL INDEXING SCHEMA BASED ON R-TREE Yuan-chun Zhao a, b, Cheng-ming Li b a. Shandong University of Science and Technology, Qingdao 266510 b. Chinese Academy of

More information

Search and Lookahead. Bernhard Nebel, Julien Hué, and Stefan Wölfl. June 4/6, 2012

Search and Lookahead. Bernhard Nebel, Julien Hué, and Stefan Wölfl. June 4/6, 2012 Search and Lookahead Bernhard Nebel, Julien Hué, and Stefan Wölfl Albert-Ludwigs-Universität Freiburg June 4/6, 2012 Search and Lookahead Enforcing consistency is one way of solving constraint networks:

More information

CSE 4502/5717 Big Data Analytics Spring 2018; Homework 1 Solutions

CSE 4502/5717 Big Data Analytics Spring 2018; Homework 1 Solutions CSE 502/5717 Big Data Analytics Spring 2018; Homework 1 Solutions 1. Consider the following algorithm: for i := 1 to α n log e n do Pick a random j [1, n]; If a[j] = a[j + 1] or a[j] = a[j 1] then output:

More information

Principles of AI Planning

Principles of AI Planning Principles of 5. Planning as search: progression and regression Malte Helmert and Bernhard Nebel Albert-Ludwigs-Universität Freiburg May 4th, 2010 Planning as (classical) search Introduction Classification

More information

Review Of Topics. Review: Induction

Review Of Topics. Review: Induction Review Of Topics Asymptotic notation Solving recurrences Sorting algorithms Insertion sort Merge sort Heap sort Quick sort Counting sort Radix sort Medians/order statistics Randomized algorithm Worst-case

More information

CS60007 Algorithm Design and Analysis 2018 Assignment 1

CS60007 Algorithm Design and Analysis 2018 Assignment 1 CS60007 Algorithm Design and Analysis 2018 Assignment 1 Palash Dey and Swagato Sanyal Indian Institute of Technology, Kharagpur Please submit the solutions of the problems 6, 11, 12 and 13 (written in

More information

Correlated subqueries. Query Optimization. Magic decorrelation. COUNT bug. Magic example (slide 2) Magic example (slide 1)

Correlated subqueries. Query Optimization. Magic decorrelation. COUNT bug. Magic example (slide 2) Magic example (slide 1) Correlated subqueries Query Optimization CPS Advanced Database Systems SELECT CID FROM Course Executing correlated subquery is expensive The subquery is evaluated once for every CPS course Decorrelate!

More information

Jeffrey D. Ullman Stanford University

Jeffrey D. Ullman Stanford University Jeffrey D. Ullman Stanford University 3 We are given a set of training examples, consisting of input-output pairs (x,y), where: 1. x is an item of the type we want to evaluate. 2. y is the value of some

More information

Lecture 18 April 26, 2012

Lecture 18 April 26, 2012 6.851: Advanced Data Structures Spring 2012 Prof. Erik Demaine Lecture 18 April 26, 2012 1 Overview In the last lecture we introduced the concept of implicit, succinct, and compact data structures, and

More information

Decision Trees. Lewis Fishgold. (Material in these slides adapted from Ray Mooney's slides on Decision Trees)

Decision Trees. Lewis Fishgold. (Material in these slides adapted from Ray Mooney's slides on Decision Trees) Decision Trees Lewis Fishgold (Material in these slides adapted from Ray Mooney's slides on Decision Trees) Classification using Decision Trees Nodes test features, there is one branch for each value of

More information

Scout and NegaScout. Tsan-sheng Hsu.

Scout and NegaScout. Tsan-sheng Hsu. Scout and NegaScout Tsan-sheng Hsu tshsu@iis.sinica.edu.tw http://www.iis.sinica.edu.tw/~tshsu 1 Abstract It looks like alpha-beta pruning is the best we can do for an exact generic searching procedure.

More information

Problem: Data base too big to fit memory Disk reads are slow. Example: 1,000,000 records on disk Binary search might take 20 disk reads

Problem: Data base too big to fit memory Disk reads are slow. Example: 1,000,000 records on disk Binary search might take 20 disk reads B Trees Problem: Data base too big to fit memory Disk reads are slow Example: 1,000,000 records on disk Binary search might take 20 disk reads Disk reads are done in blocks Example: One block read can

More information

Fibonacci Heaps These lecture slides are adapted from CLRS, Chapter 20.

Fibonacci Heaps These lecture slides are adapted from CLRS, Chapter 20. Fibonacci Heaps These lecture slides are adapted from CLRS, Chapter 20. Princeton University COS 4 Theory of Algorithms Spring 2002 Kevin Wayne Priority Queues Operation mae-heap insert find- delete- union

More information

CS361 Homework #3 Solutions

CS361 Homework #3 Solutions CS6 Homework # Solutions. Suppose I have a hash table with 5 locations. I would like to know how many items I can store in it before it becomes fairly likely that I have a collision, i.e., that two items

More information

Assignment 5: Solutions

Assignment 5: Solutions Comp 21: Algorithms and Data Structures Assignment : Solutions 1. Heaps. (a) First we remove the minimum key 1 (which we know is located at the root of the heap). We then replace it by the key in the position

More information

CS 6375 Machine Learning

CS 6375 Machine Learning CS 6375 Machine Learning Decision Trees Instructor: Yang Liu 1 Supervised Classifier X 1 X 2. X M Ref class label 2 1 Three variables: Attribute 1: Hair = {blond, dark} Attribute 2: Height = {tall, short}

More information