Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Doublylinkedlist Java public static String testDoublyLinkedList() {return Abstra

ID: 3690493 • Letter: D

Question

Doublylinkedlist Java

public static String testDoublyLinkedList()
{return AbstractLinkedList.test( new AbstractLinkedList<String>(){

// IMPLEMENT THE FOLLOWING METHODS IN ACCORDANCE
// WITH THE DESCRIPTION AND DATA INVARIANT FOR
// THE CLASS AbstractLinkedList.
//////////////////////////////////////////////////////

public void addAfter( String x )
{
   Node<String> newNode = new Node<String>();
   newNode.val = x;
// ???
}

public void addBefore( String x )
{
// ???
}

public void deletePrevious()
{
// ???
}

public void deleteNext()
{
// ???
}

public String previous()
{
// ???
}

public String next()
{
// ???
}

public boolean hasPrevious()
{
// ???
}

public boolean hasNext()
{
// ???
}

public void toStart()
{
// ???
}

public void toEnd()
{
// ???
}

public void backward()
{
// ???
}

public void forward()
{
// ???
}

How are the programs supposed to be?

Explanation / Answer

public void addAfter( String x )
{
   Node<String> newNode = new Node<String>();
   newNode.val = x;
x= newNode;
}

public void addBefore( String x )
{

Node newNode = new Node(x);

1+x;
}


}

public void deleteNext()
{
if(*head_ref == NULL || del == NULL)

    return;

   if(*head_ref == del)

    *head_ref = del->next;

if(del->next != NULL)

    del->next->prev = del->prev;

  if(del->prev != NULL)

    del->prev->next = del->next;    

     free(del);

return;

}    
}

public String previous()
{
struct node *previous;

if (h == NULL)

    {

        create();

        i = temp;

        temp1 = i;

    }

    else

    {

        create();

        temp->previous = i;

        i->next = temp;

        i = temp;

    }

}
}


}

public String next()
{
struct node *next;

if (h == NULL)

    {

        create();

        i = temp;

        temp1 = i;

    }

    else

    {

        create();

        temp->next = i;

        i-> previous = temp;

        i = temp;

    }

}
}

public boolean hasPrevious()
{
return element < max;
}

public boolean hasNext()
{
return element < max;
}


}


}


}


}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote