Click here to Skip to main content
16,014,940 members
Home / Discussions / Algorithms
   

Algorithms

 
GeneralRe: GENETIC ALGORITHM FOR BUS ROUTE NETWORK DESIGN, help me Pin
Dan Neely8-Dec-06 9:16
Dan Neely8-Dec-06 9:16 
GeneralRe: GENETIC ALGORITHM FOR BUS ROUTE NETWORK DESIGN, help me Pin
DHIRAJ SHETI8-Dec-06 19:14
DHIRAJ SHETI8-Dec-06 19:14 
GeneralRe: GENETIC ALGORITHM FOR BUS ROUTE NETWORK DESIGN, help me Pin
DHIRAJ SHETI8-Dec-06 19:10
DHIRAJ SHETI8-Dec-06 19:10 
Questionfirst occurence of multiple search terms in a string Pin
peterchen5-Dec-06 16:55
peterchen5-Dec-06 16:55 
AnswerRe: first occurence of multiple search terms in a string Pin
Frank Kerrigan5-Dec-06 23:30
Frank Kerrigan5-Dec-06 23:30 
GeneralRe: first occurence of multiple search terms in a string Pin
peterchen6-Dec-06 1:21
peterchen6-Dec-06 1:21 
AnswerRe: first occurence of multiple search terms in a string Pin
Bassam Abdul-Baki6-Dec-06 8:27
professionalBassam Abdul-Baki6-Dec-06 8:27 
AnswerRe: first occurence of multiple search terms in a string Pin
szukuro7-Dec-06 1:02
szukuro7-Dec-06 1:02 
peterchen wrote:
I have a map(string org, string new) with string replacements, and a data string. In data, replace all occurences of "org" by "new".

(Brute force: assuming that org and new strings don't overlap, do a string.replacealloccurences(org,new) for each replacement pair)


A way would be to do the replacements in the right order. If you have two pairs, and the "new" of the first one is the same as the "old" of the second, then you need to do the second replacement first, so the "new" values from the first don't get replaced. For n pairs a solution would look like this (in pseudocode):

for 0 to number of pairs
   foreach pair of replacements in alreadyadded
      if new pair."old" is the same as currentpair."new"
         insert pair before currentpair and break loop
   end
   if not inserted yet insert at the end
end for

AnswerRe: first occurence of multiple search terms in a string Pin
ricecake7-Dec-06 3:22
ricecake7-Dec-06 3:22 
AnswerRe: first occurence of multiple search terms in a string Pin
A.A.7-Dec-06 3:28
A.A.7-Dec-06 3:28 
GeneralRe: first occurence of multiple search terms in a string Pin
peterchen9-Dec-06 3:05
peterchen9-Dec-06 3:05 
AnswerRe: first occurence of multiple search terms in a string Pin
Harald Krause11-Dec-06 4:33
Harald Krause11-Dec-06 4:33 
Questionfingerprint recognition algorithm Pin
Alex19823-Dec-06 20:41
Alex19823-Dec-06 20:41 
AnswerRe: fingerprint recognition algorithm Pin
Bradml4-Dec-06 0:47
Bradml4-Dec-06 0:47 
AnswerRe: fingerprint recognition algorithm Pin
Frank Kerrigan4-Dec-06 3:07
Frank Kerrigan4-Dec-06 3:07 
GeneralRe: fingerprint recognition algorithm Pin
Paul Conrad5-Dec-06 11:30
professionalPaul Conrad5-Dec-06 11:30 
AnswerRe: fingerprint recognition algorithm Pin
Tal Even-Tov8-Dec-06 9:40
Tal Even-Tov8-Dec-06 9:40 
Questionproblem in algorithm!! Pin
CHELA FE3-Dec-06 16:16
CHELA FE3-Dec-06 16:16 
AnswerRe: problem in algorithm!! Pin
Are Jay3-Dec-06 17:52
Are Jay3-Dec-06 17:52 
AnswerRe: problem in algorithm!! Pin
David Crow5-Dec-06 4:56
David Crow5-Dec-06 4:56 
QuestionPolygon Union/intersect Pin
rpz27-Nov-06 8:29
rpz27-Nov-06 8:29 
GeneralMath whiz's ending could score $100K Pin
Bassam Abdul-Baki26-Nov-06 16:46
professionalBassam Abdul-Baki26-Nov-06 16:46 
GeneralRe: Math whiz's ending could score $100K Pin
Shog926-Nov-06 16:49
sitebuilderShog926-Nov-06 16:49 
GeneralRe: Math whiz's ending could score $100K Pin
Paul Conrad26-Nov-06 17:22
professionalPaul Conrad26-Nov-06 17:22 
QuestionHow to Read 12 Digit UPC Barcodes Pin
Bassam Abdul-Baki22-Nov-06 4:13
professionalBassam Abdul-Baki22-Nov-06 4:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.