Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

how to search for intervals in multiple columns?
hi

i have a dataset consisting of an array of arrays.

$data = [
[q_beg1, q_end1, s_beg1, s_end1]
[q_beg2, q_end2, s_beg2, s_end2]
[q_beg3, q_end3, s_beg3, s_end3]
..
]

q_beg, q_end, s_beg, s_end are all integers.


now, i would like to find all rows where q_beg and q_end are within one
interval (int1_beg, int1_end) while s_beg and s_end are within another
interval (int2_beg, int2_end).

this can be done with grep:

grep {$_->[0] < int1_beg and $_->[1] > int1_end and
$_->[2] < int2_beg and $_->[3] > int2_end} @$data;


however, this is too slow for my purpose. so how to speed up such
selection?

the query would be simple enough in a relational database, however i
want to avoid using a database using tables on disk.

i should think this was a pretty generic problem.


ideas are most welcome !


best regards


martin

Report this thread to moderator Post Follow-up to this message
Old Post
Martin A. Hansen
10-28-04 08:57 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PERL Beginners archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:08 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.