Another Programming Challenge - Programming (2) - Nairaland
Nairaland Forum › Science/Technology › Programming › Another Programming Challenge (2359 Views)
| Re: Another Programming Challenge by mkwayisi: 5:32pm On Sep 29, 2012 |
@lordZouga: Once will never be enough unless you're coming up with a breakthrough algorithm. Let me ask, have you tried implementing what you're thinking? If not try it! |
| Re: Another Programming Challenge by ektbear(op): 7:30pm On Sep 29, 2012 |
[quote author=₱®ÌИСΞ]Hahaha lol...thnx for dat...I imagined the possibility of dat occuring in a HUGE file was near impossible so I guess my mind didn't go there...lemme fix it[/quote]Indeed, if N is big, and K relatively small, then this is pretty unlikely to happen. This was the subtle issue I alluded to in my first post. But it is pretty easy to fix (just reject a random number it is already in your list). |
| Re: Another Programming Challenge by ektbear(op): 7:31pm On Sep 29, 2012 |
lordZOUGA: it will take O(N)... This would be nice but your algorithm suggested doing it twice when in my opinion, once would be enough.If you don't know N, I think that it is impossible to do it in one pass. You have to know N to generate the K random row #s correctly. And the only way to know N is to pass through the file once. |
| Re: Another Programming Challenge by uzoexcel(m): 5:22pm On Jul 18, 2014 |
OFDM? ![]() |
Programming Challenge For Beginners Competition Two N20000 -SEASON 2- • Programming Challenge For Beginners N20000 • Facebook Programming Challenge Question • 2 • 3 • 4
Opera Single Column View Overwriting Site Responsiveness • Best School Management Software • Where Can I Download Website Templates?