Click here to Skip to main content
15,887,214 members
Home / Discussions / Algorithms
   

Algorithms

 
GeneralRe: Fastest way to count nested loops Pin
Member 113783027-Nov-15 5:36
Member 113783027-Nov-15 5:36 
GeneralRe: Fastest way to count nested loops Pin
Patrice T7-Nov-15 7:51
mvePatrice T7-Nov-15 7:51 
GeneralRe: Fastest way to count nested loops Pin
Patrice T7-Nov-15 8:16
mvePatrice T7-Nov-15 8:16 
GeneralRe: Fastest way to count nested loops Pin
Member 113783027-Nov-15 8:27
Member 113783027-Nov-15 8:27 
GeneralRe: Fastest way to count nested loops Pin
Patrice T7-Nov-15 8:52
mvePatrice T7-Nov-15 8:52 
GeneralRe: Fastest way to count nested loops Pin
Member 113783027-Nov-15 9:08
Member 113783027-Nov-15 9:08 
GeneralRe: Fastest way to count nested loops Pin
Patrice T7-Nov-15 9:19
mvePatrice T7-Nov-15 9:19 
GeneralRe: Fastest way to count nested loops Pin
harold aptroot7-Nov-15 5:20
harold aptroot7-Nov-15 5:20 
That looks like Bézout's identity[^], the result depends on what algebraic structure you want to use, which is a bit unclear here. What size of integer do you want to consider?

You can see there what form the pairs of (i,j) take if they are solutions (called (x,y) on the wiki page). x increments in steps of b/gcd(a,b) and y decrements in steps of a/gcd(a,b). k can also go negative though. The problem then is counting how many of those things are in the valid range of your integer type. It has some weird edge cases but obviously you can do it without counting every possibility explicitly.
AnswerRe: Fastest way to count nested loops Pin
Luc Pattyn3-Jan-16 6:37
sitebuilderLuc Pattyn3-Jan-16 6:37 
Questionhow do you calculate a primitive operation in algorithm analysis Pin
Member 118975665-Nov-15 21:15
Member 118975665-Nov-15 21:15 
AnswerRe: how do you calculate a primitive operation in algorithm analysis Pin
Richard Deeming6-Nov-15 2:02
mveRichard Deeming6-Nov-15 2:02 
GeneralRe: how do you calculate a primitive operation in algorithm analysis Pin
Member 118975666-Nov-15 2:57
Member 118975666-Nov-15 2:57 
GeneralRe: how do you calculate a primitive operation in algorithm analysis Pin
Richard Deeming6-Nov-15 3:03
mveRichard Deeming6-Nov-15 3:03 
GeneralRe: how do you calculate a primitive operation in algorithm analysis Pin
jschell7-Nov-15 6:18
jschell7-Nov-15 6:18 
QuestionBinary Polynomial Multiplication Pin
Member 120276965-Nov-15 2:04
Member 120276965-Nov-15 2:04 
GeneralRe: Binary Polynomial Multiplication Pin
harold aptroot5-Nov-15 3:40
harold aptroot5-Nov-15 3:40 
GeneralRe: Binary Polynomial Multiplication Pin
Member 120276965-Nov-15 20:19
Member 120276965-Nov-15 20:19 
GeneralRe: Binary Polynomial Multiplication Pin
Patrice T5-Nov-15 17:24
mvePatrice T5-Nov-15 17:24 
Questionneed help with number base conversion algorithm for computers Pin
mickcs4-Nov-15 10:14
mickcs4-Nov-15 10:14 
AnswerRe: need help with number base conversion algorithm for computers Pin
Richard Andrew x644-Nov-15 10:36
professionalRichard Andrew x644-Nov-15 10:36 
AnswerRe: need help with number base conversion algorithm for computers Pin
Patrice T4-Nov-15 14:55
mvePatrice T4-Nov-15 14:55 
QuestionFeistel Cipher Algorithm: Problems aim to solve Pin
Ka Mal31-Oct-15 15:07
Ka Mal31-Oct-15 15:07 
AnswerRe: Feistel Cipher Algorithm: Problems aim to solve Pin
Richard MacCutchan31-Oct-15 21:41
mveRichard MacCutchan31-Oct-15 21:41 
GeneralRe: Feistel Cipher Algorithm: Problems aim to solve Pin
Richard Deeming2-Nov-15 1:50
mveRichard Deeming2-Nov-15 1:50 
GeneralRe: Feistel Cipher Algorithm: Problems aim to solve Pin
Richard MacCutchan2-Nov-15 1:59
mveRichard MacCutchan2-Nov-15 1:59 

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.