Search:

Type: Posts; User: krafterwerk

Search: Search took 0.10 seconds.

  1. Replies
    13
    Views
    1,003

    Re: Infinite loop on double linked list

    It prints always the same address for the pointers. Here it is:


    private void printInReverse() {
    MyListElement tmpElement = firstElement;
    while (tmpElement.nextElement != null)...
  2. Replies
    13
    Views
    1,003

    Re: Infinite loop on double linked list

    It's not. Exactly, it's only printing my last element because I don't know how to get the previousElement pointer to actually point to an element's previous element.
  3. Replies
    13
    Views
    1,003

    Re: Infinite loop on double linked list

    It stops when the prev link is null because it's when the first element of the list is reached so the list was percurred.
  4. Replies
    13
    Views
    1,003

    Re: Infinite loop on double linked list

    Yes I know. I mean, I'm not managing to make my previousElement to effectively point to an element's previous element. I guess you'll understand better if I post the code:


    private void...
  5. Replies
    13
    Views
    1,003

    Re: Infinite loop on double linked list

    Okay, got it. But how could I get the previousElement from my lastElement? I tried to do create an auxElement variable, storing firstElement and progressing through the list until lastElement is null...
  6. Replies
    13
    Views
    1,003

    Re: Infinite loop on double linked list

    Okay, got it. But how could I declare a variable that points to the last element in the list? Thank you.
  7. Replies
    13
    Views
    1,003

    Infinite loop on double linked list

    I've been stuck for the last couple hours trying to understand why the "printInReverse" method is getting into an infinite loop. I have no idea. I was supposed to make a double linked list that you...
Results 1 to 7 of 7