Click here to Skip to main content
15,924,038 members
Home / Discussions / Algorithms
   

Algorithms

 
AnswerRe: Number of Integer Solutions to an Equation [modified] Pin
Alain Rist26-Nov-10 1:50
Alain Rist26-Nov-10 1:50 
Questionfind lower bound Pin
liquid_18-Nov-10 6:11
liquid_18-Nov-10 6:11 
AnswerRe: find lower bound Pin
NeverHeardOfMe18-Nov-10 6:22
NeverHeardOfMe18-Nov-10 6:22 
GeneralRe: find lower bound Pin
liquid_18-Nov-10 20:25
liquid_18-Nov-10 20:25 
GeneralRe: find lower bound Pin
NeverHeardOfMe18-Nov-10 21:49
NeverHeardOfMe18-Nov-10 21:49 
GeneralRe: find lower bound Pin
harold aptroot18-Nov-10 21:35
harold aptroot18-Nov-10 21:35 
AnswerRe: find lower bound Pin
Alain Rist18-Nov-10 23:24
Alain Rist18-Nov-10 23:24 
GeneralRe: find lower bound Pin
liquid_20-Nov-10 11:32
liquid_20-Nov-10 11:32 
Thanks for constructive reply.
Firstly, I used size_t only for shortage of unsigned int. The rest of code is written in pure C and it should be just such - a more universal one.
Secondly, analyzing the std::min_element function it is clear that it has linear complexity. What I tried to aim is logarithmic complexity.
However, comparing my implementation of
lbound(const void* key, void *base, unsigned int nmemb, unsigned int size, int (*compare)(const void *e1, const void *e2))
with bsearch implementation, it seemed to me that my lbound is not so compact and efficient as bsearch standard implementation (two additional checks - size==0 and size==1, and one more comparison after size==1 check).
Maybe its the matter of lower bound specific. bsearch just returns NULL if it does not find a key, lbound returns NULL only if key is lower than first element of table.

Regards
GeneralRe: find lower bound Pin
Alain Rist20-Nov-10 20:04
Alain Rist20-Nov-10 20:04 
GeneralRe: find lower bound Pin
liquid_21-Nov-10 5:09
liquid_21-Nov-10 5:09 
QuestionTIL...... [modified] Pin
NeverHeardOfMe3-Nov-10 23:57
NeverHeardOfMe3-Nov-10 23:57 
AnswerRe: TIL...... Pin
Radhakrishnan G.4-Nov-10 1:40
Radhakrishnan G.4-Nov-10 1:40 
GeneralRe: TIL...... Pin
NeverHeardOfMe4-Nov-10 2:38
NeverHeardOfMe4-Nov-10 2:38 
AnswerRe: TIL...... Pin
Richard MacCutchan4-Nov-10 2:46
mveRichard MacCutchan4-Nov-10 2:46 
GeneralRe: TIL...... Pin
NeverHeardOfMe4-Nov-10 2:57
NeverHeardOfMe4-Nov-10 2:57 
GeneralRe: TIL...... Pin
Richard MacCutchan4-Nov-10 3:24
mveRichard MacCutchan4-Nov-10 3:24 
GeneralRe: TIL...... Pin
NeverHeardOfMe4-Nov-10 3:28
NeverHeardOfMe4-Nov-10 3:28 
GeneralRe: TIL...... Pin
Richard MacCutchan4-Nov-10 6:09
mveRichard MacCutchan4-Nov-10 6:09 
GeneralRe: TIL...... Pin
NeverHeardOfMe4-Nov-10 6:15
NeverHeardOfMe4-Nov-10 6:15 
AnswerRe: TIL...... Pin
Luc Pattyn4-Nov-10 4:56
sitebuilderLuc Pattyn4-Nov-10 4:56 
GeneralRe: TIL...... Pin
NeverHeardOfMe4-Nov-10 5:18
NeverHeardOfMe4-Nov-10 5:18 
AnswerRe: TIL...... Pin
Luc Pattyn4-Nov-10 6:10
sitebuilderLuc Pattyn4-Nov-10 6:10 
GeneralRe: TIL...... Pin
NeverHeardOfMe4-Nov-10 6:39
NeverHeardOfMe4-Nov-10 6:39 
GeneralRe: TIL...... Pin
redbones10-Nov-10 1:03
redbones10-Nov-10 1:03 
AnswerRe: TIL...... Pin
Luc Pattyn4-Nov-10 4:58
sitebuilderLuc Pattyn4-Nov-10 4:58 

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.