Click here to Skip to main content
15,896,915 members
Home / Discussions / Algorithms
   

Algorithms

 
GeneralRe: algorithm that finds the m smallest numbers in a list of numbers Pin
demo 211-Jun-13 12:33
demo 211-Jun-13 12:33 
GeneralRe: algorithm that finds the m smallest numbers in a list of numbers Pin
Richard MacCutchan11-Jun-13 21:08
mveRichard MacCutchan11-Jun-13 21:08 
GeneralRe: algorithm that finds the m smallest numbers in a list of numbers Pin
Amarnath S11-Jun-13 17:38
professionalAmarnath S11-Jun-13 17:38 
AnswerRe: algorithm that finds the m smallest numbers in a list of numbers Pin
Usman Khalid Butt29-Jun-13 3:24
Usman Khalid Butt29-Jun-13 3:24 
AnswerRe: algorithm that finds the m smallest numbers in a list of numbers Pin
saephoed8-Jan-14 13:02
saephoed8-Jan-14 13:02 
AnswerRe: algorithm that finds the m smallest numbers in a list of numbers Pin
Andy Allinger21-Jan-14 15:24
professionalAndy Allinger21-Jan-14 15:24 
QuestionClosest Ancestor Pin
NGInd7-Jun-13 4:14
NGInd7-Jun-13 4:14 
AnswerRe: Closest Ancestor Pin
Roy Heil14-Jun-13 9:58
professionalRoy Heil14-Jun-13 9:58 
You say it doesn't work, but you don't explain how it doesn't work. Does it error, or just give the wrong answer?

From what I can see, you check to see if root = NULL, which is good. But then you compare the values of root->right->data and root->left->data against n1 and n2. But what if root->right or root->left is NULL? Then it's data will be undefined, and the compare will fail. If it doesn't error out at this point, it may just go on to the else condition, which is fine. But as I said, I don't know how it is failing.
Roy.

QuestionUseage about OPCODE collision detection Pin
Henry Hong4-Jun-13 15:23
Henry Hong4-Jun-13 15:23 
AnswerRe: Useage about OPCODE collision detection Pin
dusty_dex4-Jun-13 18:36
dusty_dex4-Jun-13 18:36 
GeneralRe: Useage about OPCODE collision detection Pin
Henry Hong4-Jun-13 20:03
Henry Hong4-Jun-13 20:03 
GeneralRe: Useage about OPCODE collision detection Pin
Richard MacCutchan4-Jun-13 21:52
mveRichard MacCutchan4-Jun-13 21:52 
GeneralRe: Useage about OPCODE collision detection Pin
SoMad4-Jun-13 22:52
professionalSoMad4-Jun-13 22:52 
GeneralRe: Useage about OPCODE collision detection Pin
Richard MacCutchan4-Jun-13 23:32
mveRichard MacCutchan4-Jun-13 23:32 
GeneralRe: Useage about OPCODE collision detection Pin
dusty_dex4-Jun-13 23:46
dusty_dex4-Jun-13 23:46 
GeneralRe: Useage about OPCODE collision detection Pin
Richard MacCutchan4-Jun-13 23:53
mveRichard MacCutchan4-Jun-13 23:53 
QuestionWeather Prediction using minimal data Pin
nootanghimire16-May-13 23:06
professionalnootanghimire16-May-13 23:06 
AnswerRe: Weather Prediction using minimal data Pin
dusty_dex16-May-13 23:58
dusty_dex16-May-13 23:58 
GeneralRe: Weather Prediction using minimal data Pin
nootanghimire17-May-13 23:50
professionalnootanghimire17-May-13 23:50 
GeneralRe: Weather Prediction using minimal data Pin
dusty_dex18-May-13 2:49
dusty_dex18-May-13 2:49 
GeneralRe: Weather Prediction using minimal data Pin
Dave Kreskowiak29-May-13 18:40
mveDave Kreskowiak29-May-13 18:40 
AnswerRe: Weather Prediction using minimal data Pin
Richard MacCutchan18-May-13 5:42
mveRichard MacCutchan18-May-13 5:42 
AnswerRe: Weather Prediction using minimal data Pin
Joezer BH16-Jun-13 23:29
professionalJoezer BH16-Jun-13 23:29 
QuestionBest autorrelation function Pin
Russell'7-May-13 0:36
Russell'7-May-13 0:36 
QuestionPattern matching in trees, lists and strings alike Pin
bjongejan11-Apr-13 9:19
bjongejan11-Apr-13 9:19 

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.