14,280 reputation
13459
bio website
location
age
visits member for 4 years, 6 months
seen 5 hours ago

May
11
revised What is ASM.js and what does it mean for everyone?
typo was driving me crazy
May
11
comment Notation for the average time complexity of an algorithm
Yeah, lots of people misuse big Oh to varying degrees.
May
11
comment Pros and cons of the following Parsing methods?
As I said, it may have some fluff that gets in your way, so you may want to immediately turn the AST into a different, simpler AST.
May
11
answered Pros and cons of the following Parsing methods?
May
10
awarded  Good Answer
May
10
comment Exclude the zero in the given data in Haskell
I'd like to introduce you to my good friend (/=) ;-)
May
10
comment Storing the EOF (End of File) character in a char type
There is no EOF character.
May
9
comment Why is there no 'finally' construct in C++?
@Mikey Apparently not, judging from a lot of existing code. And from my experience, people newly introduces to C++ aren't being taught this either.
May
9
comment Why is there no 'finally' construct in C++?
@Mikey If you worry about your code behaving well, in particular not leaking resources, when exceptions are thrown at it, you are worrying about exception safety/trying to write exception safe code. You're just not calling it that, and due to different tools being available you implement it differently. But it's exactly what C++ people talk about when they discuss exception safety.
May
9
comment Why is there no 'finally' construct in C++?
@Mikey Both RAII and finally (as well as some others) are tools for writing code that behaves well in the face of exceptions. Neither the support for finally nor the support for RAII automatically solves this problem. One has to use the respective tool, and use it correctly, to achieve exception safety. Note that the concept of exception safety is language-independent; that it is less widely discussed in other communities may be due to other languages reducing the problem by managing some resources automatically or the programmers being less paranoid.
May
8
comment Heap overflow vs stack overflow
@GrahamLee Thanks, quite interesting. I've usually seen this model presented with the assumption (1) doing it in physical memory, without virtual memory, and (2) the stack being resizable. Of course, neither is true in Linux. The stack size is fixed at thread creation AFAIK, or if it can be adjusted after thread creation, doing so is much harder than just writing more and more memory.
May
8
comment Heap overflow vs stack overflow
Heap and stack starting at opposite ends of memory and expanding towards each other is an old model which AFAIK does not apply to most computers of the last few decades any more.
May
8
awarded  Nice Answer
May
6
awarded  Nice Answer
May
5
revised Divide and Conquer algorithms – Why not split in more parts than two?
added 82 characters in body
May
5
answered Divide and Conquer algorithms – Why not split in more parts than two?
May
4
comment Retrieving maximum value from a range in unsorted array
Interesting, I think I've never come across this tree! IIUC this still requires storing all possible intervals, though. I think there's O(n^2) of those, which is rather expensive. (Also, shouldn't query be O(log n + k) for k results?
May
4
comment Retrieving maximum value from a range in unsorted array
I don't think that's relevant. An interval tree holds intervals, not integers, and the operations they permit look nothing like what OP asks for. You could, of course, generate all possible intervals and store them in an interval tree, but (1) there are exponentially many of them, so this doesn't scale, and (2) the operations still don't look like what OP asks for.
May
4
comment Retrieving maximum value from a range in unsorted array
Specify your whole problem. If this knowledge (or any other information) matters, one has to know to factor that into the solution.
May
4
comment Retrieving maximum value from a range in unsorted array
Why is it unsorted? The problem is trivial if it's sorted, so the obvious approach is to sort it.