Search:

Type: Posts; User: tabstop

Search: Search took 0.14 seconds.

  1. Replies
    8
    Views
    3,265

    do while is dead easy. counter = 0; do {...

    do while is dead easy.


    counter = 0;
    do {
    /* stuff */
    counter++;
    } while (counter < target);
  2. Replies
    8
    Views
    3,265

    I suppose you can use one, but it's not the...

    I suppose you can use one, but it's not the 'idiomatic' way. You know you're going to do the loop x-1 times, and people tend to use for when they know exactly how many times the loop is going to run.
  3. Replies
    8
    Views
    3,265

    Your function can make more than one swap, but it...

    Your function can make more than one swap, but it can never make more than one pass through the list. Since bubble sort is an (x-1)-pass algorithm, you're short by several iterations. So you need...
Results 1 to 3 of 3