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

Using the public interface of the UnorderedLinkedList class, write a method: pub

ID: 3539434 • Letter: U

Question

Using the public interface of the UnorderedLinkedList class, write a method: public static void reverse(UnorderedLinkedList staff) that reverses the entries in a linked list.


Basically I need to enter a string and the reverse it

for example: I type "hello World" it comes out "dlrow olleh"


what I have so far is

public class Linked_List_Reversal

{

  

public static void main(String args[])

{

List<String> list = new ArrayList<String>();

System.out.println("Please enter many words you would like to list");

Scanner scanner = new Scanner(System.in);

Integer count = scanner.nextInt();

int i=0;

System.out.println("Please enter the words");

while(count>0)

{

list.add(i,scanner.next());

i++;

--count;

}

ListIterImpl listIterImpl = new ListIterImpl();

listIterImpl.displayReverseOrder(list);

}

  

public void displayReverseOrder(List<String> list)

{

ListIterator<String> listIterator = list.listIterator(list.size());

System.out.println("Reversed order of the list is ");

while (listIterator.hasPrevious())

{

System.out.println(listIterator.previous());

}

}

}


which asks how many words you want in the list then it just reverses the list

I don't know how to make an unordered list that reverse the word in the list

Explanation / Answer

Sample output



Enter how many words you want to add in the list

5

Enter your words

Rome

italy

paris

sweden

russia



Your list after revsersing is :

emoR

ylati

sirap

nedews

aissur