Data structure for ordered sequence

J

jm.suresh

Dear all,
I am looking for a data structure to hold rectangles in a 2d space.
Please point me to any module which does these operations:
Insert a rectangle into a particular co-ordinate.
Get the rectangle/s right/left/above/below side to a particular
rectangle.
Get all the rectangles within a box
Delete a particular rectangle.
 
F

Fredrik Lundh

> unless this is homework because the pil people will not let
you distribute pils.

I'm not sure I can parse this sentence fragment. What do you mean?

</F>
 
F

Fredrik Lundh

I am looking for a data structure to hold rectangles in a 2d space.
Please point me to any module which does these operations:
Insert a rectangle into a particular co-ordinate.
Get the rectangle/s right/left/above/below side to a particular
rectangle.
Get all the rectangles within a box
Delete a particular rectangle.

how many rectangles do you plan to store in this structure?

</F>
 
H

Hendrik van Rooyen

I'm not sure I can parse this sentence fragment. What do you mean?

oh come on! - you of all people should know that "pils" means mushroom...

- Hendrik
 
S

Steve Holden

Hendrik said:
oh come on! - you of all people should know that "pils" means mushroom...
Cue yet another appearance of badgerbadgerbadger?

regards
Steve
 
R

robert

Around 150 max

And seeking/change frequency? fix dimensions? Probably for a GUI/mouse thing.
=>Not worth worring about a 2D-tree structure. A Python list ? :) Insert/change coordinates at no costs and seek the list with a 3-liner and you are quite fast :) Any sophisticated tree fumbling will cost more.
Or at max use a 1D-btree thing or so for x0,x1 or a fix 16x16 array ..

-robert
 
F

Fredrik Lundh

robert said:
>

And seeking/change frequency? fix dimensions? Probably for a GUI/mouse thing.
=>Not worth worring about a 2D-tree structure. A Python list ? :)
> Insert/change coordinates at no costs and seek the list with a
> 3-liner and you are quite fast :) Any sophisticated tree
> fumbling will cost more.
Or at max use a 1D-btree thing or so for x0,x1 or a fix 16x16 array ..

thanks for writing the reply I didn't get around to write ;-)

</F>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top