Click here to Skip to main content
15,888,239 members
Home / Discussions / Algorithms
   

Algorithms

 
AnswerRe: "Best Fit" Algorithm Request && Teach A Man To Fish Pin
Tadeusz Westawic23-Apr-10 3:57
Tadeusz Westawic23-Apr-10 3:57 
QuestionCSMA / CA Pin
hairy_hats14-Apr-10 4:59
hairy_hats14-Apr-10 4:59 
AnswerRe: CSMA / CA Pin
Anshul R9-Jun-10 4:14
Anshul R9-Jun-10 4:14 
QuestionBeating LabView's "Spreadsheet String To Array" function Pin
PaulowniaK7-Apr-10 20:21
PaulowniaK7-Apr-10 20:21 
AnswerRe: Beating LabView's "Spreadsheet String To Array" function Pin
Phil Martin7-Apr-10 20:29
professionalPhil Martin7-Apr-10 20:29 
AnswerRe: Beating LabView's "Spreadsheet String To Array" function Pin
J. Dunlap7-Apr-10 20:53
J. Dunlap7-Apr-10 20:53 
AnswerRe: Beating LabView's "Spreadsheet String To Array" function Pin
AspDotNetDev7-Apr-10 23:06
protectorAspDotNetDev7-Apr-10 23:06 
AnswerRe: Beating LabView's "Spreadsheet String To Array" function Pin
CPallini15-Apr-10 23:23
mveCPallini15-Apr-10 23:23 
This (plain C) takes 1 ms circa on my system (Dual Core 1.8 GHz).
// Args:
//  txt: the string
//  txt_size: the string size (including the NULL terminator)
//  a: the int array
//  max_count: the int array size.
// Returns: the number of found integers.
// Remark: if the string contains more integers than array capacity, only max_count integers will be returned.
int get_all_numbers( const char * txt, int txt_size, int * a, int max_count)
{
  const char * p0 = txt;
  const char * p1 = NULL;
  const char * guard = p0+txt_size-1;
  int count = 0;
  while (p1 < guard && count < max_count)
  {
    a[count++] = (int) strtol(p0, (char**)&p1, 10);
    p0 = p1;  
  }
  return count;
}

Smile | :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.

This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke

[My articles]

Question15 puzzle solution in C or C++ Pin
123lucy457-Apr-10 5:25
123lucy457-Apr-10 5:25 
AnswerRe: 15 puzzle solution in C or C++ Pin
Luc Pattyn7-Apr-10 5:56
sitebuilderLuc Pattyn7-Apr-10 5:56 
GeneralRe: 15 puzzle solution in C or C++ Pin
Paul Conrad7-Apr-10 6:35
professionalPaul Conrad7-Apr-10 6:35 
AnswerRe: 15 puzzle solution in C or C++ Pin
Dave Kreskowiak7-Apr-10 7:03
mveDave Kreskowiak7-Apr-10 7:03 
GeneralRe: 15 puzzle algorithm in C or C++ Pin
123lucy457-Apr-10 16:11
123lucy457-Apr-10 16:11 
GeneralRe: 15 puzzle algorithm in C or C++ Pin
Luc Pattyn7-Apr-10 17:07
sitebuilderLuc Pattyn7-Apr-10 17:07 
GeneralRe: 15 puzzle algorithm in C or C++ Pin
Dave Kreskowiak7-Apr-10 17:42
mveDave Kreskowiak7-Apr-10 17:42 
GeneralRe: 15 puzzle algorithm in C or C++ Pin
Alan Balkany9-Apr-10 4:28
Alan Balkany9-Apr-10 4:28 
QuestionA simple algorithm request Pin
Michael J. Eber24-Mar-10 13:19
Michael J. Eber24-Mar-10 13:19 
AnswerRe: A simple algorithm request Pin
Amar Chaudhary24-Mar-10 15:25
Amar Chaudhary24-Mar-10 15:25 
AnswerRe: A simple algorithm request Pin
Dr.Walt Fair, PE24-Mar-10 15:29
professionalDr.Walt Fair, PE24-Mar-10 15:29 
AnswerRe: A simple algorithm request Pin
Luc Pattyn24-Mar-10 15:54
sitebuilderLuc Pattyn24-Mar-10 15:54 
QuestionFilling a cylinder or a tube Pin
Valeriant20-Mar-10 17:46
Valeriant20-Mar-10 17:46 
AnswerRe: Filling a cylinder or a tube Pin
Moreno Airoldi21-Mar-10 0:08
Moreno Airoldi21-Mar-10 0:08 
GeneralRe: Filling a cylinder or a tube Pin
Valeriant21-Mar-10 4:46
Valeriant21-Mar-10 4:46 
GeneralRe: Filling a cylinder or a tube Pin
Moreno Airoldi21-Mar-10 8:33
Moreno Airoldi21-Mar-10 8:33 
GeneralRe: Filling a cylinder or a tube Pin
Valeriant21-Mar-10 16:36
Valeriant21-Mar-10 16:36 

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.