By ADJA, history, 12 months ago,

Hello, CF community.

I am writing about algorithms for fun and to spread the knowledge.

Thanks!

• +61

 » 12 months ago, # | ← Rev. 2 →   +27 I don't like your generator and script. Using time as seed gives you the same test within a second, so you will check only 60 tests per minute. And your script is quite long + you don't see that tests are indeed being checked.Instead, use argument argv[1] as seed and consider the following script: for((i=1;;++i)); do echo $i ./gen$i > int diff <(./solution < int) <(./stupid < int) || break done I appreciate the effort and more educational blogs is great, but do some research first and see how others do the same thing.
•  » » 12 months ago, # ^ | ← Rev. 2 →   0 Hey, thanks for checking this out!Using time as a seed is a nice catch. I copied some old code of mine (2013?), and didn't pay enough attention to that. I will fix this in the article.Regarding the length of the script, I believe it's not that much longer than yours – your version omits all comments and compilation part. When writing the article, I was trying to make script as readable as possible, not short. That said, I can definitely tweak my script a bit more, thanks for an example!And about research: I read everything I could on the topic, but there are not many good sources that I found – that was one of the reasons to write my article as well :)
•  » » » 12 months ago, # ^ |   +8 There are no ifs in my script and I don't create output files, those are bigger differences. By the way, it's easy for a mistake in generator if you write 2 + rand() % 999, I recommend a function instead: int r(int a, int b) { return a + rand() % (b - a + 1); }. I made a Youtube video with detailed explanation what to do and why, https://www.youtube.com/watch?v=JXTVOyQpSGM. Codes: https://github.com/Errichto/youtube/tree/master/testing
•  » » » » 12 months ago, # ^ |   +22 Or you could just use uniform_int_distribution from C++11 header 
•  » » » » 12 months ago, # ^ |   0 Nice, thanks for pointers to your videos – I didn't see them before.As for 2 + rand() % 999 and script differences, these are mostly stylistic differences, and I will keep my version for now. I updated an article with random seed part though, again thanks for that!
•  » » » » » 12 months ago, # ^ |   0 Ok, that's fine.Windows script is still the old version, and I think it compiles everything for each test again, right?
•  » » » » » » 12 months ago, # ^ |   0 Correct, just updated. P.S. I don't have a Windows system right now, so let me know if there are still problems with it.
 » 12 months ago, # |   0 Very well! I liked this topic and the project Algos.school as a whole, although I hear about it now! My question is: will you promote this site in the future with more resources?
•  » » 12 months ago, # ^ |   0 Thanks! I will try to post to the site more frequently