In the Spring of 2014, I graduated with a B.S. in Computer Engineering and a B.S. in Mathematics. I am trying to get into grad school for neuroscience with an application in Brain-Computer Interfacing. Job experience includes cryptanalysis, malware reverse engineering, and neural nets. I'll edit this as I think of something more interesting to put.

Nov
5
comment Finding unique triplets adding up to 0
I think so. I've been debugging by eye, not with Java installed, so don't take my word for it.
Nov
5
revised Finding unique triplets adding up to 0
Fixed pre-check issue.
Nov
5
comment Finding unique triplets adding up to 0
As is, this code will not work. Replace all the break;s with continue;s and it will almost work. Example that fails for the current code: [-3,-3,2,1]. Example that fails for the modified code: [-2,-2,1,1]. This is because you are checking for duplicates first, instead of checking the first of the duplicates. And if you find any duplicates, you break the loop altogether, so the first example will enter the for loop and immediately break out entirely without checking anything.
Oct
31
revised Finding unique triplets adding up to 0
A little note on complexity.
Oct
31
revised Finding unique triplets adding up to 0
Added explanation. Math proof to follow if necessary.
Oct
30
comment Finding unique triplets adding up to 0
Do you mean your original inner while loop? Because the while loop here is fine for \$O(n^2)\$. I can update my answer to give more detail about the considerations I made in editing your code. However, that will have to wait until I get out of work.
Oct
30
comment Finding unique triplets adding up to 0
If you're still skeptical, remove both while loops and add the conditions (with minor adjustments to account for the fact that it's a pre-loop check instead of a post-loop check, of course) as if statements at the beginning of each loop, that if true execute the increment or decrement and then call continue. This will operate exactly the same as the above code, but has the inner while loops unrolled into the outer while loop.
Oct
30
comment Finding unique triplets adding up to 0
The inner while loop removes iterations of the outer while loop. Any complexity added by the inner while loop is removed from the outer while loop. In all, i iterations of the outer while loop plus the inner while loop will happen on each iteration of the for loop.
Oct
30
answered Finding unique triplets adding up to 0
Oct
28
comment Python call a function every second?
That or you can extend the class. So something like class MyTimer(threading.Timer): def run(self): while (True): threading.Timer.run(self). But not quite that, likely.
Oct
23
accepted Writing a MATLAB file from a DLL called by LabVIEW
Oct
23
answered Writing a MATLAB file from a DLL called by LabVIEW
Oct
18
awarded Autobiographer
Oct
14
comment Snake game in C++
@weberc2 This isn't the forum for that unfortunately, but most of my knee-jerk is primarily from inheriting unreusable OOP code from people who don't understand the paradigm, but who use it only because they've always been told they should. That and as a high performance computing researcher, I tend to use a lot of procedural coding, since most things are, at least initially, ad hoc. Once I prove usefulness, then I try to abstract it out, or decide what is going to happen to it. Doing it the other way around would be much more work for me, but, as always, Your Mileage [Will] Vary.
Oct
14
awarded Supporter
Oct
14
comment Snake game in C++
@weberc2: Sorry, I was a little harsh in wording, but I am in no means anti-OOP; I'm just a little tired of seeing classes with one function and nothing else, or worse (I'll hold that thought). From an architectural perspective, you really should only use OOP if you're using (or just practicing) OOP. Also, C++ has more to offer than just OOP. It's a paradigm, not a religion. TheFailure, you did nothing wrong, and using C++ leaves you the opportunity to move to OOP which does fit game design well. Sorry for knee-jerk reacting, it was uncalled for here, I just thought OOP needed less emphasis.
Oct
13
comment Snake game in C++
Just my two cents, I see a lot of OOP in my workplace where it doesn't belong. Frankly, I think people should learn to program first, and then learn OOP, so I'd rank that suggestion much lower in priority than you. That being said, you aren't wrong, except in claiming that all C++ needs or expects to have OOP.
Oct
3
awarded Yearling
Oct
3
awarded Yearling
Oct
3
comment Is it possible to make a variable an object of a class by changing its type?
This entire conversation has already happened here, and the short answer is no, you can't easily get an object from its id. But it does have a brute force way to do it, which won't work with your code since Obj=str(Obj) will probably cause Obj to be cleaned up, as that removes the last reference of it in memory.
1 2 3 4 5