diff --git a/.idea/discord.xml b/.idea/discord.xml index 30bab2a..d8e9561 100644 --- a/.idea/discord.xml +++ b/.idea/discord.xml @@ -1,7 +1,7 @@ - \ No newline at end of file diff --git a/src/Encryption/AdvancedEncryption.java b/src/Encryption/AdvancedEncryption.java index 8fc9de7..ac21db3 100644 --- a/src/Encryption/AdvancedEncryption.java +++ b/src/Encryption/AdvancedEncryption.java @@ -62,6 +62,8 @@ public class AdvancedEncryption Assertions.assertEquals(input, plainText); long time = finish - start; System.out.println(time + " nanoseconds"); + System.out.println(cipherText); + System.out.println(plainText); } } diff --git a/src/FindPathsPls/FindPathsMatrixTest.java b/src/FindPathsPls/FindPathsMatrixTest.java index 05611a2..7ce18ba 100644 --- a/src/FindPathsPls/FindPathsMatrixTest.java +++ b/src/FindPathsPls/FindPathsMatrixTest.java @@ -36,7 +36,7 @@ class FindPathsMatrixTest } @Test - void rxC() + void RowMultiplyColumn() { int[][] M1 = { diff --git a/src/FindPathsPls/PathFinder.java b/src/FindPathsPls/PathFinder.java index 9a31ea8..7ebe92b 100644 --- a/src/FindPathsPls/PathFinder.java +++ b/src/FindPathsPls/PathFinder.java @@ -120,5 +120,4 @@ public class PathFinder { return input.get(index); } - } diff --git a/src/ScuffedLinkedList/linkedlist.java b/src/ScuffedLinkedList/linkedlist.java index 28c18d1..0096406 100644 --- a/src/ScuffedLinkedList/linkedlist.java +++ b/src/ScuffedLinkedList/linkedlist.java @@ -8,8 +8,7 @@ public class linkedlist linkedlist() { - size = -1; - + size = 0; } linkedlist(int value) @@ -17,7 +16,7 @@ public class linkedlist node inserted =new node(value); this.head = inserted; this.tail = inserted; - size = 0; + size = 1; } @@ -27,19 +26,19 @@ public class linkedlist if(index == 0) return head; - else if(index == size) + else if(index == size-1) return tail; - else if(index > size/2 && size > 10) + else if(index > size/2) { node current = tail; - for(int count = size; count > index-2; count--) + for(int count = size-1; count > index; count--) current = current.prev; return current; } - else if(index <= size/2 || size < 10) + else if(index <= size/2) { node current = head; for(int count = 0; count < index-1; count++) @@ -117,4 +116,6 @@ public class linkedlist } size--; } + // Get factorial of number + } diff --git a/src/ScuffedLinkedList/node.java b/src/ScuffedLinkedList/node.java index 3fcb9ab..a115028 100644 --- a/src/ScuffedLinkedList/node.java +++ b/src/ScuffedLinkedList/node.java @@ -30,9 +30,6 @@ public class node @Override public String toString() { - return String.valueOf(this.data); + return Integer.toString(data); } - - - } diff --git a/src/ScuffedLinkedList/sheet1DS.class b/src/ScuffedLinkedList/sheet1DS.class new file mode 100644 index 0000000..888243a Binary files /dev/null and b/src/ScuffedLinkedList/sheet1DS.class differ diff --git a/src/ScuffedLinkedList/sheet1DS.java b/src/ScuffedLinkedList/sheet1DS.java new file mode 100644 index 0000000..80a67d3 --- /dev/null +++ b/src/ScuffedLinkedList/sheet1DS.java @@ -0,0 +1,61 @@ +package ScuffedLinkedList; + +import java.util.Scanner; +import java.util.Stack; + +public class sheet1DS +{ + public static String Grade(int score) + { + if(score >= 90) + return "A"; + else if(score >= 80) + return "B"; + else if(score >= 70) + return "C"; + else if(score >= 60) + return "D"; + else + return "F"; + } + public static int factorial(int n) + { + + if(n > 2) + return n * factorial(n-1); + else + return 1; + } + public static void PassOrFail(int n) + { + int entered = 0,current,fail = 0,fullmark = 0; + Scanner input = new Scanner(System.in); + Stack Students = new Stack<>(); + while(entered <= n) + { + Students.push(input.nextInt()); + entered++; + } + input.close(); + while(!Students.isEmpty()) + { + current = Students.pop(); + if(current < 50) + fail++; + if(current == 100) + fullmark++; + } + System.out.println("Failed " + fail); + System.out.println("Full Mark " + fullmark); + + } + + public static void main(String[] args) + { + System.out.println(factorial(4)); + System.out.print(Grade(91)); + PassOrFail(10); + } + + +}