This commit is contained in:
Jacob Signorovitch
2025-01-01 14:22:30 -05:00
parent a2c1a9d2d9
commit d0da5f1a5d

View File

@@ -121,11 +121,16 @@ class Util {
return sorted; return sorted;
} }
// Insert a Tree into an ArrayList of trees already sorted in [0, i], where // Insert a Tree into an ArrayList of trees already sorted in [0, i), where
// 0 <= i <= trees.size(), such that it is sorted through [0, i]. // 0 <= i <= trees.size(), such that it is sorted through [0, i].
static void insert(ITree tree, ArrayList<ITree> trees, int i) { static void insert(ITree tree, ArrayList<ITree> trees, int i) {
<<<<<<< Updated upstream
System.out.println("Set j = 0. While j < " + (i + 1) + ", j++."); System.out.println("Set j = 0. While j < " + (i + 1) + ", j++.");
for (int j = 0; j < (i + 1); j++) { for (int j = 0; j < (i + 1); j++) {
=======
for (int j = 0; j < i + 1; j++) {
System.out.println("it's here it's fucking here");
>>>>>>> Stashed changes
if (trees.get(j).lessThan(tree)) { if (trees.get(j).lessThan(tree)) {
trees.add(j, tree); trees.add(j, tree);
return; return;
@@ -138,6 +143,7 @@ class Util {
// Insert a Tree in an already fully sorted ArrayList of Trees. // Insert a Tree in an already fully sorted ArrayList of Trees.
static void insert(ITree tree, ArrayList<ITree> sortedTrees) { static void insert(ITree tree, ArrayList<ITree> sortedTrees) {
for (int i = 0; i < sortedTrees.size(); i++) { for (int i = 0; i < sortedTrees.size(); i++) {
System.out.println("h");
if (sortedTrees.get(i).lessThan(tree)) { if (sortedTrees.get(i).lessThan(tree)) {
sortedTrees.add(i, tree); sortedTrees.add(i, tree);
return; return;