Radial basis function network ppt bySheetal,Samreen and Dhanashrisheetal katkar
Radial Basis Functions are nonlinear activation functions used by artificial neural networks.Explained commonly used RBFs ,cover's theorem,interpolation problem and learning strategies.
Artificial neural network for machine learninggrinu
An Artificial Neurol Network (ANN) is a computational model. It is based on the structure and functions of biological neural networks. It works like the way human brain processes information. ANN includes a large number of connected processing units that work together to process information. They also generate meaningful results from it.
Radial basis function network ppt bySheetal,Samreen and Dhanashrisheetal katkar
Radial Basis Functions are nonlinear activation functions used by artificial neural networks.Explained commonly used RBFs ,cover's theorem,interpolation problem and learning strategies.
Artificial neural network for machine learninggrinu
An Artificial Neurol Network (ANN) is a computational model. It is based on the structure and functions of biological neural networks. It works like the way human brain processes information. ANN includes a large number of connected processing units that work together to process information. They also generate meaningful results from it.
DDA Line Drawing Algorithm
DDA stands for Digital Differential Analyzer
A line drawing algorithm is a graphical algorithm for approximating a line segment on discrete graphical media.
This algorithm is used to draw a line on computer pixels.
what is line
A line in Computer graphics typically refers to line segment, which is a portion of straight line that extends indefinitely in opposite direction.
It is defined by its two end points & the slope intercept equation for a line:
y = mx + b
where, m = Slope of the line
b = the y intercept of a line
Single instruction, multiple data (SIMD), is a class of parallel computers in Flynn's taxonomy. It describes computers with multiple processing elements that perform the same operation on multiple data points simultaneously.
NP completeness. Classes P and NP are two frequently studied classes of problems in computer science. Class P is the set of all problems that can be solved by a deterministic Turing machine in polynomial time.
Recurrent Neural Networks are popular Deep Learning models that have shown great promise to achieve state-of-the-art results in many tasks like Computer Vision, NLP, Finance and much more. Although being models proposed several years ago, RNN have gained popularity recently. In this talk, we will review how these models evolved over the years, dissection of RNN, current applications and its future.
DDA Line Drawing Algorithm
DDA stands for Digital Differential Analyzer
A line drawing algorithm is a graphical algorithm for approximating a line segment on discrete graphical media.
This algorithm is used to draw a line on computer pixels.
what is line
A line in Computer graphics typically refers to line segment, which is a portion of straight line that extends indefinitely in opposite direction.
It is defined by its two end points & the slope intercept equation for a line:
y = mx + b
where, m = Slope of the line
b = the y intercept of a line
Single instruction, multiple data (SIMD), is a class of parallel computers in Flynn's taxonomy. It describes computers with multiple processing elements that perform the same operation on multiple data points simultaneously.
NP completeness. Classes P and NP are two frequently studied classes of problems in computer science. Class P is the set of all problems that can be solved by a deterministic Turing machine in polynomial time.
Recurrent Neural Networks are popular Deep Learning models that have shown great promise to achieve state-of-the-art results in many tasks like Computer Vision, NLP, Finance and much more. Although being models proposed several years ago, RNN have gained popularity recently. In this talk, we will review how these models evolved over the years, dissection of RNN, current applications and its future.
Understanding the Physician Quality Reporting System (PQRS) Requirements in 2014Practice Fusion
This webinar, Understanding the Physician Quality Reporting System (PQRS) Requirements in 2014, goes over which reporting options are available, what the incentives and penalties are for participating, reporting requirements, and how to choose quality measure for reporting.
Synthetic Fiber Construction in lab .pptxPavel ( NSTU)
Synthetic fiber production is a fascinating and complex field that blends chemistry, engineering, and environmental science. By understanding these aspects, students can gain a comprehensive view of synthetic fiber production, its impact on society and the environment, and the potential for future innovations. Synthetic fibers play a crucial role in modern society, impacting various aspects of daily life, industry, and the environment. ynthetic fibers are integral to modern life, offering a range of benefits from cost-effectiveness and versatility to innovative applications and performance characteristics. While they pose environmental challenges, ongoing research and development aim to create more sustainable and eco-friendly alternatives. Understanding the importance of synthetic fibers helps in appreciating their role in the economy, industry, and daily life, while also emphasizing the need for sustainable practices and innovation.
The French Revolution, which began in 1789, was a period of radical social and political upheaval in France. It marked the decline of absolute monarchies, the rise of secular and democratic republics, and the eventual rise of Napoleon Bonaparte. This revolutionary period is crucial in understanding the transition from feudalism to modernity in Europe.
For more information, visit-www.vavaclasses.com
How to Make a Field invisible in Odoo 17Celine George
It is possible to hide or invisible some fields in odoo. Commonly using “invisible” attribute in the field definition to invisible the fields. This slide will show how to make a field invisible in odoo 17.
Macroeconomics- Movie Location
This will be used as part of your Personal Professional Portfolio once graded.
Objective:
Prepare a presentation or a paper using research, basic comparative analysis, data organization and application of economic information. You will make an informed assessment of an economic climate outside of the United States to accomplish an entertainment industry objective.
Embracing GenAI - A Strategic ImperativePeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
Operation “Blue Star” is the only event in the history of Independent India where the state went into war with its own people. Even after about 40 years it is not clear if it was culmination of states anger over people of the region, a political game of power or start of dictatorial chapter in the democratic setup.
The people of Punjab felt alienated from main stream due to denial of their just demands during a long democratic struggle since independence. As it happen all over the word, it led to militant struggle with great loss of lives of military, police and civilian personnel. Killing of Indira Gandhi and massacre of innocent Sikhs in Delhi and other India cities was also associated with this movement.
The Roman Empire A Historical Colossus.pdfkaushalkr1407
The Roman Empire, a vast and enduring power, stands as one of history's most remarkable civilizations, leaving an indelible imprint on the world. It emerged from the Roman Republic, transitioning into an imperial powerhouse under the leadership of Augustus Caesar in 27 BCE. This transformation marked the beginning of an era defined by unprecedented territorial expansion, architectural marvels, and profound cultural influence.
The empire's roots lie in the city of Rome, founded, according to legend, by Romulus in 753 BCE. Over centuries, Rome evolved from a small settlement to a formidable republic, characterized by a complex political system with elected officials and checks on power. However, internal strife, class conflicts, and military ambitions paved the way for the end of the Republic. Julius Caesar’s dictatorship and subsequent assassination in 44 BCE created a power vacuum, leading to a civil war. Octavian, later Augustus, emerged victorious, heralding the Roman Empire’s birth.
Under Augustus, the empire experienced the Pax Romana, a 200-year period of relative peace and stability. Augustus reformed the military, established efficient administrative systems, and initiated grand construction projects. The empire's borders expanded, encompassing territories from Britain to Egypt and from Spain to the Euphrates. Roman legions, renowned for their discipline and engineering prowess, secured and maintained these vast territories, building roads, fortifications, and cities that facilitated control and integration.
The Roman Empire’s society was hierarchical, with a rigid class system. At the top were the patricians, wealthy elites who held significant political power. Below them were the plebeians, free citizens with limited political influence, and the vast numbers of slaves who formed the backbone of the economy. The family unit was central, governed by the paterfamilias, the male head who held absolute authority.
Culturally, the Romans were eclectic, absorbing and adapting elements from the civilizations they encountered, particularly the Greeks. Roman art, literature, and philosophy reflected this synthesis, creating a rich cultural tapestry. Latin, the Roman language, became the lingua franca of the Western world, influencing numerous modern languages.
Roman architecture and engineering achievements were monumental. They perfected the arch, vault, and dome, constructing enduring structures like the Colosseum, Pantheon, and aqueducts. These engineering marvels not only showcased Roman ingenuity but also served practical purposes, from public entertainment to water supply.
Model Attribute Check Company Auto PropertyCeline George
In Odoo, the multi-company feature allows you to manage multiple companies within a single Odoo database instance. Each company can have its own configurations while still sharing common resources such as products, customers, and suppliers.
Biological screening of herbal drugs: Introduction and Need for
Phyto-Pharmacological Screening, New Strategies for evaluating
Natural Products, In vitro evaluation techniques for Antioxidants, Antimicrobial and Anticancer drugs. In vivo evaluation techniques
for Anti-inflammatory, Antiulcer, Anticancer, Wound healing, Antidiabetic, Hepatoprotective, Cardio protective, Diuretics and
Antifertility, Toxicity studies as per OECD guidelines
A Strategic Approach: GenAI in EducationPeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
2. Orthogonal range searching
A 2D range searching data structure stores n distinct (x, y)-pairs and supports:
the lookup(x1, x2, y1, y2) operation
which returns every point in the rectangle [x1 : x2] × [y1 : y2]
i.e. every (x, y) with x1 x x2 and y1 y y2.
3. Orthogonal range searching
A 2D range searching data structure stores n distinct (x, y)-pairs and supports:
the lookup(x1, x2, y1, y2) operation
which returns every point in the rectangle [x1 : x2] × [y1 : y2]
i.e. every (x, y) with x1 x x2 and y1 y y2.
4. Orthogonal range searching
A 2D range searching data structure stores n distinct (x, y)-pairs and supports:
the lookup(x1, x2, y1, y2) operation
which returns every point in the rectangle [x1 : x2] × [y1 : y2]
i.e. every (x, y) with x1 x x2 and y1 y y2.
n points in 2D space
|U|
|U|
The universe
5. Orthogonal range searching
A 2D range searching data structure stores n distinct (x, y)-pairs and supports:
the lookup(x1, x2, y1, y2) operation
which returns every point in the rectangle [x1 : x2] × [y1 : y2]
i.e. every (x, y) with x1 x x2 and y1 y y2.
6. Orthogonal range searching
A 2D range searching data structure stores n distinct (x, y)-pairs and supports:
the lookup(x1, x2, y1, y2) operation
which returns every point in the rectangle [x1 : x2] × [y1 : y2]
i.e. every (x, y) with x1 x x2 and y1 y y2.
7. Orthogonal range searching
A 2D range searching data structure stores n distinct (x, y)-pairs and supports:
the lookup(x1, x2, y1, y2) operation
which returns every point in the rectangle [x1 : x2] × [y1 : y2]
i.e. every (x, y) with x1 x x2 and y1 y y2.
x1 x2
y1
y2
8. Orthogonal range searching
A 2D range searching data structure stores n distinct (x, y)-pairs and supports:
the lookup(x1, x2, y1, y2) operation
which returns every point in the rectangle [x1 : x2] × [y1 : y2]
i.e. every (x, y) with x1 x x2 and y1 y y2.
x1 x2
y1
y2
9. Orthogonal range searching
A 2D range searching data structure stores n distinct (x, y)-pairs and supports:
the lookup(x1, x2, y1, y2) operation
which returns every point in the rectangle [x1 : x2] × [y1 : y2]
i.e. every (x, y) with x1 x x2 and y1 y y2.
x1 x2
y1
y2
find all employees aged between 21 and 48
with salaries between £23k and £36k
A classic database query
“
”
10. Orthogonal range searching
A 2D range searching data structure stores n distinct (x, y)-pairs and supports:
the lookup(x1, x2, y1, y2) operation
which returns every point in the rectangle [x1 : x2] × [y1 : y2]
i.e. every (x, y) with x1 x x2 and y1 y y2.
find all employees aged between 21 and 48
with salaries between £23k and £36k
A classic database query
x1 = 23 x2 = 36
y1 = 21
y2 = 48
“
”
11. Orthogonal range searching
A 2D range searching data structure stores n distinct (x, y)-pairs and supports:
the lookup(x1, x2, y1, y2) operation
which returns every point in the rectangle [x1 : x2] × [y1 : y2]
i.e. every (x, y) with x1 x x2 and y1 y y2.
12. Orthogonal range searching
A d-dimensional range searching data structure stores n distinct points
for d = 1, the lookup(x1, x2) operation
returns every point with x1 x x2.
each point has d coordinates
for d = 3, the lookup(x1, x2, y1, y2, z1, z2) operation
returns every point with
for d = 2, the lookup(x1, x2, y1, y2) operation
returns every point with
x1 x x2 and y1 y y2.
(we assume d is a constant)
x1 x x2,
y1 y y2 and
z1 z z2.
x1 x2
y1
y2
x1 x2
z
x y
13. Orthogonal range searching
A d-dimensional range searching data structure stores n distinct points
for d = 1, the lookup(x1, x2) operation
returns every point with x1 x x2.
each point has d coordinates
for d = 3, the lookup(x1, x2, y1, y2, z1, z2) operation
returns every point with
for d = 2, the lookup(x1, x2, y1, y2) operation
returns every point with
x1 x x2 and y1 y y2.
(we assume d is a constant)
x1 x x2,
y1 y y2 and
z1 z z2.
x1 x2
y1
y2
x1 x2
z
x y
14. Orthogonal range searching
A d-dimensional range searching data structure stores n distinct points
for d = 1, the lookup(x1, x2) operation
returns every point with x1 x x2.
each point has d coordinates
for d = 3, the lookup(x1, x2, y1, y2, z1, z2) operation
returns every point with
for d = 2, the lookup(x1, x2, y1, y2) operation
returns every point with
x1 x x2 and y1 y y2.
(we assume d is a constant)
x1 x x2,
y1 y y2 and
z1 z z2.
x1 x2
y1
y2
x1 x2
z
x y
21. Starting simple. . . 1D range searching
3 7 11 19 23 27 35 43 53 61 67
3 7 11 19 23 27 35 43 53 61 67
x1 = 15 x2 = 64
build a sorted array containing the x-coordinates
in O(n log n) preprocessing (prep.) time
22. Starting simple. . . 1D range searching
3 7 11 19 23 27 35 43 53 61 67
3 7 11 19 23 27 35 43 53 61 67
n
x1 = 15 x2 = 64
build a sorted array containing the x-coordinates
in O(n log n) preprocessing (prep.) time
and O(n) space
23. Starting simple. . . 1D range searching
3 7 11 19 23 27 35 43 53 61 67
3 7 11 19 23 27 35 43 53 61 67
n
x1 = 15 x2 = 64
build a sorted array containing the x-coordinates
in O(n log n) preprocessing (prep.) time
and O(n) space
to perform lookup(x1, x2). . .
find the successor of x1 by binary search and then ‘walk’ right
24. Starting simple. . . 1D range searching
3 7 11 19 23 27 35 43 53 61 67
3 7 11 19 23 27 35 43 53 61 67
n
x1 = 15 x2 = 64
build a sorted array containing the x-coordinates
in O(n log n) preprocessing (prep.) time
and O(n) space
to perform lookup(x1, x2). . .
find the successor of x1 by binary search and then ‘walk’ right
(i.e. the closest point to the right)
25. Starting simple. . . 1D range searching
3 7 11 19 23 27 35 43 53 61 67
3 7 11 19 23 27 35 43 53 61 67
n
x1 = 15 x2 = 64
build a sorted array containing the x-coordinates
in O(n log n) preprocessing (prep.) time
and O(n) space
(i.e. the closest point to the right)
find the successor of x1 by binary search and then ‘walk’ right
to perform lookup(x1, x2). . .
26. Starting simple. . . 1D range searching
3 7 11 19 23 27 35 43 53 61 67
3 7 11 19 23 27 35 43 53 61 67
n
x1 = 15 x2 = 64
build a sorted array containing the x-coordinates
in O(n log n) preprocessing (prep.) time
and O(n) space
to perform lookup(x1, x2). . .
find the successor of x1 by binary search and then ‘walk’ right
15 < 27
27. Starting simple. . . 1D range searching
3 7 11 19 23 27 35 43 53 61 67
3 7 11 19 23 27 35 43 53 61 67
n
x1 = 15 x2 = 64
build a sorted array containing the x-coordinates
in O(n log n) preprocessing (prep.) time
and O(n) space
to perform lookup(x1, x2). . .
find the successor of x1 by binary search and then ‘walk’ right
15 < 27
28. Starting simple. . . 1D range searching
3 7 11 19 23 27 35 43 53 61 67
3 7 11 19 23 27 35 43 53 61 67
n
x1 = 15 x2 = 64
build a sorted array containing the x-coordinates
in O(n log n) preprocessing (prep.) time
and O(n) space
to perform lookup(x1, x2). . .
find the successor of x1 by binary search and then ‘walk’ right
15 > 11
29. Starting simple. . . 1D range searching
3 7 11 19 23 27 35 43 53 61 67
3 7 11 19 23 27 35 43 53 61 67
n
x1 = 15 x2 = 64
build a sorted array containing the x-coordinates
in O(n log n) preprocessing (prep.) time
and O(n) space
to perform lookup(x1, x2). . .
find the successor of x1 by binary search and then ‘walk’ right
15 > 11
30. Starting simple. . . 1D range searching
3 7 11 19 23 27 35 43 53 61 67
3 7 11 19 23 27 35 43 53 61 67
n
x1 = 15 x2 = 64
build a sorted array containing the x-coordinates
in O(n log n) preprocessing (prep.) time
and O(n) space
to perform lookup(x1, x2). . .
find the successor of x1 by binary search and then ‘walk’ right
15 < 19
31. Starting simple. . . 1D range searching
3 7 11 19 23 27 35 43 53 61 67
3 7 11 19 23 27 35 43 53 61 67
n
x1 = 15 x2 = 64
build a sorted array containing the x-coordinates
in O(n log n) preprocessing (prep.) time
and O(n) space
to perform lookup(x1, x2). . .
find the successor of x1 by binary search and then ‘walk’ right
15 < 19
32. Starting simple. . . 1D range searching
3 7 11 19 23 27 35 43 53 61 67
3 7 11 19 23 27 35 43 53 61 67
n
x1 = 15 x2 = 64
build a sorted array containing the x-coordinates
in O(n log n) preprocessing (prep.) time
and O(n) space
to perform lookup(x1, x2). . .
find the successor of x1 by binary search and then ‘walk’ right
33. Starting simple. . . 1D range searching
3 7 11 19 23 27 35 43 53 61 67
3 7 11 19 23 27 35 43 53 61 67
n
x1 = 15 x2 = 64
build a sorted array containing the x-coordinates
in O(n log n) preprocessing (prep.) time
and O(n) space
to perform lookup(x1, x2). . .
find the successor of x1 by binary search and then ‘walk’ right
34. Starting simple. . . 1D range searching
3 7 11 19 23 27 35 43 53 61 67
3 7 11 19 23 27 35 43 53 61 67
n
x1 = 15 x2 = 64
build a sorted array containing the x-coordinates
in O(n log n) preprocessing (prep.) time
and O(n) space
to perform lookup(x1, x2). . .
find the successor of x1 by binary search and then ‘walk’ right
35. Starting simple. . . 1D range searching
3 7 11 19 23 27 35 43 53 61 67
3 7 11 19 23 27 35 43 53 61 67
n
x1 = 15 x2 = 64
build a sorted array containing the x-coordinates
in O(n log n) preprocessing (prep.) time
and O(n) space
to perform lookup(x1, x2). . .
find the successor of x1 by binary search and then ‘walk’ right
36. Starting simple. . . 1D range searching
3 7 11 19 23 27 35 43 53 61 67
3 7 11 19 23 27 35 43 53 61 67
n
x1 = 15 x2 = 64
build a sorted array containing the x-coordinates
in O(n log n) preprocessing (prep.) time
and O(n) space
to perform lookup(x1, x2). . .
find the successor of x1 by binary search and then ‘walk’ right
37. Starting simple. . . 1D range searching
3 7 11 19 23 27 35 43 53 61 67
3 7 11 19 23 27 35 43 53 61 67
n
x1 = 15 x2 = 64
build a sorted array containing the x-coordinates
in O(n log n) preprocessing (prep.) time
and O(n) space
to perform lookup(x1, x2). . .
find the successor of x1 by binary search and then ‘walk’ right
38. Starting simple. . . 1D range searching
3 7 11 19 23 27 35 43 53 61 67
3 7 11 19 23 27 35 43 53 61 67
n
x1 = 15 x2 = 64
build a sorted array containing the x-coordinates
in O(n log n) preprocessing (prep.) time
and O(n) space
to perform lookup(x1, x2). . .
find the successor of x1 by binary search and then ‘walk’ right
39. Starting simple. . . 1D range searching
3 7 11 19 23 27 35 43 53 61 67
3 7 11 19 23 27 35 43 53 61 67
n
x1 = 15 x2 = 64
build a sorted array containing the x-coordinates
in O(n log n) preprocessing (prep.) time
and O(n) space
to perform lookup(x1, x2). . .
find the successor of x1 by binary search and then ‘walk’ right
67 > 64 = x2
40. Starting simple. . . 1D range searching
3 7 11 19 23 27 35 43 53 61 67
3 7 11 19 23 27 35 43 53 61 67
n
x1 = 15 x2 = 64
build a sorted array containing the x-coordinates
in O(n log n) preprocessing (prep.) time
and O(n) space
to perform lookup(x1, x2). . .
find the successor of x1 by binary search and then ‘walk’ right
41. Starting simple. . . 1D range searching
3 7 11 19 23 27 35 43 53 61 67
3 7 11 19 23 27 35 43 53 61 67
n
x1 = 15 x2 = 64
build a sorted array containing the x-coordinates
in O(n log n) preprocessing (prep.) time
and O(n) space
to perform lookup(x1, x2). . .
find the successor of x1 by binary search and then ‘walk’ right
k
lookups take O(log n + k) time (k is the number of points reported)
3
42. Starting simple. . . 1D range searching
3 7 11 19 23 27 35 43 53 61 67
3 7 11 19 23 27 35 43 53 61 67
n
x1 = 15 x2 = 64
build a sorted array containing the x-coordinates
in O(n log n) preprocessing (prep.) time
and O(n) space
to perform lookup(x1, x2). . .
find the successor of x1 by binary search and then ‘walk’ right
k
lookups take O(log n + k) time (k is the number of points reported)
3
this is called being ‘output sensitive’
44. Starting simple. . . 1D range searching
alternatively we could build a balanced tree. . .
45. Starting simple. . . 1D range searching
find the point in the middle
alternatively we could build a balanced tree. . .
46. Starting simple. . . 1D range searching
find the point in the middle
alternatively we could build a balanced tree. . .
half the points are to the left half the points are to the right
47. Starting simple. . . 1D range searching
find the point in the middle
alternatively we could build a balanced tree. . .
48. Starting simple. . . 1D range searching
find the point in the middle
alternatively we could build a balanced tree. . .
. . . and recurse on each half
49. Starting simple. . . 1D range searching
find the point in the middle
alternatively we could build a balanced tree. . .
. . . and recurse on each half
50. Starting simple. . . 1D range searching
find the point in the middle
alternatively we could build a balanced tree. . .
. . . and recurse on each half
51. Starting simple. . . 1D range searching
find the point in the middle
alternatively we could build a balanced tree. . .
. . . and recurse on each half
(in a tie, pick the left)
52. Starting simple. . . 1D range searching
find the point in the middle
alternatively we could build a balanced tree. . .
. . . and recurse on each half
(in a tie, pick the left)
53. Starting simple. . . 1D range searching
find the point in the middle
alternatively we could build a balanced tree. . .
. . . and recurse on each half
(in a tie, pick the left)
54. Starting simple. . . 1D range searching
find the point in the middle
alternatively we could build a balanced tree. . .
. . . and recurse on each half
(in a tie, pick the left)
55. Starting simple. . . 1D range searching
find the point in the middle
alternatively we could build a balanced tree. . .
. . . and recurse on each half
(in a tie, pick the left)
We can store the tree in O(n) space (it has one node per point)
56. Starting simple. . . 1D range searching
find the point in the middle
alternatively we could build a balanced tree. . .
. . . and recurse on each half
(in a tie, pick the left)
We can store the tree in O(n) space (it has one node per point)
It has O(log n) depth
57. Starting simple. . . 1D range searching
find the point in the middle
alternatively we could build a balanced tree. . .
. . . and recurse on each half
(in a tie, pick the left)
We can store the tree in O(n) space (it has one node per point)
It has O(log n) depth
O(log n)
58. Starting simple. . . 1D range searching
find the point in the middle
alternatively we could build a balanced tree. . .
. . . and recurse on each half
(in a tie, pick the left)
We can store the tree in O(n) space (it has one node per point)
It has O(log n) depth and can be built in O(n log n) time
O(log n)
59. Starting simple. . . 1D range searching
find the point in the middle
alternatively we could build a balanced tree. . .
. . . and recurse on each half
(in a tie, pick the left)
We can store the tree in O(n) space (it has one node per point)
It has O(log n) depth and can be built in O(n log n) time
O(log n)
60. Starting simple. . . 1D range searching
find the point in the middle
alternatively we could build a balanced tree. . .
. . . and recurse on each half
(in a tie, pick the left)
We can store the tree in O(n) space (it has one node per point)
It has O(log n) depth (O(n) time if the points are sorted)and can be built in O(n log n) time
O(log n)
63. Starting simple. . . 1D range searching
x1 x2
Step 1: find the successor of x1
how do we do a lookup?
64. Starting simple. . . 1D range searching
x1 x2
Step 1: find the successor of x1
how do we do a lookup?
65. Starting simple. . . 1D range searching
x1 x2
Step 1: find the successor of x1
how do we do a lookup?
x1 is to the left
66. Starting simple. . . 1D range searching
x1 x2
Step 1: find the successor of x1
how do we do a lookup?
x1 is to the right
67. Starting simple. . . 1D range searching
x1 x2
Step 1: find the successor of x1
how do we do a lookup?
68. Starting simple. . . 1D range searching
x1 x2
Step 1: find the successor of x1 in O(log n) time
how do we do a lookup?
69. Starting simple. . . 1D range searching
x1 x2
Step 1: find the successor of x1
Step 2: find the predecessor of x2
in O(log n) time
how do we do a lookup?
70. Starting simple. . . 1D range searching
x1 x2
Step 1: find the successor of x1
Step 2: find the predecessor of x2
in O(log n) time
how do we do a lookup?
71. Starting simple. . . 1D range searching
x1 x2
Step 1: find the successor of x1
Step 2: find the predecessor of x2
in O(log n) time
how do we do a lookup?
72. Starting simple. . . 1D range searching
x1 x2
Step 1: find the successor of x1
Step 2: find the predecessor of x2
in O(log n) time
how do we do a lookup?
73. Starting simple. . . 1D range searching
x1 x2
Step 1: find the successor of x1
Step 2: find the predecessor of x2
in O(log n) time
how do we do a lookup?
in O(log n) time
74. Starting simple. . . 1D range searching
x1 x2
Step 1: find the successor of x1
Step 2: find the predecessor of x2
in O(log n) time
how do we do a lookup?
in O(log n) time
which points in the tree should we output?
75. Starting simple. . . 1D range searching
x1 x2
Step 1: find the successor of x1
Step 2: find the predecessor of x2
in O(log n) time
how do we do a lookup?
in O(log n) time
which points in the tree should we output?
76. Starting simple. . . 1D range searching
x1 x2
Step 1: find the successor of x1
Step 2: find the predecessor of x2
in O(log n) time
how do we do a lookup?
in O(log n) time
which points in the tree should we output?
look at any node on the path
77. Starting simple. . . 1D range searching
x1 x2
Step 1: find the successor of x1
Step 2: find the predecessor of x2
in O(log n) time
how do we do a lookup?
in O(log n) time
which points in the tree should we output?
look at any node on the path
this is called an
off-path edge
78. Starting simple. . . 1D range searching
x1 x2
Step 1: find the successor of x1
Step 2: find the predecessor of x2
in O(log n) time
how do we do a lookup?
in O(log n) time
which points in the tree should we output?
look at any node on the path
this is called an
“it’s all or
nothing”
off-path edge
79. Starting simple. . . 1D range searching
x1 x2
Step 1: find the successor of x1
Step 2: find the predecessor of x2
in O(log n) time
how do we do a lookup?
in O(log n) time
which points in the tree should we output?
look at any node on the path
this is called an
“it’s all or
nothing”
off-path edge
80. Starting simple. . . 1D range searching
x1 x2
Step 1: find the successor of x1
Step 2: find the predecessor of x2
in O(log n) time
how do we do a lookup?
in O(log n) time
which points in the tree should we output?
look at any node on the path
this is called an
“it’s all or
nothing”
off-path edge
81. Starting simple. . . 1D range searching
x1 x2
Step 1: find the successor of x1
Step 2: find the predecessor of x2
in O(log n) time
how do we do a lookup?
in O(log n) time
which points in the tree should we output?
look at any node on the path
this is called an
“it’s all or
nothing”
off-path edge
82. Starting simple. . . 1D range searching
x1 x2
Step 1: find the successor of x1
Step 2: find the predecessor of x2
in O(log n) time
how do we do a lookup?
in O(log n) time
which points in the tree should we output?
look at any node on the path
this is called an
“it’s all or
nothing”
off-path edge
off-path edge
83. Starting simple. . . 1D range searching
x1 x2
Step 1: find the successor of x1
Step 2: find the predecessor of x2
in O(log n) time
how do we do a lookup?
in O(log n) time
which points in the tree should we output?
look at any node on the path
this is called an
“it’s all or
nothing”
off-path edge
off-path edge
84. Starting simple. . . 1D range searching
x1 x2
Step 1: find the successor of x1
Step 2: find the predecessor of x2
in O(log n) time
how do we do a lookup?
in O(log n) time
which points in the tree should we output?
look at any node on the path
this is called an
“it’s all or
nothing”
off-path edge
off-path edge
85. Starting simple. . . 1D range searching
x1 x2
Step 1: find the successor of x1
Step 2: find the predecessor of x2
in O(log n) time
how do we do a lookup?
in O(log n) time
which points in the tree should we output?
look at any node on the path
this is called an
“it’s all or
nothing”
off-path edge
86. Starting simple. . . 1D range searching
x1 x2
Step 1: find the successor of x1
Step 2: find the predecessor of x2
in O(log n) time
how do we do a lookup?
in O(log n) time
which points in the tree should we output?
look at any node on the path
this is called an
“it’s all or
nothing”
off-path edge
87. Starting simple. . . 1D range searching
x1 x2
Step 1: find the successor of x1
Step 2: find the predecessor of x2
in O(log n) time
how do we do a lookup?
in O(log n) time
which points in the tree should we output?
look at any node on the path
this is called an
“it’s all or
nothing”
off-path edge
88. Starting simple. . . 1D range searching
x1 x2
Step 1: find the successor of x1
Step 2: find the predecessor of x2
in O(log n) time
how do we do a lookup?
in O(log n) time
which points in the tree should we output?
look at any node on the path
this is called an
“it’s all or
nothing”
off-path edge
89. Starting simple. . . 1D range searching
x1 x2
Step 1: find the successor of x1
Step 2: find the predecessor of x2
in O(log n) time
how do we do a lookup?
in O(log n) time
which points in the tree should we output?
look at any node on the path
this is called an
“it’s all or
nothing”
off-path edge
90. Starting simple. . . 1D range searching
x1 x2
Step 1: find the successor of x1
Step 2: find the predecessor of x2
in O(log n) time
how do we do a lookup?
in O(log n) time
which points in the tree should we output?
look at any node on the path
this is called an
“it’s all or
nothing”
off-path edge
91. Starting simple. . . 1D range searching
x1 x2
Step 1: find the successor of x1
Step 2: find the predecessor of x2
in O(log n) time
how do we do a lookup?
in O(log n) time
which points in the tree should we output?
look at any node on the path
this is called an
“it’s all or
nothing”
off-path edge
92. Starting simple. . . 1D range searching
x1 x2
Step 1: find the successor of x1
Step 2: find the predecessor of x2
in O(log n) time
how do we do a lookup?
in O(log n) time
which points in the tree should we output?
look at any node on the path
this is called an
“it’s all or
nothing”
off-path edge
93. Starting simple. . . 1D range searching
x1 x2
Step 1: find the successor of x1
Step 2: find the predecessor of x2
in O(log n) time
how do we do a lookup?
in O(log n) time
which points in the tree should we output?
look at any node on the path
this is called an
“it’s all or
nothing”
after the split
off-path edge
94. Starting simple. . . 1D range searching
x1 x2
Step 1: find the successor of x1
Step 2: find the predecessor of x2
in O(log n) time
how do we do a lookup?
in O(log n) time
which points in the tree should we output?
look at any node on the path
this is called an
“it’s all or
nothing”
after the split
those in the O(log n) selected subtrees on the path
off-path edge
95. Starting simple. . . 1D range searching
x1 x2
how do we do a lookup?
look at any node on the path
this is called an
“it’s all or
nothing”
after the split
off-path edge
96. Starting simple. . . 1D range searching
x1 x2
how do we do a lookup?
look at any node on the path
this is called an
“it’s all or
nothing”
after the split
lookups take O(log n + k) time (k is the number of points reported)
as before
off-path edge
97. Starting simple. . . 1D range searching
x1 x2
how do we do a lookup?
look at any node on the path
this is called an
“it’s all or
nothing”
after the split
lookups take O(log n + k) time (k is the number of points reported)
as before
so what have we gained?
off-path edge
99. Subtree decomposition root
split
x1 x2
Warning: the root to split path isn’t to scale
after the paths to x1 and x2 split. . .
off-path edge
off-path subtree
too small
too big
100. Subtree decomposition root
split
x1 x2
Warning: the root to split path isn’t to scale
after the paths to x1 and x2 split. . .
any off-path subtree is either in or out
off-path edge
off-path subtree
too small
too big
101. Subtree decomposition root
split
x1 x2
Warning: the root to split path isn’t to scale
after the paths to x1 and x2 split. . .
any off-path subtree is either in or out
i.e. every point in the subtree has x1 x x2 or none has
off-path edge
off-path subtree
too small
too big
102. Subtree decomposition root
split
x1 x2
Warning: the root to split path isn’t to scale
after the paths to x1 and x2 split. . .
any off-path subtree is either in or out
i.e. every point in the subtree has x1 x x2 or none has
off-path edge
off-path subtree
too small
too big
this will be useful for 2D range searching
103. 1D range searching summary
O(n log n) prep time
O(n) space
O(log n + k) lookup time
where k is the number of points reported
(this is known as being output sensitive)
x1 x2
preprocess n points on a line
lookup(x1, x2) should report all points between x1 and x2
104. 2D range searching
A 2D range searching data structure stores n distinct (x, y)-pairs and supports:
the lookup(x1, x2, y1, y2) operation
which returns every point in the rectangle [x1 : x2] × [y1 : y2]
i.e. every (x, y) with x1 x x2 and y1 y y2.
x1 x2
y1
y2
105. 2D range searching
A 2D range searching data structure stores n distinct (x, y)-pairs and supports:
the lookup(x1, x2, y1, y2) operation
which returns every point in the rectangle [x1 : x2] × [y1 : y2]
i.e. every (x, y) with x1 x x2 and y1 y y2.
x1 x2
y1
y2
Attempt one:
106. 2D range searching
A 2D range searching data structure stores n distinct (x, y)-pairs and supports:
the lookup(x1, x2, y1, y2) operation
which returns every point in the rectangle [x1 : x2] × [y1 : y2]
i.e. every (x, y) with x1 x x2 and y1 y y2.
x1 x2
y1
y2
Attempt one:
• Find all the points with x1 x x2
107. 2D range searching
A 2D range searching data structure stores n distinct (x, y)-pairs and supports:
the lookup(x1, x2, y1, y2) operation
which returns every point in the rectangle [x1 : x2] × [y1 : y2]
i.e. every (x, y) with x1 x x2 and y1 y y2.
x1 x2
y1
y2
Attempt one:
• Find all the points with x1 x x2
108. 2D range searching
A 2D range searching data structure stores n distinct (x, y)-pairs and supports:
the lookup(x1, x2, y1, y2) operation
which returns every point in the rectangle [x1 : x2] × [y1 : y2]
i.e. every (x, y) with x1 x x2 and y1 y y2.
x1 x2
y1
y2
Attempt one:
• Find all the points with x1 x x2
109. 2D range searching
A 2D range searching data structure stores n distinct (x, y)-pairs and supports:
the lookup(x1, x2, y1, y2) operation
which returns every point in the rectangle [x1 : x2] × [y1 : y2]
i.e. every (x, y) with x1 x x2 and y1 y y2.
x1 x2
y1
y2
Attempt one:
• Find all the points with x1 x x2
• Find all the points with y1 y y2
110. 2D range searching
A 2D range searching data structure stores n distinct (x, y)-pairs and supports:
the lookup(x1, x2, y1, y2) operation
which returns every point in the rectangle [x1 : x2] × [y1 : y2]
i.e. every (x, y) with x1 x x2 and y1 y y2.
x1 x2
y1
y2
Attempt one:
• Find all the points with x1 x x2
• Find all the points with y1 y y2
111. 2D range searching
A 2D range searching data structure stores n distinct (x, y)-pairs and supports:
the lookup(x1, x2, y1, y2) operation
which returns every point in the rectangle [x1 : x2] × [y1 : y2]
i.e. every (x, y) with x1 x x2 and y1 y y2.
x1 x2
y1
y2
Attempt one:
• Find all the points with x1 x x2
• Find all the points with y1 y y2
• Find all the points in both lists
112. 2D range searching
A 2D range searching data structure stores n distinct (x, y)-pairs and supports:
the lookup(x1, x2, y1, y2) operation
which returns every point in the rectangle [x1 : x2] × [y1 : y2]
i.e. every (x, y) with x1 x x2 and y1 y y2.
x1 x2
y1
y2
Attempt one:
• Find all the points with x1 x x2
• Find all the points with y1 y y2
• Find all the points in both lists
113. 2D range searching
A 2D range searching data structure stores n distinct (x, y)-pairs and supports:
the lookup(x1, x2, y1, y2) operation
which returns every point in the rectangle [x1 : x2] × [y1 : y2]
i.e. every (x, y) with x1 x x2 and y1 y y2.
x1 x2
y1
y2
Attempt one:
• Find all the points with x1 x x2
• Find all the points with y1 y y2
• Find all the points in both lists
How long does this take?
114. 2D range searching
A 2D range searching data structure stores n distinct (x, y)-pairs and supports:
the lookup(x1, x2, y1, y2) operation
which returns every point in the rectangle [x1 : x2] × [y1 : y2]
i.e. every (x, y) with x1 x x2 and y1 y y2.
x1 x2
y1
y2
Attempt one:
• Find all the points with x1 x x2
• Find all the points with y1 y y2
• Find all the points in both lists
How long does this take?
O(log n + k) + O(log n + k) + O(k)
115. 2D range searching
A 2D range searching data structure stores n distinct (x, y)-pairs and supports:
the lookup(x1, x2, y1, y2) operation
which returns every point in the rectangle [x1 : x2] × [y1 : y2]
i.e. every (x, y) with x1 x x2 and y1 y y2.
x1 x2
y1
y2
Attempt one:
• Find all the points with x1 x x2
• Find all the points with y1 y y2
• Find all the points in both lists
How long does this take?
O(log n + k) + O(log n + k) + O(k)
= O(log n + k)
116. 2D range searching
A 2D range searching data structure stores n distinct (x, y)-pairs and supports:
the lookup(x1, x2, y1, y2) operation
which returns every point in the rectangle [x1 : x2] × [y1 : y2]
i.e. every (x, y) with x1 x x2 and y1 y y2.
x1 x2
y1
y2
Attempt one:
• Find all the points with x1 x x2
• Find all the points with y1 y y2
• Find all the points in both lists
How long does this take?
O(log n + k) + O(log n + k) + O(k)
= O(log n + k)
117. 2D range searching
A 2D range searching data structure stores n distinct (x, y)-pairs and supports:
the lookup(x1, x2, y1, y2) operation
which returns every point in the rectangle [x1 : x2] × [y1 : y2]
i.e. every (x, y) with x1 x x2 and y1 y y2.
x1 x2
y1
y2
Attempt one:
• Find all the points with x1 x x2
• Find all the points with y1 y y2
• Find all the points in both lists
How long does this take?
O(log n + k) + O(log n + k) + O(k)
= O(log n + k)
???
118. 2D range searching
A 2D range searching data structure stores n distinct (x, y)-pairs and supports:
the lookup(x1, x2, y1, y2) operation
which returns every point in the rectangle [x1 : x2] × [y1 : y2]
i.e. every (x, y) with x1 x x2 and y1 y y2.
x1 x2
y1
y2
Attempt one:
• Find all the points with x1 x x2
• Find all the points with y1 y y2
• Find all the points in both lists
How long does this take?
O(log n + k) + O(log n + k) + O(k)
= O(log n + k)
???
119. 2D range searching
A 2D range searching data structure stores n distinct (x, y)-pairs and supports:
the lookup(x1, x2, y1, y2) operation
which returns every point in the rectangle [x1 : x2] × [y1 : y2]
i.e. every (x, y) with x1 x x2 and y1 y y2.
x1 x2
y1
y2
Attempt one:
• Find all the points with x1 x x2
• Find all the points with y1 y y2
• Find all the points in both lists
How long does this take?
O(log n + kx) + O(log n + ky) + O(kx + ky)
= O(log n + kx + ky)
here kx is the number of points with x1 x x2 (respectively for ky)
120. 2D range searching
A 2D range searching data structure stores n distinct (x, y)-pairs and supports:
the lookup(x1, x2, y1, y2) operation
which returns every point in the rectangle [x1 : x2] × [y1 : y2]
i.e. every (x, y) with x1 x x2 and y1 y y2.
x1 x2
y1
y2
Attempt one:
• Find all the points with x1 x x2
• Find all the points with y1 y y2
• Find all the points in both lists
How long does this take?
O(log n + kx) + O(log n + ky) + O(kx + ky)
= O(log n + kx + ky)
here kx is the number of points with x1 x x2 (respectively for ky)
these could be huge in comparison with k
121. 2D range searching
A 2D range searching data structure stores n distinct (x, y)-pairs and supports:
the lookup(x1, x2, y1, y2) operation
which returns every point in the rectangle [x1 : x2] × [y1 : y2]
i.e. every (x, y) with x1 x x2 and y1 y y2.
x1 x2
y1
y2
122. 2D range searching
A 2D range searching data structure stores n distinct (x, y)-pairs and supports:
the lookup(x1, x2, y1, y2) operation
which returns every point in the rectangle [x1 : x2] × [y1 : y2]
i.e. every (x, y) with x1 x x2 and y1 y y2.
x1 x2
y1
y2
how can we do better?
123. Subtree decomposition in 2D root
split
x1 x2
Warning: the root to split path isn’t to scale
off-path edge
off-path subtree
x too small
x too big
(during preprocessing) build a balanced binary tree using the x-coordinates
124. Subtree decomposition in 2D root
split
x1 x2
Warning: the root to split path isn’t to scale
to perform a lookup(x1, x2, y1, y2) follow the paths to x1 and x2 as before
off-path edge
off-path subtree
x too small
x too big
(during preprocessing) build a balanced binary tree using the x-coordinates
125. Subtree decomposition in 2D root
split
x1 x2
Warning: the root to split path isn’t to scale
to perform a lookup(x1, x2, y1, y2) follow the paths to x1 and x2 as before
off-path edge
off-path subtree
x too small
x too big
(during preprocessing) build a balanced binary tree using the x-coordinates
for any off-path subtree. . .
every point in the subtree has x1 x x2 or no point has
126. Subtree decomposition in 2D root
split
x1 x2
Warning: the root to split path isn’t to scale
to perform a lookup(x1, x2, y1, y2) follow the paths to x1 and x2 as before
off-path edge
off-path subtree
x too small
x too big
(during preprocessing) build a balanced binary tree using the x-coordinates
for any off-path subtree. . .
every point in the subtree has x1 x x2 or no point has
Idea: filter these subtrees by y-coordinate
127. Subtree decomposition in 2D
to perform a lookup(x1, x2, y1, y2) follow the paths to x1 and x2 as before
(during preprocessing) build a balanced binary tree using the x-coordinates
for any off-path subtree. . .
every point in the subtree has x1 x x2 or no point has
Idea: filter these subtrees by y-coordinate
128. Subtree decomposition in 2D
to perform a lookup(x1, x2, y1, y2) follow the paths to x1 and x2 as before
(during preprocessing) build a balanced binary tree using the x-coordinates
for any off-path subtree. . .
every point in the subtree has x1 x x2 or no point has
Idea: filter these subtrees by y-coordinate
we want to find all points in here with y1 y y2
(they all have x1 x x2)
129. Subtree decomposition in 2D
to perform a lookup(x1, x2, y1, y2) follow the paths to x1 and x2 as before
(during preprocessing) build a balanced binary tree using the x-coordinates
for any off-path subtree. . .
every point in the subtree has x1 x x2 or no point has
Idea: filter these subtrees by y-coordinate
we want to find all points in here with y1 y y2
(they all have x1 x x2)
how?
130. Subtree decomposition in 2D
to perform a lookup(x1, x2, y1, y2) follow the paths to x1 and x2 as before
(during preprocessing) build a balanced binary tree using the x-coordinates
for any off-path subtree. . .
every point in the subtree has x1 x x2 or no point has
Idea: filter these subtrees by y-coordinate
we want to find all points in here with y1 y y2
(they all have x1 x x2)
how?
build a 1D range searching structure at every node
(during preprocessing)
on the y-coordinates of the points in the subtree
131. Subtree decomposition in 2D
to perform a lookup(x1, x2, y1, y2) follow the paths to x1 and x2 as before
(during preprocessing) build a balanced binary tree using the x-coordinates
for any off-path subtree. . .
every point in the subtree has x1 x x2 or no point has
Idea: filter these subtrees by y-coordinate
we want to find all points in here with y1 y y2
(they all have x1 x x2)
how?
build a 1D range searching structure at every node
(during preprocessing)
on the y-coordinates of the points in the subtree
a 1D lookup takes O(log n + k ) time
k
132. Subtree decomposition in 2D
to perform a lookup(x1, x2, y1, y2) follow the paths to x1 and x2 as before
(during preprocessing) build a balanced binary tree using the x-coordinates
for any off-path subtree. . .
every point in the subtree has x1 x x2 or no point has
Idea: filter these subtrees by y-coordinate
we want to find all points in here with y1 y y2
(they all have x1 x x2)
how?
build a 1D range searching structure at every node
(during preprocessing)
on the y-coordinates of the points in the subtree
a 1D lookup takes O(log n + k ) time
k
and only returns points we want
135. Subtree decomposition in 2D
Query summary
1. Follow the paths to x1 and x2 (inspecting the points on the path as you go)
x1 x2
136. Subtree decomposition in 2D
Query summary
1. Follow the paths to x1 and x2
2. Discard off-path subtrees where the x coordinates are too large or too small
(inspecting the points on the path as you go)
x1 x2
137. Subtree decomposition in 2D
Query summary
1. Follow the paths to x1 and x2
2. Discard off-path subtrees where the x coordinates are too large or too small
(inspecting the points on the path as you go)
x1 x2
138. Subtree decomposition in 2D
Query summary
1. Follow the paths to x1 and x2
2. Discard off-path subtrees where the x coordinates are too large or too small
3. For each off-path subtree where the x coordinates are in range. . .
use the 1D range structure for that subtree
to filter the y coordinates
(inspecting the points on the path as you go)
x1 x2
139. Subtree decomposition in 2D
Query summary
1. Follow the paths to x1 and x2
2. Discard off-path subtrees where the x coordinates are too large or too small
3. For each off-path subtree where the x coordinates are in range. . .
use the 1D range structure for that subtree
to filter the y coordinates
(inspecting the points on the path as you go)
perform lookup(y1, y2) on the
points in this subtree
x1 x2
140. Subtree decomposition in 2D
Query summary
1. Follow the paths to x1 and x2
2. Discard off-path subtrees where the x coordinates are too large or too small
3. For each off-path subtree where the x coordinates are in range. . .
use the 1D range structure for that subtree
to filter the y coordinates
(inspecting the points on the path as you go)
perform lookup(y1, y2) on the
points in this subtree
x1 x2
141. Subtree decomposition in 2D
Query summary
1. Follow the paths to x1 and x2
2. Discard off-path subtrees where the x coordinates are too large or too small
3. For each off-path subtree where the x coordinates are in range. . .
use the 1D range structure for that subtree
to filter the y coordinates
(inspecting the points on the path as you go)
perform lookup(y1, y2) on the
points in this subtree
x1 x2
142. Subtree decomposition in 2D
Query summary
1. Follow the paths to x1 and x2
2. Discard off-path subtrees where the x coordinates are too large or too small
3. For each off-path subtree where the x coordinates are in range. . .
use the 1D range structure for that subtree
to filter the y coordinates
(inspecting the points on the path as you go)
perform lookup(y1, y2) on the
points in this subtree
x1 x2
143. Subtree decomposition in 2D
Query summary
1. Follow the paths to x1 and x2
2. Discard off-path subtrees where the x coordinates are too large or too small
3. For each off-path subtree where the x coordinates are in range. . .
use the 1D range structure for that subtree
to filter the y coordinates
(inspecting the points on the path as you go)
perform lookup(y1, y2) on the
points in this subtree
x1 x2
144. Subtree decomposition in 2D
Query summary
1. Follow the paths to x1 and x2
2. Discard off-path subtrees where the x coordinates are too large or too small
3. For each off-path subtree where the x coordinates are in range. . .
use the 1D range structure for that subtree
to filter the y coordinates
(inspecting the points on the path as you go)
How long does a query take?
x1 x2
145. Subtree decomposition in 2D
Query summary
1. Follow the paths to x1 and x2
2. Discard off-path subtrees where the x coordinates are too large or too small
3. For each off-path subtree where the x coordinates are in range. . .
use the 1D range structure for that subtree
to filter the y coordinates
(inspecting the points on the path as you go)
How long does a query take?
The paths have length O(log n)
x1 x2
146. Subtree decomposition in 2D
Query summary
1. Follow the paths to x1 and x2
2. Discard off-path subtrees where the x coordinates are too large or too small
3. For each off-path subtree where the x coordinates are in range. . .
use the 1D range structure for that subtree
to filter the y coordinates
(inspecting the points on the path as you go)
How long does a query take?
The paths have length O(log n)
So steps 1. and 2. take O(log n) time
x1 x2
147. Subtree decomposition in 2D
Query summary
1. Follow the paths to x1 and x2
2. Discard off-path subtrees where the x coordinates are too large or too small
3. For each off-path subtree where the x coordinates are in range. . .
use the 1D range structure for that subtree
to filter the y coordinates
(inspecting the points on the path as you go)
How long does a query take?
The paths have length O(log n)
So steps 1. and 2. take O(log n) time
As for step 3,
x1 x2
148. Subtree decomposition in 2D
Query summary
1. Follow the paths to x1 and x2
2. Discard off-path subtrees where the x coordinates are too large or too small
3. For each off-path subtree where the x coordinates are in range. . .
use the 1D range structure for that subtree
to filter the y coordinates
(inspecting the points on the path as you go)
How long does a query take?
The paths have length O(log n)
So steps 1. and 2. take O(log n) time
As for step 3,
We do O(log n) 1D lookups. . .
x1 x2
149. Subtree decomposition in 2D
Query summary
1. Follow the paths to x1 and x2
2. Discard off-path subtrees where the x coordinates are too large or too small
3. For each off-path subtree where the x coordinates are in range. . .
use the 1D range structure for that subtree
to filter the y coordinates
(inspecting the points on the path as you go)
How long does a query take?
The paths have length O(log n)
So steps 1. and 2. take O(log n) time
As for step 3,
We do O(log n) 1D lookups. . .
Each takes O(log n + k ) time
x1 x2
150. Subtree decomposition in 2D
Query summary
1. Follow the paths to x1 and x2
2. Discard off-path subtrees where the x coordinates are too large or too small
3. For each off-path subtree where the x coordinates are in range. . .
use the 1D range structure for that subtree
to filter the y coordinates
(inspecting the points on the path as you go)
How long does a query take?
The paths have length O(log n)
So steps 1. and 2. take O(log n) time
As for step 3,
We do O(log n) 1D lookups. . .
Each takes O(log n + k ) time
This sums to. . .
O(log2 n + k)
x1 x2
151. Subtree decomposition in 2D
Query summary
1. Follow the paths to x1 and x2
2. Discard off-path subtrees where the x coordinates are too large or too small
3. For each off-path subtree where the x coordinates are in range. . .
use the 1D range structure for that subtree
to filter the y coordinates
(inspecting the points on the path as you go)
How long does a query take?
The paths have length O(log n)
So steps 1. and 2. take O(log n) time
As for step 3,
We do O(log n) 1D lookups. . .
Each takes O(log n + k ) time
This sums to. . .
O(log2 n + k)
because the 1D lookups are disjoint
x1 x2
152. Space Usage
at each node we store an array
the array is sorted by y coordinate
(this gives us a 1D range data structure)
How much space does our 2D range structure use?
containing the points in its subtree
the original (1D) structure used O(n) space. . .
but we added some stuff
153. Space Usage
at each node we store an array
the array is sorted by y coordinate
(this gives us a 1D range data structure)
How much space does our 2D range structure use?
containing the points in its subtree
the original (1D) structure used O(n) space. . .
but we added some stuff
look at any level in the tree
i.e. all nodes at the same distance from the root
154. Space Usage
at each node we store an array
the array is sorted by y coordinate
(this gives us a 1D range data structure)
How much space does our 2D range structure use?
containing the points in its subtree
the original (1D) structure used O(n) space. . .
but we added some stuff
look at any level in the tree
i.e. all nodes at the same distance from the root
the points in these subtrees are disjoint
155. Space Usage
at each node we store an array
the array is sorted by y coordinate
(this gives us a 1D range data structure)
How much space does our 2D range structure use?
containing the points in its subtree
the original (1D) structure used O(n) space. . .
but we added some stuff
look at any level in the tree
i.e. all nodes at the same distance from the root
the points in these subtrees are disjoint
so the sizes of the arrays add up to n
156. Space Usage
at each node we store an array
the array is sorted by y coordinate
(this gives us a 1D range data structure)
How much space does our 2D range structure use?
containing the points in its subtree
the original (1D) structure used O(n) space. . .
but we added some stuff
look at any level in the tree
i.e. all nodes at the same distance from the root
the points in these subtrees are disjoint
so the sizes of the arrays add up to n
As the tree has depth O(log n). . .
157. Space Usage
at each node we store an array
the array is sorted by y coordinate
(this gives us a 1D range data structure)
How much space does our 2D range structure use?
containing the points in its subtree
the original (1D) structure used O(n) space. . .
but we added some stuff
look at any level in the tree
i.e. all nodes at the same distance from the root
the points in these subtrees are disjoint
so the sizes of the arrays add up to n
As the tree has depth O(log n). . .
the total space used is O(n log n)
158. Preprocessing time
How long does it take to build the arrays at the nodes?
How much prep time does our 2D range structure take?
the original (1D) structure used O(n log n) prep time. . .
but we added some stuff
159. Preprocessing time
How long does it take to build the arrays at the nodes?
How much prep time does our 2D range structure take?
the original (1D) structure used O(n log n) prep time. . .
but we added some stuff
160. Preprocessing time
How long does it take to build the arrays at the nodes?
How much prep time does our 2D range structure take?
the original (1D) structure used O(n log n) prep time. . .
but we added some stuff
is just merged with
as and are already sorted,
merging them takes O( ) time
Therefore the total time is O(n log n)
(which is the sum of the lengths of the arrays)
161. 2D range searching
A 2D range searching data structure stores n distinct (x, y)-pairs and supports:
the lookup(x1, x2, y1, y2) operation
which returns every point in the rectangle [x1 : x2] × [y1 : y2]
i.e. every (x, y) with x1 x x2 and y1 y y2.
x1 x2
y1
y2
Summary
O(n log n) prep time
O(n log n) space
O(log2 n + k) lookup time
where k is the number of points reported
162. 2D range searching
A 2D range searching data structure stores n distinct (x, y)-pairs and supports:
the lookup(x1, x2, y1, y2) operation
which returns every point in the rectangle [x1 : x2] × [y1 : y2]
i.e. every (x, y) with x1 x x2 and y1 y y2.
x1 x2
y1
y2
Summary
O(n log n) prep time
O(n log n) space
O(log2 n + k) lookup time
where k is the number of points reported
actually we can improve this :)
163. Improving the query time
3 7 11 19 23 27 35 43 53 61 67
3 7 11 19 23 27 35 43 53 61 67
y1 = 15 y2 = 64
when we do a 2D look-up we do O(log n) 1D lookups. . .
all with the same y1 and y2
(but on different point sets)
164. Improving the query time
3 7 11 19 23 27 35 43 53 61 67
3 7 11 19 23 27 35 43 53 61 67
y1 = 15 y2 = 64
when we do a 2D look-up we do O(log n) 1D lookups. . .
all with the same y1 and y2
(but on different point sets)
The slow part is finding the successor of y1
165. Improving the query time
3 7 11 19 23 27 35 43 53 61 67
3 7 11 19 23 27 35 43 53 61 67
y1 = 15 y2 = 64
when we do a 2D look-up we do O(log n) 1D lookups. . .
all with the same y1 and y2
(but on different point sets)
The slow part is finding the successor of y1
If I told you where this point was, a 1D lookup would only take O(k ) time
(where k is the number of points between y1 and y2)
166. Improving the query time
7
3 7 11 19 23 27 35 43 53 61 67
311 19 23 2735 43 5361 67
The arrays of points at the children
partition the array of the parent
167. Improving the query time
7
3 7 11 19 23 27 35 43 53 61 67
311 19 23 2735 43 5361 67
The arrays of points at the children
partition the array of the parent
168. Improving the query time
7
3 7 11 19 23 27 35 43 53 61 67
311 19 23 2735 43 5361 67
The arrays of points at the children
partition the array of the parent
169. Improving the query time
7
3 7 11 19 23 27 35 43 53 61 67
311 19 23 2735 43 5361 67
The arrays of points at the children
partition the array of the parent
The child arrays are sorted by y coordinate
(but have been partitioned by x coordinate)
170. Improving the query time
7
3 7 11 19 23 27 35 43 53 61 67
311 19 23 2735 43 5361 67
The arrays of points at the children
partition the array of the parent
The child arrays are sorted by y coordinate
(but have been partitioned by x coordinate)
Consider a point in the parent array. . .
171. Improving the query time
7
3 7 11 19 23 27 35 43 53 61 67
311 19 23 2735 43 5361 67
The arrays of points at the children
partition the array of the parent
The child arrays are sorted by y coordinate
(but have been partitioned by x coordinate)
Consider a point in the parent array. . .
172. Improving the query time
7
3 7 11 19 23 27 35 43 53 61 67
311 19 23 2735 43 5361 67
The arrays of points at the children
partition the array of the parent
The child arrays are sorted by y coordinate
(but have been partitioned by x coordinate)
Consider a point in the parent array. . .
173. Improving the query time
7
3 7 11 19 23 27 35 43 53 61 67
311 19 23 2735 43 5361 67
The arrays of points at the children
partition the array of the parent
The child arrays are sorted by y coordinate
(but have been partitioned by x coordinate)
Consider a point in the parent array. . .
we add a link to its successor in both child arrays
(we do this for every point during preprocessing)
174. Improving the query time
7
3 7 11 19 23 27 35 43 53 61 67
311 19 23 2735 43 5361 67
The arrays of points at the children
partition the array of the parent
The child arrays are sorted by y coordinate
(but have been partitioned by x coordinate)
Consider a point in the parent array. . .
we add a link to its successor in both child arrays
(we do this for every point during preprocessing)
175. Improving the query time
7
3 7 11 19 23 27 35 43 53 61 67
311 19 23 2735 43 5361 67
The arrays of points at the children
partition the array of the parent
The child arrays are sorted by y coordinate
(but have been partitioned by x coordinate)
Consider a point in the parent array. . .
we add a link to its successor in both child arrays
(we do this for every point during preprocessing)
177. Improving the query time
7
3 7 11 19 23 27 35 43 53 61 67
311 19 23 2735 43 5361 67
Observation if we know where the successor of y1 is in the
parent, can find the successor in either child in O(1) time
178. Improving the query time
7
3 7 11 19 23 27 35 43 53 61 67
311 19 23 2735 43 5361 67
Observation if we know where the successor of y1 is in the
parent, can find the successor in either child in O(1) time
y1 = 15
y1 = 15 y1 = 15
179. Improving the query time
7
3 7 11 19 23 27 35 43 53 61 67
311 19 23 2735 43 5361 67
Observation if we know where the successor of y1 is in the
parent, can find the successor in either child in O(1) time
y1 = 15
y1 = 15 y1 = 15
adding these links doesn’t increase the space or the prep time
180. The improved query time
Query summary
1. Follow the paths to x1 and x2
2. Discard off-path subtrees where the x coordinates are too large or too small
3. For each off-path subtree where the x coordinates are in range. . .
use the 1D range structure for that subtree
to filter the y coordinates
(updating the successor to y1 as you go)
How long does a query take?
181. The improved query time
Query summary
1. Follow the paths to x1 and x2
2. Discard off-path subtrees where the x coordinates are too large or too small
3. For each off-path subtree where the x coordinates are in range. . .
use the 1D range structure for that subtree
to filter the y coordinates
(updating the successor to y1 as you go)
How long does a query take?
The paths have length O(log n)
182. The improved query time
Query summary
1. Follow the paths to x1 and x2
2. Discard off-path subtrees where the x coordinates are too large or too small
3. For each off-path subtree where the x coordinates are in range. . .
use the 1D range structure for that subtree
to filter the y coordinates
(updating the successor to y1 as you go)
How long does a query take?
The paths have length O(log n)
So steps 1. and 2. take O(log n) time
183. The improved query time
Query summary
1. Follow the paths to x1 and x2
2. Discard off-path subtrees where the x coordinates are too large or too small
3. For each off-path subtree where the x coordinates are in range. . .
use the 1D range structure for that subtree
to filter the y coordinates
(updating the successor to y1 as you go)
How long does a query take?
The paths have length O(log n)
So steps 1. and 2. take O(log n) time
As for step 3,
184. The improved query time
Query summary
1. Follow the paths to x1 and x2
2. Discard off-path subtrees where the x coordinates are too large or too small
3. For each off-path subtree where the x coordinates are in range. . .
use the 1D range structure for that subtree
to filter the y coordinates
(updating the successor to y1 as you go)
How long does a query take?
The paths have length O(log n)
So steps 1. and 2. take O(log n) time
As for step 3,
We do O(log n) 1D lookups. . .
185. The improved query time
Query summary
1. Follow the paths to x1 and x2
2. Discard off-path subtrees where the x coordinates are too large or too small
3. For each off-path subtree where the x coordinates are in range. . .
use the 1D range structure for that subtree
to filter the y coordinates
(updating the successor to y1 as you go)
How long does a query take?
The paths have length O(log n)
So steps 1. and 2. take O(log n) time
As for step 3,
We do O(log n) 1D lookups. . .
Each takes O(k ) time
186. The improved query time
Query summary
1. Follow the paths to x1 and x2
2. Discard off-path subtrees where the x coordinates are too large or too small
3. For each off-path subtree where the x coordinates are in range. . .
use the 1D range structure for that subtree
to filter the y coordinates
(updating the successor to y1 as you go)
How long does a query take?
The paths have length O(log n)
So steps 1. and 2. take O(log n) time
As for step 3,
We do O(log n) 1D lookups. . .
Each takes O(k ) time
This sums to. . .
O(log n + k)
187. 2D range searching
A 2D range searching data structure stores n distinct (x, y)-pairs and supports:
the lookup(x1, x2, y1, y2) operation
which returns every point in the rectangle [x1 : x2] × [y1 : y2]
i.e. every (x, y) with x1 x x2 and y1 y y2.
x1 x2
y1
y2
Summary
O(n log n) prep time
O(n log n) space
O(log n + k) lookup time
where k is the number of points reported
we improved this :)
using fractional cascading