diff --git a/.gitignore b/.gitignore
index 1ad9fff..098ca04 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
artist.txt
.idea/
target/
+*.iml
diff --git a/SQ-2021-H6/pom.xml b/SQ-2021-H6/pom.xml
new file mode 100644
index 0000000..b2c9884
--- /dev/null
+++ b/SQ-2021-H6/pom.xml
@@ -0,0 +1,134 @@
+
+
+ 4.0.0
+
+ org.usi.sq
+ SQ-2021-H6
+ 1.0
+
+ UTF-8
+ 1.7.0-M1
+ 5.6.2
+ 5.6.2
+ 4.13.1
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 3.0.0-M5
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.8.1
+
+
+ 8
+
+
+
+ org.jacoco
+ jacoco-maven-plugin
+ 0.8.5
+
+
+
+ prepare-agent
+
+
+
+
+ report
+ test
+
+ report
+
+
+
+
+
+ org.pitest
+ pitest-maven
+ 1.5.2
+
+
+ org.usi.sq.util*
+
+
+ org.usi.sq.util*
+ *
+
+
+
+
+ org.pitest
+ pitest-junit5-plugin
+ 0.12
+
+
+
+
+
+
+
+ org.junit.jupiter
+ junit-jupiter-api
+ ${junit.jupiter.version}
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter-engine
+ ${junit.jupiter.version}
+ test
+
+
+ junit
+ junit
+ ${junit.version}
+ test
+
+
+ org.junit.vintage
+ junit-vintage-engine
+ ${junit.vintage.version}
+ test
+
+
+
+
+
+ org.jacoco
+ jacoco-maven-plugin
+
+
+
+
+ report
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-report-plugin
+ 3.0.0-M5
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jxr-plugin
+ 2.1
+
+
+
+
+
+
diff --git a/SQ-2021-H6/src/main/java/org/usi/sq/util/CollectionUtils.java b/SQ-2021-H6/src/main/java/org/usi/sq/util/CollectionUtils.java
new file mode 100644
index 0000000..d472e19
--- /dev/null
+++ b/SQ-2021-H6/src/main/java/org/usi/sq/util/CollectionUtils.java
@@ -0,0 +1,40 @@
+package org.usi.sq.util;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public class CollectionUtils {
+
+ private static final double EPSILON = 1e-6;
+
+ /**
+ * Implementation of insertion sort. Insertion sort can be used in cases
+ * where the input list is almost sorted or small. The list implementation
+ * should provide fast indexed access. Due to its quadratic worst-case
+ * runtime complexity, other sorting algorithms should be used in the
+ * general case.
+ *
+ * @param list the list to be sorted in-place
+ * @param the type of the elements in the list (need to be comparable)
+ * @throws IllegalArgumentException if called with null pointer
+ */
+ static > void sort(List list){
+ if(list == null)
+ throw new IllegalArgumentException("Sort must not be called with " +
+ "null");
+ for(int i = 1; i < list.size(); i++){
+ T key = list.get(i);
+ int j = 0;
+ for(j = i-1; j >= 0; j--){
+ T elem = list.get(j);
+ if(elem.compareTo(key) > 0){ // check if elem > key
+ list.set(j+1, elem);
+ } else{
+ break;
+ }
+ }
+ list.set(j+1,key);
+ }
+ }
+}
diff --git a/SQ-2021-H6/src/test/java/org/usi/sq/util/CollectionUtilsTest.java b/SQ-2021-H6/src/test/java/org/usi/sq/util/CollectionUtilsTest.java
new file mode 100644
index 0000000..bebbdb7
--- /dev/null
+++ b/SQ-2021-H6/src/test/java/org/usi/sq/util/CollectionUtilsTest.java
@@ -0,0 +1,33 @@
+package org.usi.sq.util;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+class CollectionUtilsTest {
+
+ private static > void checkSort(List source, List expected) {
+ List target = new ArrayList<>(source);
+ CollectionUtils.sort(target);
+ assertEquals(expected, target);
+ }
+
+ private static List list(T... elements) {
+ return Arrays.asList(elements);
+ }
+
+ private static ArrayList empty() {
+ return new ArrayList();
+ }
+
+ @Test
+ public void checkSorted() {
+ checkSort(empty(), empty());
+ checkSort(list(0, 1, 2, 3, 4), list(0, 1, 2, 3, 4));
+ checkSort(list(8, 4, 5, 6, 7), list(4, 5, 6, 7, 8));
+ }
+}