Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Efficient Integer Comparison Algorithm

Reply
Thread Tools

Efficient Integer Comparison Algorithm

 
 
Robert Klemme
Guest
Posts: n/a
 
      03-06-2008
On 06.03.2008 15:48, http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Thanks Robert! I now have a better understanding of the problem and a
> clear picture on how to proceed.


I am not so sure. Or maybe *I* did not understand everything properly.
Your explanation below seems to deal with three data sources. From
what I read earlier I understood that you have two sources: the Oracle
DB and your local data in a file.

> This is what I intend to do based on all your suggestions:
> 1. Create an external Oracle table for the external file input.
> 2. Read in records from my local DB in a sorted order and load them as
> a pair type into a HashSet.


If you make your local DB available as external table in Oracle then you
can simply do the matching in the DB via a join. The ResultSet from the
join then contains only matching records and you can directly output these.

> 3. Query the external table and for each row create a temporary
> instance of the class and look it up in the set. This is done by
> iterating through the ResultSet and local data and comparing each.
> a. If the first ordered column in the local store data is less than
> in the DB data, increase it until they are same or greater.
> b. If same do the same for the second column until a match is found
> or the end of one of the two sources is reached.


No. If you have read the local data in a Set or Map already you need to
only look the Oracle data up via the temp instance in the Set / Map. No
additional iterating tricks needed.

> 4. I would wrap the matches in XML tags and stream it out.
>
> Thanks a lot for all your help!!!


You're welcome.

Kind regards

robert
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
more efficient date range comparison Dave Woodworth Ruby 7 04-16-2009 11:54 AM
Most efficient way to do set-comparison Krishna Chaitanya Perl Misc 17 03-23-2009 07:54 AM
Most efficient algorithm for matching Timasmith Java 36 02-16-2007 11:02 PM
efficient therm-2-bin algorithm vishallko31@gmail.com VHDL 6 06-13-2006 04:48 PM
Efficient double comparison Dave C++ 2 03-05-2004 09:38 AM



Advertisments