Search:

Type: Posts; User: andbin

Search: Search took 0.57 seconds.

  1. Replies
    11
    Views
    1,278

    Re: Problem with arrays2

    Ok, it's correct. :)
    If you want you can test i < a1.length, which is conceptually the same just more concise (personally I prefer).
  2. Replies
    11
    Views
    1,278

    Re: Problem with arrays2

    Ok, please. You can post your, hope right, code. It could be useful to others and I can tell you if it's correct.
  3. Replies
    11
    Views
    1,278

    Re: Problem with arrays2

    Think carefully about the following: the entire array is in ascending order only if all pairs are in ascending order. It's sufficient one (anywhere) pair not in ascending order to state immediately...
  4. Replies
    11
    Views
    1,278

    Re: Problem with arrays2

    You are testing:


    if (a1[i - 1] < a1[i]) {
    return true;
    }
    This is right itself. But this means that only by the first occurrence of a1 [I]is-lower-than a1 it returns true, ignoring the...
  5. Replies
    11
    Views
    1,278

    Re: Problem with arrays2

    First, the index variable i can reach the value of a1.length which is an index out of bounds. Thus, a1[i] will throw an exception when i equals a1.length.
    Second (apart the first problem), your...
Results 1 to 5 of 5