473,503 Members | 1,691 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Compare 2 lists to find an equal or approximate match without doing N^2 iteration

1 New Member
I have two lists:
list1:[101,110,136]
list2:[101.04,264.5,379.9,466.4,629.6,724.4,799.8,914.3]

iterate over list1:
compare each element in this list with the elements in the list2,
if there is a number encountered in the 2nd list which is an exact match or an approximate match to the element in list1 then output that match

Note: I want to avoid the N^2 iteration strictly as I want to do it as efficiently as possible; also in all cases I sort both the lists hence both are in ascending order always.

Output should be: 101 and 101.04
Nov 21 '13 #1
2 1842
anmoluppal
7 New Member
hmmmmm ..... I have thought of an algorithm that could be very efficient but it would take some time to develop a working code for that ... I hope you have enough time ... would let you know ASAP if that algo would be implemented efficiently by me .....
Nov 21 '13 #2
dwblas
626 Recognized Expert Contributor
which is an exact match or an approximate match
For an exact match, using sets and subset is the most efficient way. You do not define "approximate" though so there is no way to go further.
Dec 6 '13 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
3612
by: AA Arens | last post by:
When I place a record serch utility (vos the button placement wizzrd), I discovered that the Match setting is "Whole Field" by default. How to make "Any Part Of Field" default?
3
4983
by: Andreas Klemt | last post by:
Hello, how can I clear all ViewStates from a WebUserControl without doing a PostBack ? Thanks in advance, Andreas
2
14614
by: UJ | last post by:
Is there a way with a asp:checkbox to run a JavaScript to display/hide text/input on the screen without doing a postback? I also need to be able to access the stuff at the server so I need to...
3
3834
by: Saber | last post by:
There are some Images (System.Drawing.Image) with same widths and heights, I want to find if 2 images are equal. How can I do it? The following code always returns false: If ...
3
4488
by: sunmat | last post by:
To find number of character without space using java Example: String = prabu sun No. of char =8 plz send me code
2
7205
by: Slippy27 | last post by:
I'm trying to modify a find/replace script which iterates through a file A and makes replacements defined in a csv file B. My original goal was to change any line in file A containing a search string...
6
25180
matthardwick
by: matthardwick | last post by:
Is there a way to make the find box (Ctrl+F) default to match "Any part of field" instead of "Whole field". Thanks in advance. Matt.
7
9845
by: shapper | last post by:
Hello, I have two lists, A and B, of a same class which has two properties: ID and Name A items have only the Name defined. B items have the ID and the Name defined. I want to create a...
2
1714
by: stevenblanc | last post by:
As in the title, Is it possible to create a combobox that has a list visibly wider than itself, i.e. displaying a list with all columns which is wider than the box itself without the need for...
23
14587
by: tetsuo2030 | last post by:
Hi all, I have two fields in a query: and . is a list of comma-separated paragraph numbers (like 1.0, 1.1, 1.1.2, etc); is just "1.0" or "1.1.2" or the like. I wanted to create a third field...
0
7278
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7328
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6991
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7458
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5013
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3167
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
380
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.