diff --git a/Semester 3/Assignments/Lab_CalebFontenot_MaximumOrderedString/Printed HTMLs + PDFs/CompareSize.html b/Semester 3/Assignments/Lab_CalebFontenot_MaximumOrderedString/Printed HTMLs + PDFs/CompareSize.html
new file mode 100644
index 0000000..96908d7
--- /dev/null
+++ b/Semester 3/Assignments/Lab_CalebFontenot_MaximumOrderedString/Printed HTMLs + PDFs/CompareSize.html
@@ -0,0 +1,55 @@
+
+
+
+CompareSize.java
+
+
+
+
+/home/caleb/ASDV-Java/Semester 3/Assignments/Lab_CalebFontenot_MaximumOrderedString/src/main/java/edu/slcc/asdv/caleb/lab_calebfontenot_maximumorderedstring/CompareSize.java |
+
+
+nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt
+nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java
+
+package edu.slcc.asdv.caleb.lab_calebfontenot_maximumorderedstring;
+
+import java.util.Comparator;
+
+
+
+
+
+public class CompareSize implements Comparator {
+
+ @Override
+ public int compare(Object o1, Object o2)
+ {
+ int str1 = ((String) o1).length();
+ int str2 = ((String) o2).length();
+ if (str1 > str2) {
+ return -1;
+ } else if(str1 == str2) {
+ return 0;
+ } else if (str1 < str2) {
+ return 1;
+ }
+ return Integer.MAX_VALUE;
+ }
+
+}
+
+
diff --git a/Semester 3/Assignments/Lab_CalebFontenot_MaximumOrderedString/Printed HTMLs + PDFs/FindMax.html b/Semester 3/Assignments/Lab_CalebFontenot_MaximumOrderedString/Printed HTMLs + PDFs/FindMax.html
new file mode 100644
index 0000000..10fe138
--- /dev/null
+++ b/Semester 3/Assignments/Lab_CalebFontenot_MaximumOrderedString/Printed HTMLs + PDFs/FindMax.html
@@ -0,0 +1,74 @@
+
+
+
+FindMax.java
+
+
+
+
+/home/caleb/ASDV-Java/Semester 3/Assignments/Lab_CalebFontenot_MaximumOrderedString/src/main/java/edu/slcc/asdv/caleb/lab_calebfontenot_maximumorderedstring/FindMax.java |
+
+
+nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt
+nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java
+
+package edu.slcc.asdv.caleb.lab_calebfontenot_maximumorderedstring;
+
+import java.util.ArrayList;
+import java.util.Collections;
+
+
+
+
+
+
+
+public class FindMax {
+ public static String findMax(String input) {
+ int iterationCount = 0;
+ ArrayList<String> possibleSubStr = new ArrayList<>();
+ String currentStr = "";
+ for (int i = 0; i < input.length() -2; ++i) {
+ currentStr = input.charAt(i) + "";
+ for(int j = i + 1; j < input.length() -1; ++j) {
+ iterationCount++;
+ if (input.toLowerCase().charAt(i) < input.toLowerCase().charAt(j)) {
+ currentStr += input.charAt(j);
+ } else {
+ possibleSubStr.add(currentStr);
+ break;
+ }
+ }
+ }
+ System.out.println("Iteration count: " + iterationCount);
+ System.out.println(possibleSubStr);
+ Collections.sort(possibleSubStr, new CompareSize());
+ return possibleSubStr.get(0);
+ }
+ public static void main(String[] args)
+ {
+
+
+ String inputString = "abcdabcdefgzabcdefadcdefab";
+
+ System.out.print("The maximum sorted subString is: ");
+ System.out.println(findMax(inputString));
+ }
+}
+
+
diff --git a/Semester 3/Assignments/Lab_CalebFontenot_MaximumOrderedString/Printed HTMLs + PDFs/FindMaxOrderedSubString_edited.pdf b/Semester 3/Assignments/Lab_CalebFontenot_MaximumOrderedString/Printed HTMLs + PDFs/FindMaxOrderedSubString_edited.pdf
new file mode 100644
index 0000000..a397f68
Binary files /dev/null and b/Semester 3/Assignments/Lab_CalebFontenot_MaximumOrderedString/Printed HTMLs + PDFs/FindMaxOrderedSubString_edited.pdf differ
diff --git a/Semester 3/Assignments/Lab_CalebFontenot_MaximumOrderedString/Printed HTMLs + PDFs/FindMaxOrderedSubstring.html b/Semester 3/Assignments/Lab_CalebFontenot_MaximumOrderedString/Printed HTMLs + PDFs/FindMaxOrderedSubstring.html
new file mode 100644
index 0000000..806416f
--- /dev/null
+++ b/Semester 3/Assignments/Lab_CalebFontenot_MaximumOrderedString/Printed HTMLs + PDFs/FindMaxOrderedSubstring.html
@@ -0,0 +1,62 @@
+
+
+
+FindMaxOrderedSubstring.java
+
+
+
+
+/home/caleb/ASDV-Java/Semester 3/Assignments/Lab_CalebFontenot_MaximumOrderedString/src/main/java/edu/slcc/asdv/caleb/lab_calebfontenot_maximumorderedstring/FindMaxOrderedSubstring.java |
+
+
+nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt
+nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java
+
+package edu.slcc.asdv.caleb.lab_calebfontenot_maximumorderedstring;
+
+
+
+
+
+
+
+
+public class FindMaxOrderedSubstring {
+
+ public static String findMaxOrderedSubString(String input) {
+ String outputString = "";
+ int j = 0;
+ for (int i = 0; i < input.length(); ++i) {
+ if (i == 0) {
+ outputString += input.charAt(i);
+ }
+ if (input.charAt(i) > outputString.charAt(j)) {
+ ++j;
+ outputString += input.charAt(i);
+ }
+ }
+ return outputString;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(findMaxOrderedSubString("Welcome!"));
+ }
+}
+
+
+
diff --git a/Semester 3/Assignments/Lab_CalebFontenot_MaximumOrderedString/Printed HTMLs + PDFs/maxOrder.pdf b/Semester 3/Assignments/Lab_CalebFontenot_MaximumOrderedString/Printed HTMLs + PDFs/maxOrder.pdf
new file mode 100644
index 0000000..fe6cb0f
Binary files /dev/null and b/Semester 3/Assignments/Lab_CalebFontenot_MaximumOrderedString/Printed HTMLs + PDFs/maxOrder.pdf differ
diff --git a/Semester 3/Assignments/Lab_CalebFontenot_MaximumOrderedString/src/main/java/edu/slcc/asdv/caleb/lab_calebfontenot_maximumorderedstring/CompareSize.java b/Semester 3/Assignments/Lab_CalebFontenot_MaximumOrderedString/src/main/java/edu/slcc/asdv/caleb/lab_calebfontenot_maximumorderedstring/CompareSize.java
new file mode 100644
index 0000000..6d968d2
--- /dev/null
+++ b/Semester 3/Assignments/Lab_CalebFontenot_MaximumOrderedString/src/main/java/edu/slcc/asdv/caleb/lab_calebfontenot_maximumorderedstring/CompareSize.java
@@ -0,0 +1,30 @@
+/*
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
+ */
+package edu.slcc.asdv.caleb.lab_calebfontenot_maximumorderedstring;
+
+import java.util.Comparator;
+
+/**
+ *
+ * @author caleb
+ */
+public class CompareSize implements Comparator {
+
+ @Override
+ public int compare(Object o1, Object o2)
+ {
+ int str1 = ((String) o1).length();
+ int str2 = ((String) o2).length();
+ if (str1 > str2) {
+ return -1;
+ } else if(str1 == str2) {
+ return 0;
+ } else if (str1 < str2) {
+ return 1;
+ }
+ return Integer.MAX_VALUE;
+ }
+
+}
\ No newline at end of file
diff --git a/Semester 3/Assignments/Lab_CalebFontenot_MaximumOrderedString/src/main/java/edu/slcc/asdv/caleb/lab_calebfontenot_maximumorderedstring/FindMax.java b/Semester 3/Assignments/Lab_CalebFontenot_MaximumOrderedString/src/main/java/edu/slcc/asdv/caleb/lab_calebfontenot_maximumorderedstring/FindMax.java
index 47bcc0c..c46a688 100644
--- a/Semester 3/Assignments/Lab_CalebFontenot_MaximumOrderedString/src/main/java/edu/slcc/asdv/caleb/lab_calebfontenot_maximumorderedstring/FindMax.java
+++ b/Semester 3/Assignments/Lab_CalebFontenot_MaximumOrderedString/src/main/java/edu/slcc/asdv/caleb/lab_calebfontenot_maximumorderedstring/FindMax.java
@@ -15,11 +15,13 @@ import java.util.Scanner;
*/
public class FindMax {
public static String findMax(String input) {
+ int iterationCount = 0;
ArrayList possibleSubStr = new ArrayList<>();
String currentStr = "";
for (int i = 0; i < input.length() -2; ++i) {
currentStr = input.charAt(i) + "";
for(int j = i + 1; j < input.length() -1; ++j) {
+ iterationCount++;
if (input.toLowerCase().charAt(i) < input.toLowerCase().charAt(j)) {
currentStr += input.charAt(j);
} else {
@@ -28,8 +30,9 @@ public class FindMax {
}
}
}
+ System.out.println("Iteration count: " + iterationCount);
+ System.out.println(possibleSubStr);
Collections.sort(possibleSubStr, new CompareSize());
- //System.out.println(possibleSubStr);
return possibleSubStr.get(0);
}
public static void main(String[] args)
@@ -41,22 +44,4 @@ public class FindMax {
System.out.print("The maximum sorted subString is: ");
System.out.println(findMax(inputString));
}
-}
-class CompareSize implements Comparator {
-
- @Override
- public int compare(Object o1, Object o2)
- {
- int str1 = ((String) o1).length();
- int str2 = ((String) o2).length();
- if (str1 > str2) {
- return -1;
- } else if(str1 == str2) {
- return 0;
- } else if (str1 < str2) {
- return 1;
- }
- return Integer.MAX_VALUE;
- }
-
}
\ No newline at end of file
diff --git a/Semester 3/Assignments/Lab_CalebFontenot_MaximumOrderedString/src/main/java/edu/slcc/asdv/caleb/lab_calebfontenot_maximumorderedstring/FindMaxOrderedSubstring.java b/Semester 3/Assignments/Lab_CalebFontenot_MaximumOrderedString/src/main/java/edu/slcc/asdv/caleb/lab_calebfontenot_maximumorderedstring/FindMaxOrderedSubstring.java
new file mode 100644
index 0000000..68ed32d
--- /dev/null
+++ b/Semester 3/Assignments/Lab_CalebFontenot_MaximumOrderedString/src/main/java/edu/slcc/asdv/caleb/lab_calebfontenot_maximumorderedstring/FindMaxOrderedSubstring.java
@@ -0,0 +1,34 @@
+/*
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
+ */
+package edu.slcc.asdv.caleb.lab_calebfontenot_maximumorderedstring;
+
+import java.util.ArrayList;
+import java.util.Collections;
+
+/**
+ *
+ * @author caleb
+ */
+public class FindMaxOrderedSubstring {
+
+ public static String findMaxOrderedSubString(String input) {
+ String outputString = "";
+ int j = 0;
+ for (int i = 0; i < input.length(); ++i) {
+ if (i == 0) {
+ outputString += input.charAt(i);
+ }
+ if (input.charAt(i) > outputString.charAt(j)) {
+ ++j;
+ outputString += input.charAt(i);
+ }
+ }
+ return outputString;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(findMaxOrderedSubString("Welcome!"));
+ }
+}
diff --git a/Semester 3/ZIPs/Lab_CalebFontenot_MaximumOrderedString.zip b/Semester 3/ZIPs/Lab_CalebFontenot_MaximumOrderedString.zip
new file mode 100644
index 0000000..7b1ede5
Binary files /dev/null and b/Semester 3/ZIPs/Lab_CalebFontenot_MaximumOrderedString.zip differ