September 24th, 2013, 05:15 AM

So for each element in an array you want to find the closest bigger element to the left?

I think this can be accomplished in O(N) with the use of a stack.

You scan the array in reverse (from...

September 24th, 2013, 02:18 AM

If you want to generate a list where the items appear in random order there's an O(N) algorithm called Random Shuffle. It's available as a standard function in many languages but not in C# it seems...

September 22nd, 2013, 02:50 AM

I also find Towers of Hanoi difficult. I've read different explanations in several textbooks and watched lectures on Youtube but I'm still not convinced the inductive proof is correct. In fact I'm...

September 21st, 2013, 02:14 AM

Actually it may be better to start writing games right away. When it comes to coding skill goal oriented hands-on learning is way more efficient than unfocused bulk learning.

On the other hand...

September 19th, 2013, 01:07 AM

I don't know if I've misunderstood something but isn't this quite easily done in O(N)?

You can move a pancake to wherever you want it with just two flips. You insert the spatel underneath the...

September 18th, 2013, 12:08 AM

Given that the consistent people are in majority, the group of all people together will be consistent. The inconsistent vote of the minority isn't big enougth to change the consistent vote of the...

September 16th, 2013, 07:52 AM

This is a continuation of my post #2.

The second algorithm finds the first pair of matching socks drawn from a basket containing N socks (N/2 pairs). Socks are picked one by one from the basket...

September 13th, 2013, 09:58 AM

There is plenty of information on embedded systems readily available on internet, like say here,

http://en.wikipedia.org/wiki/Embedded_system

What sets the JSF++ coding standard apart is that...

September 13th, 2013, 08:51 AM

Not if the "bed" is implemented using an array or hash table.

September 13th, 2013, 04:37 AM

The first algorithm looks for a specific pair of socks in a sequence. It picks a first sock and then searches sequentially for a match.

The second algorithm looks for any first pair of socks in a...

September 12th, 2013, 07:33 AM

I think it may be okay if you're a little bit rusty on the details but know and understand C++ conceptually.

Realtime embedding often raises safety concerns. The full language cannot be used...

September 9th, 2013, 06:50 PM

If you feel understimulated at your current job get a more challenging job!

September 9th, 2013, 06:24 PM

Well, I guess this is a newbie programming task and the addition algorithm you're supposed to be using is the one you were taught in first grade school on paper .:)