Click here to Skip to main content
16,005,339 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Graceful Exit Upon Error Pin
prasad_som20-Mar-07 23:10
prasad_som20-Mar-07 23:10 
GeneralRe: Graceful Exit Upon Error Pin
softwaremonkey21-Mar-07 6:29
softwaremonkey21-Mar-07 6:29 
QuestionRendering MSI package through customized UI Pin
LiYS20-Mar-07 22:03
LiYS20-Mar-07 22:03 
QuestionAbout an error Pin
iayd20-Mar-07 21:53
iayd20-Mar-07 21:53 
AnswerRe: About an error Pin
Paresh Chitte20-Mar-07 22:02
Paresh Chitte20-Mar-07 22:02 
GeneralRe: About an error Pin
iayd20-Mar-07 22:45
iayd20-Mar-07 22:45 
AnswerRe: About an error Pin
prasad_som20-Mar-07 22:55
prasad_som20-Mar-07 22:55 
QuestionLinearSearch to BinarySearch Pin
stealwings20-Mar-07 21:41
stealwings20-Mar-07 21:41 
I have this code that does a linear search within two files, but it is too slow......
/************SEARCH AND COMPARE, THEN REPLACE IF MATCH IS TRUE.******************/<br />
	<br />
for(unsigned i=0;i<Standard.size();i++) <br />
{<br />
for(unsigned j=0;j<MyWords.size();j++)  <br />
//each MyWords compare to the Standard <br />
//and see if it is in the standard vector<br />
{<br />
string::size_type FoundAt=MyWords[i].find(Standard[j]);<br />
while( string::npos != FoundAt )<br />
{<br />
 MyWords[i].replace( FoundAt, Standard[j].length(),Standard[j]+"/");<br />
//cout<< MyWords[i]<< endl;<br />
FoundAt = MyWords[i].find( Standard[j], FoundAt + Standard[j].length() );<br />
}<br />
}<br />
}<br />
/***********************************Create output file****************************************/<br />
for(unsigned j=0;j<MyWords.size();j++)	<br />
// for each word in MyWords vector  <br />
{<br />
WriteWord<<MyWords[j]<<endl;// write it to the destination file<br />
	}<br />
	WriteWord.flush();							// flush the memory to ensure all is written to the file<br />
	WriteWord.close();	*/						// close the write file handls<br />
	return 0;<br />
}<br />


I want to change it into [I]binarysearch so it will perform faster, but the problem is I don't know how can I do that, I mean, if I change it to binarysearch the structure itself will have to be changed. I have the following questions that I can't solve so the binarysearch can be done:
1. Cut the sentences into words.
2. Compare first word of the sentences and see if matches, if match take second and so on till a phrase in my standard file is formed. Otherwise, discard word.
e.g. Lets say I have a sentences "This world is full of beauty!" and I have in my sorted array the phrase "full of beauty", I would like to take each word of the sentence to and compare it with my array like the following:
1. Take the word "This", since it doesn't match delete it
2. Take the word "world", since it doesn't match delete it.
3. and so on until "full", since "full" is part of my phrase "full of beauty" conserve it and take the next and compare it, and so on till I get the full phrase "full of beauty" then return that the phrase was found.
Hope someone can give me some hint, I really need to get this thing to work, and want to get it work myself but I really can't do. Thanks in advance to all.

Regards
Jing
AnswerRe: LinearSearch to BinarySearch Pin
led mike21-Mar-07 4:41
led mike21-Mar-07 4:41 
GeneralRe: LinearSearch to BinarySearch Pin
stealwings21-Mar-07 7:42
stealwings21-Mar-07 7:42 
GeneralRe: LinearSearch to BinarySearch Pin
led mike21-Mar-07 10:18
led mike21-Mar-07 10:18 
QuestionConvert jpeg image into mpeg-1 Pin
yudhisthira20-Mar-07 21:13
yudhisthira20-Mar-07 21:13 
AnswerRe: Convert jpeg image into mpeg-1 Pin
Mark Salsbery21-Mar-07 7:32
Mark Salsbery21-Mar-07 7:32 
QuestionProblem with SendMessage. Pin
uday kiran janaswamy20-Mar-07 21:02
uday kiran janaswamy20-Mar-07 21:02 
AnswerRe: Problem with SendMessage. Pin
Cedric Moonen20-Mar-07 21:05
Cedric Moonen20-Mar-07 21:05 
GeneralRe: Problem with SendMessage. Pin
uday kiran janaswamy20-Mar-07 21:14
uday kiran janaswamy20-Mar-07 21:14 
GeneralRe: Problem with SendMessage. Pin
Cedric Moonen20-Mar-07 21:32
Cedric Moonen20-Mar-07 21:32 
GeneralRe: Problem with SendMessage. Pin
ThatsAlok20-Mar-07 22:31
ThatsAlok20-Mar-07 22:31 
GeneralRe: Problem with SendMessage. Pin
David Crow21-Mar-07 3:48
David Crow21-Mar-07 3:48 
GeneralRe: Problem with SendMessage. Pin
uday kiran janaswamy21-Mar-07 3:53
uday kiran janaswamy21-Mar-07 3:53 
Questioncalculating combobox height Pin
lee2320-Mar-07 20:56
lee2320-Mar-07 20:56 
QuestionDisplaying Advertisement in Windows Application. Pin
Sameerkumar Namdeo20-Mar-07 20:40
Sameerkumar Namdeo20-Mar-07 20:40 
QuestionHow to control the frame rate in DirectShow? Pin
houari_id20-Mar-07 20:23
houari_id20-Mar-07 20:23 
AnswerRe: How to get frame rate in DirectShow? Pin
siddharthsan20-Mar-07 22:06
siddharthsan20-Mar-07 22:06 
GeneralRe: How to get frame rate in DirectShow? Pin
houari_id21-Mar-07 1:20
houari_id21-Mar-07 1:20 

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.