Search:

Type: Posts; User: yellowglow

Search: Search took 0.10 seconds.

  1. Re: Characters from String in alphabetic order using quicksort

    Any solution? I tried to debug in eclipse it, but I am new to java so I don't really know how to use it (I tried to read about debugging and watch some vidoes on youtube).
  2. Re: Characters from String in alphabetic order using quicksort

    I created new sort method, but it doesn't work with string that has many letters in it. For example : abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz doesn't work, but words such as omnibus,...
  3. Re: Characters from String in alphabetic order using quicksort

    The second sort method that I uploaded works for example with words : omnibus = bimnosu, omnibusa = abimnosu, Norm = Nmor, norm = mnor or even iamtiredofit = adefiiimortt
    You are right about first...
  4. Re: Characters from String in alphabetic order using quicksort

    When code doesn't work I try to run it through a program called Jeliot, but this time it crashes when it gets to the line char p = a[m]; in sort method so I can't really see what is going on after.
    ...
  5. Re: Characters from String in alphabetic order using quicksort

    What do you mean by that?
  6. Characters from String in alphabetic order using quicksort

    Hi,
    I am trying to do a program that takes all of the chars from a string and orders them in alphabetical order. It works fine, but when a is a last letter of a string it isn't being sorted. ...
  7. Thread: Loop Error

    by yellowglow
    Replies
    17
    Views
    1,882

    Re: Loop Error

    You're right. That's why I am curious how to solve it without StringBuilder. Any advice?
  8. Thread: Loop Error

    by yellowglow
    Replies
    17
    Views
    1,882

    Re: Loop Error

    public static String revio(String[] a){
    int N = a.length;
    StringBuilder reverse = new StringBuilder();
    for (int i = 0; i < N ; i++) {
    reverse.append(a[N-i-1]);
    }
    return...
  9. Thread: Loop Error

    by yellowglow
    Replies
    17
    Views
    1,882

    Re: Loop Error

    Sorry, my bad. This is correct error:

    java.lang.ArrayIndexOutOfBoundsException: 3
    at ReverseMe.revio(ReverseMe.java:10)
    at ReverseMe.main(ReverseMe.java:15)
    at...
  10. Thread: Loop Error

    by yellowglow
    Replies
    17
    Views
    1,882

    Re: Loop Error

    I went through it with Jeliot and I know that my problem is that it tries to get access to index 3 which is not in range of 0 to 2.. I know that my problem is the "return" statement which I can't fix.
  11. Thread: Loop Error

    by yellowglow
    Replies
    17
    Views
    1,882

    Re: Loop Error

    java.lang.ArrayIndexOutOfBoundsException: 3
    at ReverseMes.reverseConcat(ReverseMes.java:10)
    at ReverseMes.main(ReverseMes.java:20)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)...
  12. Thread: Loop Error

    by yellowglow
    Replies
    17
    Views
    1,882

    Re: Loop Error

    Well I've been there, but I can't find anything there that might help me.
    I know that I get this error because my array starts from 0 and the last index is 2. My program tried to access to index 3...
  13. Thread: Loop Error

    by yellowglow
    Replies
    17
    Views
    1,882

    Loop Error

    Hi, I am beginner to Java. I wanted to create a method that will reverse elements of my array, but I keep getting error and I am not sure why.

    I use Jeliot to see what are the problems, but...
  14. Replies
    2
    Views
    1,123

    Reversed Input

    {
    public static void main(String args[])
    {
    int[] array = StdIn.readAllInts();
    for (int i = 0; i<array.length;i++){
    int temp = array[i];
    array[i] =...
  15. Replies
    9
    Views
    1,464

    Re: Loop Assignment

    I shouldn't even use the modulo command in there..
    s = s+i; It adds the last number from the loop (value of n) to s (because i!=n). It might be written as s = s+n as well. i = 2+3+4+5+...+n. There...
  16. Replies
    9
    Views
    1,464

    Re: Loop Assignment

    This is the output: 3136
    Is my code so messed up?
  17. Replies
    9
    Views
    1,464

    Re: Loop Assignment

    I am not sure if this is what you mean, but these are the conditions that must be met.


    1 <= i <= n
    i = 1+2+3+4+...+n
    s = sum of i

    I'm done with the exercise and this is my outcome:

    ...
  18. Replies
    9
    Views
    1,464

    Re: Loop Assignment

    I took 3 java classes so far, so I don't know it yet.
  19. Replies
    9
    Views
    1,464

    Loop Assignment

    Hi,
    I have an assignment to do, I've been trying to do it, but I just can't find the right solution..

    - What is it about?
    - About an algorithm 1+2+3+4+...+n=t
    (e.g.)
    Input: 3, Outcome:...
Results 1 to 19 of 19