










Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!











Title Page
Contents
JJ II
J I
Page 1 of 18
Go Back
Full Screen
Close
Title Page
Contents
JJ II
J I
Page 2 of 18
Go Back
Full Screen
Close
Title Page
Contents
JJ II
J I
Page 4 of 18
Go Back
Full Screen
Close
Title Page
Contents
JJ II
J I
Page 5 of 18
Go Back
Full Screen
Close
Title Page
Contents
JJ II
J I
Page 7 of 18
Go Back
Full Screen
Close
Title Page
Contents
JJ II
J I
Page 8 of 18
Go Back
Full Screen
Close
Title Page
Contents
JJ II
J I
Page 10 of 18
Go Back
Full Screen
Close
Title Page
Contents
JJ II
J I
Page 11 of 18
Go Back
Full Screen
Close
f l o a t lowerbound ( R e c t a n g l e r , Point p ) { i f ( r. i n s i d e ( p ) ) return 0 ; i f ( r. l e f t ( p ) ) return r. minX − p. x ; i f ( r. r i g h t ( p ) ) return p. x − r. maxX ; i f ( r. southEastCorner ( p ) )... } R e s u l t p r o c e s s (KDNode k , int cd , R e c t a n g l e r , R e s u l t r e s ) { i f ( k == n u l l ) return r e s ; i f ( lowerbound ( r , q) >= r e s. d i s t a n c e ) return r e s ; f l o a t d i s t = d i s t a n c e ( node. data , query ) ; i f ( d i s t < r e s. d i s t a n c e ) { r e s u l t. p o i n t = node. data ; r e s u l t. d i s t a n c e = d i s t a n c e ( node. data , query ) ; } i f ( q [ cd ] < k. data [ cd ] )... e l s e... return r e s ; }
Title Page
Contents
JJ II
J I
Page 13 of 18
Go Back
Full Screen
Close
Title Page
Contents
JJ II
J I
Page 14 of 18
Go Back
Full Screen
Close
Title Page
Contents
JJ II
J I
Page 16 of 18
Go Back
Full Screen
Close
Title Page
Contents
JJ II
J I
Page 17 of 18
Go Back
Full Screen
Close
i n s e r t Q (KDNode n , f l o a t c o s t , int cd ) { / / i n s e r t i n t o a p r i o r t y Q based on c o s t. / / s t o r e c u t t i n g dimension and node too } i n i t ( ) { r e s u l t. d i s t a n c e = i n f i n i t y ; r e s u l t. p o i n t = n u l l i n s e r t Q (T. r o o t , 0 , 0 ) ; p r o c e s s (Q , r e s u l t ) ; } R e s u l t processQ ( Queue Q , R e s u l t r e s ) { i f ( n u l l (Q) ) return r e s ; int c o s t = Q. e x t r a c t M i n ( ). c o s t ; int cd = Q. e x t r a c t M i n ( ). cd ; KDNode node = Q. d e l e t e M i n ( ) ; i f ( c o s t > r e s. d i s t a n c e ) return r e s ;
... }