Click here to Skip to main content
14,423,065 members
Rate this:
Please Sign up or sign in to vote.
Problem Statement: While matching rules(say l) for an incoming Transactions ( say m) for customers (say k), total comparison operations are k*l*m. If k,l,m are too large then it would cost lots of time with worst time complexity as O(k*l*m). 

Requirement: Less Time Complex Solution, Precision

Happy flow Example:  There are 3 customers C1, C2, C3 and each has a rule R1, R2, R3 respectively.

R1 - Name contains <SYSCO INTL CO>
R2- Name contains <SYSCO INTL>
R3 - Name contains <SYSCO INTL INC>

An OFX/xml file with memo tag for one of the transactions(T1) has name as <SYSCO INTL COM>.

T1*number of rules*number of customers (1*3*3) is easy. However, as transactions list and rules list go high, it will be difficult to make a linear search comparison.

What I have tried:

We tried to use TRIE but was taking more space and time. Which is best Algorithm or Data structure as per requirement above. Need help ASAP.
Updated 5 days ago

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Compare field lengths. The contents don't matter since the strings being compared are different length and the problem domain is known / limited.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100