Search:

Type: Posts; User: R.Stiltskin

Search: Search took 0.01 seconds.

  1. Replies
    69
    Views
    8,703

    In the worst case, it's still O(n2). You would...

    In the worst case, it's still O(n2).

    You would do better to go back to your compact function in post #61 and make it in-place by simplifying it, rather than by complicating it. Essentially all...
  2. Replies
    69
    Views
    8,703

    Still working on this, I see. I was hoping that...

    Still working on this, I see. I was hoping that by the time you finished implementing the step-counting you would have realized how simply (and efficiently) you could complete the assignment with...
  3. Replies
    69
    Views
    8,703

    Nice job. Now why don't you modify the program...

    Nice job. Now why don't you modify the program so it counts (and prints) the number of assignments performed (i.e., how many times a number is moved from one place to another) while processing a...
  4. Replies
    69
    Views
    8,703

    We shouldn't turn this into a debate about...

    We shouldn't turn this into a debate about complexity, but doesn't repeatedly shifting the entire array change it from O(n) to O(n2)?

    But even ignoring the time complexity, it makes the program...
  5. Replies
    69
    Views
    8,703

    That's a viable approach and certainly worth...

    That's a viable approach and certainly worth doing, if only for the benefit of the programming practice it gives you. However, think about how many operations the computer will be performing as...
  6. Replies
    69
    Views
    8,703

    Of course it's solvable. Think.

    Of course it's solvable. Think.
  7. Replies
    69
    Views
    8,703

    Are you sure you want to compare to element...

    Are you sure you want to compare to element [i-1]?

    PS: when you see entries like 2686632 popping up, you should suspect that you might be running out of the bounds of your array somewhere.
Results 1 to 7 of 7