java - Finding the right place and storing in LinkedList -


I am trying to store stars in a linked list. I do not have permission to pre-sort, but find the place and pass the string in the linked list. When I pass strings through the text file, the string does not go past the second position. The appie zebra cat in my input file

When it reaches the app, it does not go through any statement It is considered to be the last second position and print 5, but Do not do this.

Prefix / ** * String and arranges them in order * @ Param NewString * / Public Zero Store (string nuestring) {Linkediston current = head; Println (newString); // If there is no element in the list (if present == empty) {System.out.println ("1"); MakeNode (newString); } // If only 1 element in the list and if (current .getNext () == tap) {System.out.println ("2"); If (newString.compareTo (current.GateName))

You have a problem with the insert. I updated it.

  Insert public zeros (string later, string name) {if (head == null) {head = new LinkedListNode (name, null); } Else if (head.getName () == later) {LinkedListNode newNode = makeNode (name); NewNode.setNext (head); Head = newNode; } Else {Linkediston Turned = Head; While (current .getNext (). GetName ()! = Later) {current = current.getNext (); } LinkedListNode newNode = Mennonode (name); Create new node newNode.setNext (current .getNext ()); Current.setNext (newNode); }} // End of insert (first)  

Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Messages from .properties file do not display UTF-8 characters -

javascript - amcharts makechart not working -