Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

ichimunki's scratchpad

by ichimunki (Priest)
on Jun 02, 2004 at 19:27 UTC ( #359680=scratchpad: print w/ replies, xml ) Need Help??

Answers to Ovid's programmer questions:

1. This is a problem because although efficient on short arrays, it does not scale (i.e. O(n-squared) type algorithm). Better to sort the arrays (or copies of the arrays) first (assuming sortable elements), then you can simply hopscotch along them both comparing elements, and shuttling matches to a new array. Depends on arrays being sorted efficiently.

2.
#!/usr/bin/ruby -w class Array def my_reverse tmp = self.dup #function is destructive new = [] while tmp.size > 0 new.push( tmp.pop ) end return new end end a = ['foo', 'bar', 'baz', 'cheeze whiz'] puts a.my_reverse
3. Request manager gets request, asks translator for standard query form, gives that to DB interface, gives result to output translator. As much as possible the input/output handlers are subclasses of main input and output superclasses . Request manager sets up a queue (FIFO) of requests, each one containing it's own "blackboard" space to be used at will by each of the components. Of course, if the database is a bottleneck, it might be wise to do I/O with one program/thread and queue them to the db program/thread so that request fetching/output is not blocked by this step. Of course output is still throttled by the db, but assuming variable input rate, it should "catch up" during slow request times.
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2014-11-29 03:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (203 votes), past polls