Course Solutions Uncategorized (Solved) : Doublenode Class Class Doublenode String Str Doublenode Prev Next Doublenode String Str St Q27957100 . . . .

(Solved) : Doublenode Class Class Doublenode String Str Doublenode Prev Next Doublenode String Str St Q27957100 . . . .

 

//DoubleNode class

class DoubleNode
{
String str;
DoubleNode prev, next;

DoubleNode(String str)
{
this.str = str;
prev = null;
next = null;
}

String getStr()
{
return str;
}

DoubleNode getNext()
{
return next;
}

void setNext(DoubleNode next)
{
this.next = next;
}

DoubleNode getPrev()
{
return prev;
}

void setPrev(DoubleNode prev)
{
this.prev = prev;
}
}

//LinkList class
class DoublyLinkedList
{
DoubleNode head, tail;

DoublyLinkedList()
{
head = null;
tail = null;
}

DoubleNode getHead()
{
return head;
}

DoubleNode getTail()
{
return tail;
}

void addFirst(String s)
{
DoubleNode node = new DoubleNode(s);
if (head == null)
tail = node;
else
head.setPrev(node);
node.setNext(head);
head = node;
}

void addLast(String s)
{
DoubleNode node = new DoubleNode(s);
if (head == null)
head = node;
else
tail.setNext(node);
node.setPrev(tail);
tail = node;
}

void printList()
{
System.out.print(“The list: “);
DoubleNode node = head;
while (node != null)
{
System.out.print(node.getStr() + ” “);
node = node.getNext();
}
System.out.println();
}

void printListReverse()
{
System.out.print(“The list in reverse: “);
DoubleNode node = tail;
while (node != null)
{
System.out.print(node.getStr() + ” “);
node = node.getPrev();
}
System.out.println();
}

DoubleNode search(String s)
{
DoubleNode node = head;
while

OR

PayPal Gateway not configured

OR

PayPal Gateway not configured

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

(Solved) : Instructions Case Create Visual Basic Solution Allows Island Breezes Sea Planes Airline As Q30073339 . . . .(Solved) : Instructions Case Create Visual Basic Solution Allows Island Breezes Sea Planes Airline As Q30073339 . . . .

<p><strong><img alt="?? Seat Selection Island Breezes Sea Planes Passenger Name: John Smith Seat Selection 10-?? 114 12A C ? 10-? 118 12-B Confirm Seat" src="https://media.cheggcdn.com/media%2Faa6%2Faa639e5a-6ac8-468f-bd9c-9fbed3eab600%2Fphpk7z9rq.png" style="height:446px;width:211px;" aria-describedby="d3f"/></strong></p><p><strong>Instructions</strong></p><p>In this case, you