Adrian Lita

Blog

Below you can find a list of my blog posts. Some of the most used keywords found in posts:

#snippet 4 #academic 3 #strings 2 #string 2 #counter 1 #ubuntu18 1 #binary-counter 1 #combinations 1 #heap 1 #permutation 1 #xor 1 #xorswap 1 #variables 1 #swapping 1 #32bit 1 #embedded 1 #c 1 #fast-sqrt 1 #sqrt 1 #files 1 #apache2 1 #mysql 1 #cron 1 #bash 1 #backup 1

 
Latest posts with keyword permutation:

Generating all permutations of a string with Heap's method

By: Adrian Lita

Published on: 2018-06-19

Keywords: #permutation #string #strings #academic #snippet #heap

 

Generating permutations can sometimes be a difficult task. The number of permutations is given by the factorial of the total number of elements: unsigned int total_permutations(unsigned int n) { unsigned int p = 1; for (int i = 2; i <= n; i++) { p *= i; } return p; } The function above only works to a n of about 12 on 32bit machines before the result exceeds that. So for n equals 12 we have about 479.001.600!!! permutations possible. For sure, that takes a lot of time to process. Anyhow,...

Read More >