Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 ns = Arrays.asList(70,100,203,784,412,135,101);

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Neo4j

Authors: Gregory Jordan

1st Edition

1484200225, 9781484200223

More Books

Students also viewed these Databases questions

Question

3. How has Starbucks changed since its early days?

Answered: 1 week ago