79234267

Date: 2024-11-28 14:29:00
Score: 0.5
Natty:
Report link

Yes, it's linear. (@matszwecja: On each iteration the functions Min_Zero and Min_Not_Zero start at the same index at which they ended in the previous run, so in total each iterates the array only once).

I've successfully run the code. It's verified.

No, it's not. You ran the code with one (or a couple of examples). It breaks if you call it with [1, 0, 1].

The parameter i in Swap_Zero is unused.

The code is convoluted.

It more or less already implements the algorithm suggested by @Martin Brown, but in a way that is too complicated. You do not need recursion here.

@Martin Brown: Why should it be more complicated if the 0 have to come first? The situation is completely symmetrical. There is one set of characters that should be moved to the front. In one case it's all character except for "0", in the other case it is the single character "0".

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Contains question mark (0.5):
  • User mentioned (1): @Martin
  • User mentioned (0): @Martin
  • High reputation (-1):
Posted by: eekboom