Quad Trees By JJ Shepherd. Introduction So far we’ve only used binary trees to solve problems – Sort data – Search data – Confuse students Trees are not.

Slides:



Advertisements
Similar presentations
Definitions and Bottom-Up Insertion
Advertisements

COL 106 Shweta Agrawal and Amit Kumar
Heaps1 Part-D2 Heaps Heaps2 Recall Priority Queue ADT (§ 7.1.3) A priority queue stores a collection of entries Each entry is a pair (key, value)
Trees Types and Operations
Chapter 14 Multi-Way Search Trees
Chapter 23 Multi-Way Search Trees. Chapter Scope Examine 2-3 and 2-4 trees Introduce the concept of a B-tree Example specialized implementations of B-trees.
Space Partitioning for Broad Sweep Collision Detection Part 2 - Quadtrees Game Design Experience Professor Jim Whitehead February 13, 2009 Creative Commons.
2-dimensional indexing structure
6/14/2015 6:48 AM(2,4) Trees /14/2015 6:48 AM(2,4) Trees2 Outline and Reading Multi-way search tree (§3.3.1) Definition Search (2,4)
Advanced Tree Data Structures Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
1 Red-Black Trees. 2 Black-Height of the tree = 4.
Trees and Red-Black Trees Gordon College Prof. Brinton.
©Silberschatz, Korth and Sudarshan12.1Database System Concepts Chapter 12: Part B Part A:  Index Definition in SQL  Ordered Indices  Index Sequential.
1 Database indices Database Systems manage very large amounts of data. –Examples: student database for NWU Social Security database To facilitate queries,
Multi-Way search Trees Trees: a. Nodes may contain 1 or 2 items. b. A node with k items has k + 1 children c. All leaves are on same level.
R-Trees 2-dimensional indexing structure. R-trees 2-dimensional version of the B-tree: B-tree of maximum degree 8; degree between 3 and 8 Internal nodes.
Heapsort Based off slides by: David Matuszek
1 Multiway trees & B trees & 2_4 trees Go&Ta Chap 10.
B+ Tree What is a B+ Tree Searching Insertion Deletion.
B-Tree. B-Trees a specialized multi-way tree designed especially for use on disk In a B-tree each node may contain a large number of keys. The number.
Types of Binary Trees Introduction. Types of Binary Trees There are several types of binary trees possible each with its own properties. Few important.
©Silberschatz, Korth and Sudarshan12.1Database System Concepts B + -Tree Index Files Indexing mechanisms used to speed up access to desired data.  E.g.,
Min Chen School of Computer Science and Engineering Seoul National University Data Structure: Chapter 7.
Balanced Search Trees Chapter 27 Copyright ©2012 by Pearson Education, Inc. All rights reserved.
Data Structure & Algorithm II.  Delete-min  Building a heap in O(n) time  Heap Sort.
Analysis of Red-Black Tree Because of the rules of the Red-Black tree, its height is at most 2log(N + 1). Meaning that it is a balanced tree Time Analysis:
PRESENTED BY – GAURANGI TILAK SHASHANK AGARWAL Collision Detection.
CSED101 INTRODUCTION TO COMPUTING TREE 2 Hwanjo Yu.
CSC 213 Lecture 8: (2,4) Trees. Review of Last Lecture Binary Search Tree – plain and tall No balancing, no splaying, no speed AVL Tree – liberté, égalité,
Basic Search Procedure 1. Start with the start node (root of the search tree) and place in on the queue 2. Remove the front node in the queue and If the.
Discrete Mathematics Chapter 5 Trees.
Adding Integers on a Number Line
H EAPS. T WO KINDS OF HEAPS : MAX AND MIN Max: Every child is smaller than its parent Meaning the max is the root of the tree 10 / \ 9 7 / \ 6 8 / \ 2.
Spatial Indexing Techniques Introduction to Spatial Computing CSE 5ISC Some slides adapted from Spatial Databases: A Tour by Shashi Shekhar Prentice Hall.
Lecture 8 : Priority Queue Bong-Soo Sohn Assistant Professor School of Computer Science and Engineering Chung-Ang University.
AVL trees1 AVL Trees Height of a node : The height of a leaf is 1. The height of a null pointer is zero. The height of an internal node is the maximum.
1 More Trees Trees, Red-Black Trees, B Trees.
Red-Black Tree Insertion Start with binary search insertion, coloring the new node red NIL l Insert 18 NIL l NIL l 1315 NIL l
CS 367 Introduction to Data Structures Lecture 8.
1 Chapter 6 Heapsort. 2 About this lecture Introduce Heap – Shape Property and Heap Property – Heap Operations Heapsort: Use Heap to Sort Fixing heap.
Trees By JJ Shepherd. Introduction Last time we discussed searching and sorting in a more efficient way Divide and Conquer – Binary Search – Merge Sort.
Chapter 11 Indexing And Hashing (1) Yonsei University 1 st Semester, 2016 Sanghyun Park.
Tree Representation and Terminology Binary Trees Binary Search Trees Pointer-Based Representation of a Binary Tree Array-Based Representation of a Binary.
Definitions and Bottom-Up Insertion
AA Trees.
File Organization and Processing Week 3
G64ADS Advanced Data Structures
Binary search tree. Removing a node
Priority Queues and Heaps
SNS COLLEGE OF TECHNOLOGY (Autonomous ) COIMBATORE-35
Section 8.1 Trees.
Priority Queues Linked-list Insert Æ Æ head head
Data Structures: Segment Trees, Fenwick Trees
Wednesday, April 18, 2018 Announcements… For Today…
Trees Part 2!!! By JJ Shepherd.
Multi-Way Search Trees
Quadtrees 1.
Tree Representation Heap.
Trees & Forests D. J. Foreman.
Data Structures and Algorithms
Forests D. J. Foreman.
2-3-4 Trees Red-Black Trees
Chapter 11 Indexing And Hashing (1)
(edited by Nadia Al-Ghreimil)
Lecture 9: Self Balancing Trees
Chapter 20: Binary Trees.
Heaps By JJ Shepherd.
Binary Trees.
Chapter 11 Trees © 2011 Pearson Addison-Wesley. All rights reserved.
Heaps.
Presentation transcript:

Quad Trees By JJ Shepherd

Introduction So far we’ve only used binary trees to solve problems – Sort data – Search data – Confuse students Trees are not just limited to having two children

Introduction Multi-way (M-way) trees are useful in different applications They are not limited to just having two children

Quad Trees A quad tree is defined as a tree for each node it has four children This type of tree can be used for subdividing 2D spaces into smaller regions

Quad Trees Generally when a quad tree is used for 2D spatial decomposition it has these properties – Has 4 children – If it is dynamic then each node has a “bucket” and when that bucket’s max value is reach it splits – Otherwise it is static and the tree is fixed in size and the “bucket” is sizable – Each node corresponds to a smaller decomposition of it’s parent

Quad Trees When a new value is added – Check to see if it is fully contained in the node’s region – If it is then check to see if it is fully contained in its children – If it is fully contain in a child’s region repeat this process – Otherwise add this data into the current node’s bucket

Quad Trees Each child in this demo goes in order Top Left, Top Right, Bottom Left, Bottom Right

Quad Trees Each child in this demo goes in order Top Left, Top Right, Bottom Left, Bottom Right

Quad Trees Each child in this demo goes in order Top Left, Top Right, Bottom Left, Bottom Right

Quad Trees Add this circle

Quad Trees Is it contained in the root? YES! Check the children

Quad Trees The node is fully contained in the Top Left Node now check its children

Quad Trees The node is fully contained in the Top Left Node since there are no children insert into bucket

Quad Trees What about an object that straddles a line?

Quad Trees The object is contained in the root so check the children

Quad Trees The object is contained in the bottom right child so check the children

Quad Trees Since it wasn’t fully contained in any of the children insert into this bucket

Quad Trees This structure is great for – Collision detection – Graphics – Path finding

Oct Trees Adding another dimension the same structure then becomes an oct tree Great for all of the above but now in 3D