In java Implement a sort method public void sort() Implement any sort algorithm. Do not use any of Java's built-in sorting algorithms. See the image for correct output. Given files:  Demo3.java public class Demo3 {   public static void main(String[] args) {     MyLinkedList list = new MyLinkedList<>();     list.add("E");     list.add("A");     list.add("D");     list.add("B");     list.add("C");     System.out.println("Small data set");     System.out.println(list);     System.out.println("Sort");     list.sort();     System.out.println(list);     System.out.println("Clearing");     list.clear();     System.out.println(list);     System.out.println("Building list");     TestBench.addToList(list);     System.out.println(list);     System.out.println("Shuffle 1");     list.shuffle(150);     System.out.println(list);     System.out.println("Shuffle 2");     list.shuffle(250);     System.out.println(list);     System.out.println("Sort");     list.sort();     System.out.println(list);     System.out.println("Adding more elements and shuffling");     TestBench.addToList(list);     TestBench.addToList(list);     list.shuffle(250);     System.out.println(list);     System.out.println("Sorting");     list.sort();     System.out.println(list);   } } TestBench.java

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

In java

Implement a sort method
public void sort()
Implement any sort algorithm. Do not use any of Java's built-in sorting algorithms.

See the image for correct output.

Given files: 

Demo3.java

public class Demo3 {
  public static void main(String[] args) {
    MyLinkedList<String> list = new MyLinkedList<>();

    list.add("E");
    list.add("A");
    list.add("D");
    list.add("B");
    list.add("C");
    System.out.println("Small data set");
    System.out.println(list);
    System.out.println("Sort");
    list.sort();
    System.out.println(list);

    System.out.println("Clearing");
    list.clear();
    System.out.println(list);

    System.out.println("Building list");
    TestBench.addToList(list);
    System.out.println(list);

    System.out.println("Shuffle 1");
    list.shuffle(150);
    System.out.println(list);

    System.out.println("Shuffle 2");
    list.shuffle(250);
    System.out.println(list);

    System.out.println("Sort");
    list.sort();
    System.out.println(list);

    System.out.println("Adding more elements and shuffling");
    TestBench.addToList(list);
    TestBench.addToList(list);
    list.shuffle(250);
    System.out.println(list);

    System.out.println("Sorting");
    list.sort();
    System.out.println(list);

  }
}

TestBench.java

 

Test Case 1
Small data set \n
[Е, А, D, B, с]\n
Sort n
[А, В, с, D, E]|n
Clearing n
[ ] n
Building list \n
[А, в, с, D, Е, F, G, H, І, J, к, L, м, N, о, Р, Q, R, S, т, U, v, w, х, Y, 2]|\n|
Shuffle 1\n
ГЕ, с, 9, N, Z, J, I, Y, Р, L, E, M, о, к, D, н, и, х, G, w, A, V, т, R, В, S]n
Shuffle 2 \n
[Е, Ј, R, N, I, F, Q, х, W, V, U, G, D, A, H, т, Ү, Р, L, s, C, Z, 0, в, к, м]| n
Sort In
[А, В, с, D, Е, F, G, H, І, J, к, L, м, N, о, Р, Q, R, S, т, U, v, w, х, Y, 2]|m
Adding more elements and shuffling In
[к, т, х, D, J, к, с, R, z, н, Y, V, L, U, A, M, L, w, т, G, U, s, E, Y, C, J, R, D, Z, D, Q, 0, V, s, т, в, S, Y, N, L, W, M, N, Е, W, H, Е, J, А, Р, в, х, Р, Q, Q. к, F, В, I, F, N, V, о, F, н, Z, I, U, с, Р, х, 0, G, I, A, м,
R, G] \n
Sorting In
[А, А, А, В, в, в, с, с, с, D, D, D, E, E, Е, F, F, F, G, G, G, н, н, н, I, І, І, Ј, , 3, к, к, к, L, L, L, м, м, м, N, N, N, о, о, о, р, Р, Р, 0, 0, 0. R, R, R, S, S, S, т, т, т, и, и, U, v, v, v, w, w, м, х, х, х, у, Ү, Ү, Z,
z, z] \n
s и
Transcribed Image Text:Test Case 1 Small data set \n [Е, А, D, B, с]\n Sort n [А, В, с, D, E]|n Clearing n [ ] n Building list \n [А, в, с, D, Е, F, G, H, І, J, к, L, м, N, о, Р, Q, R, S, т, U, v, w, х, Y, 2]|\n| Shuffle 1\n ГЕ, с, 9, N, Z, J, I, Y, Р, L, E, M, о, к, D, н, и, х, G, w, A, V, т, R, В, S]n Shuffle 2 \n [Е, Ј, R, N, I, F, Q, х, W, V, U, G, D, A, H, т, Ү, Р, L, s, C, Z, 0, в, к, м]| n Sort In [А, В, с, D, Е, F, G, H, І, J, к, L, м, N, о, Р, Q, R, S, т, U, v, w, х, Y, 2]|m Adding more elements and shuffling In [к, т, х, D, J, к, с, R, z, н, Y, V, L, U, A, M, L, w, т, G, U, s, E, Y, C, J, R, D, Z, D, Q, 0, V, s, т, в, S, Y, N, L, W, M, N, Е, W, H, Е, J, А, Р, в, х, Р, Q, Q. к, F, В, I, F, N, V, о, F, н, Z, I, U, с, Р, х, 0, G, I, A, м, R, G] \n Sorting In [А, А, А, В, в, в, с, с, с, D, D, D, E, E, Е, F, F, F, G, G, G, н, н, н, I, І, І, Ј, , 3, к, к, к, L, L, L, м, м, м, N, N, N, о, о, о, р, Р, Р, 0, 0, 0. R, R, R, S, S, S, т, т, т, и, и, U, v, v, v, w, w, м, х, х, х, у, Ү, Ү, Z, z, z] \n s и
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY