ajprincess
  • ajprincess
Please help:)
Computer Science
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
katieb
  • katieb
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
ajprincess
  • ajprincess
Fill in the blanks public class Link{ public int data; public Link next; public Link(int data){ ......................=data; next=.......................; } public void display() { System.out.print(..........................+" "); } public ................. getdata() { return data; } } public class LinkList{ private (5).................... first; public LinkList() { first=(6).......................; } //insert at start of list public void insert(int value) { Link current=.......................; ...............................=first; first=..............................; } //display the list public void displayA() { Link current = ......................; While(...............................) { ......................; current=................................; } System.out.println(); } //find size of the list public ......................... size() { Link current=..........................; .................................................; while(.............................) { ...................................; current=...................................; } return ..............................; } //find the middle element in the list public ................ midelement() { Link current = ...........................; Link middle =............................; int length = 0; while(current!=null){ length++; if(..............................................................) { middle=middle.nest; } current=current.next; } return ......................; } //find the nth link public ............................ nthelement(......................) { link current=.......................; for(.......................................) { current = ..............................; } return current; } //reverse the list public ........................... reverse (){ Link current=first; Link forward; Link previous=null; while(............................................) { .............................................; .............................................; .............................................; ..............................................; } ....................................................; } } public class LinkListApp { public static void main(String args[]) { ............................................................................; obj.insert(10); obj.insert(20); obj.insert(30); obj.insert(40); obj.insert(50); obj.displayA(); int size = ................................................; System.out.println("Length of the List is"+..........); ....................................=objmidelement(); System.out.println("Middle data is"+............................); ..............................; .......................................=obj.nthelement(......); System.out.println(nth+" element has the value of "+............................); obj.reverse(0; obj.displayA(); } }
ajprincess
  • ajprincess
My answer is public class Link{ public int data; public Link next; public Link(int data){ ......................=data; next=null; } public void display() { System.out.print(data+" "); } public int. getdata() { return data; } } public class LinkList{ private Link first; public LinkList() { first=null; } //insert at start of list public void insert(int value) { Link current=new Link(value); current.next=first; first=current; } //display the list public void displayA() { Link current = first; While(current!=null) { current.display(); current=current.next; } System.out.println(); } //find size of the list public int size() { Link current=first; int length=0; while(current!=null) { length++; current=current.next; } return length; } //find the middle element in the list public ................ midelement() { Link current = first; Link middle =first; int length = 0; while(current!=null){ length++; if(..............................................................) { middle=middle.next; } current=current.next; } return middle; } //find the nth link public Link nthelement(......................) { link current=fisrt; for(.......................................) { current = ..............................; } return current; } //reverse the list public ........................... reverse (){ Link current=first; Link forward; Link previous=null; while(............................................) { .............................................; .............................................; .............................................; ..............................................; } ....................................................; } } public class LinkListApp { public static void main(String args[]) { LinkList obj=new LinkList(); obj.insert(10); obj.insert(20); obj.insert(30); obj.insert(40); obj.insert(50); obj.displayA(); int size = ................................................; System.out.println("Length of the List is"+..........); ....................................=objmidelement(); System.out.println("Middle data is"+............................); ..............................; .......................................=obj.nthelement(......); System.out.println(nth+" element has the value of "+............................); obj.reverse(0; obj.displayA(); } }
ajprincess
  • ajprincess
My answer for reverse method is public void reverse() { Link previous = null; Link current=first; Link forward; while(current!=null) { forward=current.next; current.next = previous; previous=current; current=forward; } first=previous; }

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

KonradZuse
  • KonradZuse
holy crap hahaha.... Let me look through this slowly :P.
ajprincess
  • ajprincess
I have done other methods. Nw I need help with only nthelement method
KonradZuse
  • KonradZuse
Okay, what's next?
ajprincess
  • ajprincess
sorry didnt get u?
KonradZuse
  • KonradZuse
I didn't read everything, what exactly do you still need help with? The above method or...????
ajprincess
  • ajprincess
ya only that method
ajprincess
  • ajprincess
I got t. thanks a lot for trying to help me:)

Looking for something else?

Not the answer you are looking for? Search for more explanations.