473,661 Members | 2,432 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

'Best Fit' match with Strings

I have got a sorted vector of pair<string, string> which contains
the following entries:

first string second string
Pair-1: 121721234567890 str1One
Pair-2: 121721234567890 str1
Pair-3: 1217212345 str1One
Pair-4: 1217212345 str1
Pair-5: 12172 str1One
Pair-6: 12172 str1
Pair-7: 12 str1One
Pair-8: 12 str1
I have to retrieve the pair(s) where the input string that I have should
have a 'best-fit' match with the 'first string' of the pair.
E.g.:
Input string:12172123 45
Should match with: Pair-3 & Pair-4

Input string:1217
Should match with: Pair-7 & Pair-8
What is the best way to achieve it?
Can anything from <algorithm> help here?
Jul 22 '05 #1
0 1496

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
5766
by: Ravi | last post by:
Hi, I have about 200GB of data that I need to go through and extract the common first part of a line. Something like this. >>>a = "abcdefghijklmnopqrstuvwxyz" >>>b = "abcdefghijklmnopBHLHT" >>>c = extract(a,b) >>>print c "abcdefghijklmnop"
5
2542
by: Daniel Pryde | last post by:
Hi everyone. I was wondering if anyone might be able to help me out here. I'm currently looking to find the quickest way to find a best fit match in a large array. My problem is that I have an array of, say, 600*400, which contains a value at each point, and I need to find the value in that array which is closest to the input value. It's basically some euclidean distances that I've calculated, and I need to be able to find the best matches...
7
19726
by: Tzanko | last post by:
As we all know, there is a 8060 bytes size limit on SQL Server rows. I have a table which requires a number of text fields (5 or 6). Each of these text fields should support a max of 4000 characters. We currently store the data in varchar columns, which worked fine untill our appetite for text fields increased to the current requirement of 5, 6 fields of 4000 characters size. I am given to review a design, which esentially suggests moving...
4
3137
by: Peter | last post by:
Hi all, I am searching through directories trying to find the prefix to a number of files. Unfortunately the files don't have a standard naming convention yet. So some of them appear as: THH307A.Monitoring Public Health Issues.doc ' A single period THH307A- Monitoring Public Health Issues.doc ' A hyphen, space THH307A Monitoring Public Health Issues.doc ' A single space
2
1536
by: dayanand ramasubbu | last post by:
Hi, I want to get the best possible match for a strings among a list of strings. For eg, my string to be matched is hi/howareyou?rudoingok which needs to be matched against the below list, hi/ hi/howareyou hi/howareyou? hi/howareyou?ru
1
2255
by: Pythor | last post by:
OK I'm trying to create a sql query on our as400. I have a main table like this: acct prf acct no. sku AAA 123 ABCD AAA 123 XYZ I have another table
11
3284
by: Michael | last post by:
I'm new to PHP, I already learned the basics of the language and built some little app's for practice. I have a critical dilemma, soon enough, I probably start to develop real-world applications, fully working web-sites for paying costumers. I have 2 options for doing this: writing everything with plain PHP, or using some PHP framework. I don't want to choose something and the realize that the other is batter. I want to get used for...
4
7663
by: Dylan Nicholson | last post by:
I can write a regular expression that will only match strings that are NOT the word apple: ^(.*|a.*|ap.*|app.*|apple.+)$ But is there a neater way, and how would I do it to match strings that are NOT the word apple OR banana? Then what would be needed to match only strings that do not CONTAIN the word "apple" or "banana" or "cherry"?
4
1797
by: tinkerbarbet | last post by:
Hi I've read around quite a bit about Unicode and python's support for it, and I'm still unclear about how it all fits together in certain scenarios. Can anyone help clarify? * When I say "# -*- coding: utf-8 -*-" and confirm my IDE is saving the source file as UTF-8, do I still need to prefix all the strings constructed in the source with u as in myStr = u"blah", even when those strings contain only ASCII or ISO-8859-1 chars? (It...
0
8341
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8754
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8630
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7362
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6181
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5650
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2760
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1984
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.