Question
import org.junit.jupiter.api.Test; import java.time.Duration; import java.time.Instant; import java.util.Arrays; import java.util.List; class SortTest { @Test void sort () { // TODO more correctness tests List ns
import org.junit.jupiter.api.Test;
import java.time.Duration; import java.time.Instant; import java.util.Arrays; import java.util.List;
class SortTest {
@Test void sort () { // TODO more correctness tests List
System.out.printf("Original list = %s%n", ns); System.out.printf("insertionSort = %s%n%n", Sort.insertionSort(ns)); }
@Test void timeSort () { Instant start = Instant.now(); // TODO efficiency tests // In particular, include a test that demonstrates why insertion sort's worst-case // performance is O(n^2) Instant end = Instant.now(); Duration time = Duration.between(start, end); System.out.println(time.toMillis()); }
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started