AUGMENTED Notes STRUCTURES DATA - Luc...

26
AUGMENTED DATA STRUCTURES ( Notes by Flava Mertens )

Transcript of AUGMENTED Notes STRUCTURES DATA - Luc...

Page 1: AUGMENTED Notes STRUCTURES DATA - Luc Devroyeluc.devroye.org/HenriMertens-AugmentedDataStructures-2019.pdfdata structures (notes by flava mertens) augmented data structures examples:

AUGMENTEDDATA

STRUCTURES

(Notes

by Flava Mertens )

Page 2: AUGMENTED Notes STRUCTURES DATA - Luc Devroyeluc.devroye.org/HenriMertens-AugmentedDataStructures-2019.pdfdata structures (notes by flava mertens) augmented data structures examples:

AUGMENTED DATA STRUCTURES

EXAMPLES :

DATA PARTICIPATING IN SEVERAL DATA STRUCTURES

SEARCH TREES t Lists

ORDER STATISTICS TREES

INTERVAL TREESLEVEL - LINKING IN RED-BLACK TREES

BINARY SPACE PARTITION TREESk -

d TREESQVADTREES

Page 3: AUGMENTED Notes STRUCTURES DATA - Luc Devroyeluc.devroye.org/HenriMertens-AugmentedDataStructures-2019.pdfdata structures (notes by flava mertens) augmented data structures examples:

MULTIPLE DATA STRUCTURES

DATA DATASTRUCTURE I STRUCTURE 2

.#Be

Hageman)

Page 4: AUGMENTED Notes STRUCTURES DATA - Luc Devroyeluc.devroye.org/HenriMertens-AugmentedDataStructures-2019.pdfdata structures (notes by flava mertens) augmented data structures examples:

BINARY SEARCH TREE t LIST

⑥BINARY SEARCH TREE

- -

②⑨£to£ToIHo.

.

DOUBLE LIN#¥

Page 5: AUGMENTED Notes STRUCTURES DATA - Luc Devroyeluc.devroye.org/HenriMertens-AugmentedDataStructures-2019.pdfdata structures (notes by flava mertens) augmented data structures examples:

A CELL-

.

apparent( for BST )

re-EYE÷grnat÷ .

. . .

Page 6: AUGMENTED Notes STRUCTURES DATA - Luc Devroyeluc.devroye.org/HenriMertens-AugmentedDataStructures-2019.pdfdata structures (notes by flava mertens) augmented data structures examples:

UPDATES after INSERT,

DELETE

2

& ,f§ E ⇒ ¥0www.af Raw Insert

£ 'D•

eO Rotation :

§to⇒§% Nodauteneeded ?a bbb bbBYEAb Dts

Page 7: AUGMENTED Notes STRUCTURES DATA - Luc Devroyeluc.devroye.org/HenriMertens-AugmentedDataStructures-2019.pdfdata structures (notes by flava mertens) augmented data structures examples:

ORDER STATISTICS TREE (A. D.T. )✓a red - black tree

= BINARY SEARCH TREE that handles theseadditional operations in 0 Clog n ) time :

RANK ( ⑨ ①TPointa to root

Returns rank of\ mode in tree element a

( smallest = I

,

CLE ke n largest

= n )

SELE a- ( ⑧t ) Returns k-

th smallestitem in tree t

Page 8: AUGMENTED Notes STRUCTURES DATA - Luc Devroyeluc.devroye.org/HenriMertens-AugmentedDataStructures-2019.pdfdata structures (notes by flava mertens) augmented data structures examples:

parent Ca )

Cella:

finna.

. . .

Size of subtree of x : Verify that we can still do INSERT,

DELETE in a red - black tree in

time 0 Clegal .

Verify that RANK,

SELECT can be

done in time Olly n ) .

Page 9: AUGMENTED Notes STRUCTURES DATA - Luc Devroyeluc.devroye.org/HenriMertens-AugmentedDataStructures-2019.pdfdata structures (notes by flava mertens) augmented data structures examples:

INSERT,

DELETE

O ± ,

R node added or deleted :

I only nicely ), for y

Canasta ofa)Of' is affected , byte .Ottfteeedratiou :¥¥'÷. i..

Mr A is

A1¥only one mode changes its

"size

" field .

Page 10: AUGMENTED Notes STRUCTURES DATA - Luc Devroyeluc.devroye.org/HenriMertens-AugmentedDataStructures-2019.pdfdata structures (notes by flava mertens) augmented data structures examples:

SELECTh -

th smallest

- root

if t= nil then return "nonsense

" I D.else if bftftt-niltkf.LI?afeeftfED+t/rEukoffot/case r=k : return A

k - r : return SELECT Ck, left- ft ] )k > r : return Sensei Ck - e

, right ft )

Time -- Olga)

Page 11: AUGMENTED Notes STRUCTURES DATA - Luc Devroyeluc.devroye.org/HenriMertens-AugmentedDataStructures-2019.pdfdata structures (notes by flava mertens) augmented data structures examples:

RANKGO.to

not

Toothmode

b§#tavcbdlgyo_0

ifbftlxfzmlelheu b fo 'D

else 'D

yea D 'Dwhile yttdo :

if night fpareutly'D-_y

RANK - It

[email protected]

. -parent fit ]time -00gal

Page 12: AUGMENTED Notes STRUCTURES DATA - Luc Devroyeluc.devroye.org/HenriMertens-AugmentedDataStructures-2019.pdfdata structures (notes by flava mertens) augmented data structures examples:

INTERVAL TREES

augmentedto deal with these operations :

redhead BEEF.

retard

MAKENULL

parentbe ]OVERLAP

, ④t ) : report. if internal i overlapswith

any giveninterval

CELL a

✓man high l . ] in subtree

- red .aaaaa qq.gg

leftby right la] Aall stores an intend flow,high ]

.

Page 13: AUGMENTED Notes STRUCTURES DATA - Luc Devroyeluc.devroye.org/HenriMertens-AugmentedDataStructures-2019.pdfdata structures (notes by flava mertens) augmented data structures examples:

EXAMPLE

. 6¥."

a #

m

if Max = 18

ma a- 6

Page 14: AUGMENTED Notes STRUCTURES DATA - Luc Devroyeluc.devroye.org/HenriMertens-AugmentedDataStructures-2019.pdfdata structures (notes by flava mertens) augmented data structures examples:

INSERT,

DELETE : Eggto update"

man"

.

All operations Olley a) .

OVERLAP,

(④wt"d_soot of tree e

.

ift -

- nil thenreturn"

no overlap"

hen jhE

else if i overlaps flow Ct ] , high Ct ] ] .

then return "

overlap"

else if left It I # nil and low GI

EmanI left

It] ]

then return OVERLAP- fi

, left It ] )else return OVER LAI Ii

, right Et] )

i 1¥ i

1-1 O 1-1 Two cases :

A

Page 15: AUGMENTED Notes STRUCTURES DATA - Luc Devroyeluc.devroye.org/HenriMertens-AugmentedDataStructures-2019.pdfdata structures (notes by flava mertens) augmented data structures examples:

APPLICATION :

CHiPs OUTLAY DESIGN

a(a)

DETIRphimnirr-offffeu.ISOVER LAI in A COLLECTION

Page 16: AUGMENTED Notes STRUCTURES DATA - Luc Devroyeluc.devroye.org/HenriMertens-AugmentedDataStructures-2019.pdfdata structures (notes by flava mertens) augmented data structures examples:

SWELL LINE ALGORITHM= interval tree

④I

t

Li

MAKEN U LL

Sort Cadi! , Bili ! .

K '

For all sorted elements,⇒qayeqs" sweep"

If element is some"

ai"

,then

if Ortrud ( bei, yil ,

t ) then exit"

overate"

else INSERT (Cai, y ;) ,

t )If element is some

"

Gi"

,then DELETE ( ( ni , yil ,

t )

Note Overlap occurs ⇒ at some point,two " line "

intervals overlap .

Page 17: AUGMENTED Notes STRUCTURES DATA - Luc Devroyeluc.devroye.org/HenriMertens-AugmentedDataStructures-2019.pdfdata structures (notes by flava mertens) augmented data structures examples:

LEVEL LINKING IN RED BLACK TREES

Use : Browsing operations ( NEXT,

NEXT ok,

PreviousPREVIOUS - k )

Pringle :

°

RED-BLACK TREE / ) orLevel linking

O O

¥1I ) fleabag)0 O O 0 0KLAN:*

O ° 0 0 O 0 0 O 0 0

2-3-4 tree view

of a red -black tree

Page 18: AUGMENTED Notes STRUCTURES DATA - Luc Devroyeluc.devroye.org/HenriMertens-AugmentedDataStructures-2019.pdfdata structures (notes by flava mertens) augmented data structures examples:

SEARCH FOR KEY

⑨WHEN AT a

, if L > key Ca)

assume they Cjfk

-

✓font overshoot of y

I-÷⇒IT'

Search:"" a A ::÷n¥ .

.¥-5 Down tog .

DX !gateau aegean

Page 19: AUGMENTED Notes STRUCTURES DATA - Luc Devroyeluc.devroye.org/HenriMertens-AugmentedDataStructures-2019.pdfdata structures (notes by flava mertens) augmented data structures examples:

#

.

THEM# • I This ONE* . *.⇐÷÷÷i¥*÷÷⇒÷

LOOKING for

GOTOWARDS ROOT hey Cy ]UNTIL RIGHT - LEVEL

.

NEIGHBOR OVERSHOOTS

THEN DESCEND TO y ( STANDARD SEARCH )

Page 20: AUGMENTED Notes STRUCTURES DATA - Luc Devroyeluc.devroye.org/HenriMertens-AugmentedDataStructures-2019.pdfdata structures (notes by flava mertens) augmented data structures examples:

TROUBLE ↳ : Time could be ④Heyn)

even thoughf Rankly) - Randal =L

.

I¥y

REMEDY : Maintain standard "meat"

list and do this :

ED nearest

(2) from a, find y as explained earlier .

←÷→%¥, Eseaasecbnd ) : Times

←÷ HOAG,(Rankly ) - Rankin ) )

.

Page 21: AUGMENTED Notes STRUCTURES DATA - Luc Devroyeluc.devroye.org/HenriMertens-AugmentedDataStructures-2019.pdfdata structures (notes by flava mertens) augmented data structures examples:

k - d TREES Used to store data in RdFor partitions of Rd

1

At directions

→G,•

& " "at * s

¥µ¥7Y÷ay¥• " "

÷"§bbbm%"

\ -

in.÷⇒ %Mtgat # y my Lalorat # a

Leafq②

Binary Tree.

Page 22: AUGMENTED Notes STRUCTURES DATA - Luc Devroyeluc.devroye.org/HenriMertens-AugmentedDataStructures-2019.pdfdata structures (notes by flava mertens) augmented data structures examples:

Operations : INSERT,

DELETE ,

2 - d Tree

SEARCH for Ca, y )

SEARCH for La,

* ) ! PARTIAL MATCH SEARCH

SEARCH for ( Ayy ) i " " "

REPORT all points in 1-Id :

a- .a

R= @by × fed ] RANGE SEARCH.

Range search :

Recursively visit all subtrees whoseregion

intersect . R

and catgut all points frig . ) that fall in R.

Page 23: AUGMENTED Notes STRUCTURES DATA - Luc Devroyeluc.devroye.org/HenriMertens-AugmentedDataStructures-2019.pdfdata structures (notes by flava mertens) augmented data structures examples:

Outline of rangesearch

cellypareat

Given : rectangle R=↳p×↳d]

Dupontk -d trot left right

Range Search ( R ,t )

%ef-qqa.pe.

und

Ift # nil and

Ramattail react ]

then point a Rtheuotptpointct ]

Areact ]

. itrauge Search ( R, left ft )¥Y:"" " " '

↳ -

left

.TT#TightftT

Page 24: AUGMENTED Notes STRUCTURES DATA - Luc Devroyeluc.devroye.org/HenriMertens-AugmentedDataStructures-2019.pdfdata structures (notes by flava mertens) augmented data structures examples:

QUAD TREES for point . in IRD i and-

anysearch trees

%÷÷.

Used in aaupta graphics .

Range search as far k -d trees

.

Page 25: AUGMENTED Notes STRUCTURES DATA - Luc Devroyeluc.devroye.org/HenriMertens-AugmentedDataStructures-2019.pdfdata structures (notes by flava mertens) augmented data structures examples:

B SI TREES (Binary Space Partition Trees )= = =

Used to render Ipaint

fira screen ) a scene

been from a given viewpoint⑥

on/ameVIEWING D

ang ⇐§¥yg¥.

③ B

n .Egad

.

ahiesepsmgameetaasno. .

£-1.②

the BSI tree,

and separates the separate theobjects

region it delays to into two parts .

Page 26: AUGMENTED Notes STRUCTURES DATA - Luc Devroyeluc.devroye.org/HenriMertens-AugmentedDataStructures-2019.pdfdata structures (notes by flava mertens) augmented data structures examples:

BSP tree-

t = side of viewer

/ \ -= far side

-02+035-

a mode correspondsta

- £¥ to a line segment

+ -

f k¥13 }•. -

object. are leaves

I IE D Pamtfonhm: Traverse in - t

order to render the objects .

Panning the viewingdirection : only flip some - t polarities .