From 70c87ffab0650c3cae6d6d0bdba3c8f6f16e0079 Mon Sep 17 00:00:00 2001 From: Libkyy Date: Thu, 21 Apr 2022 14:44:41 +0200 Subject: [PATCH] RSA --- .idea/discord.xml | 2 +- src/Encryption/AdvancedEncryption.java | 2 + src/FindPathsPls/FindPathsMatrixTest.java | 2 +- src/FindPathsPls/PathFinder.java | 1 - src/ScuffedLinkedList/linkedlist.java | 15 +++--- src/ScuffedLinkedList/node.java | 5 +- src/ScuffedLinkedList/sheet1DS.class | Bin 0 -> 1929 bytes src/ScuffedLinkedList/sheet1DS.java | 61 ++++++++++++++++++++++ 8 files changed, 74 insertions(+), 14 deletions(-) create mode 100644 src/ScuffedLinkedList/sheet1DS.class create mode 100644 src/ScuffedLinkedList/sheet1DS.java 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 0000000000000000000000000000000000000000..888243aa99085cc27ebaf63e200486ecc25f8b33 GIT binary patch literal 1929 zcmaJ>%TgOh6g`a|Bg6m#%u9d`gonTm@*}a$%Z>rd7U7kMK!7;OAPq2Rm{Bw%DpVyq zJ|dM>URBw6LA($Yu1aN{Psl3kd_>6Ukuai6Wix%d=ibxzo_qTK`S0oP04CvvQ3am@ zzls2Y0+C&9UyGZXwH;sF+||>rKybpa4EK?MFE+FiLP$V72_ej7Dg>3wbO?1^W_|opfj*BCPZEZ;Z)f#*3B5#e!h1$+_IH)clpRZ;&owJ!>Q3LBZD$L)@wd~g zIJp$Ke2~+xaIY-1tjJ15l_91z(@YtzJ|04rnv$&QnQjpRpKMK{V4B_YT0Yw?1k|K_ z=+h?I*Bu3vX#ZO!UsZ_$KC|op@5&)oDjPlQbQOgPjstcdL4H5uu8XUXr^Ck(ztIqQ z!LR%+ztvJdw54m70P=J&8d?7l!A9jM8d;J?HI0NcYG_PIqxPt={)nzs9@qe3fH2`| zXsM`2EwiaZ8?6pRm|Fw-(1g$F6@l9CcB9gS5{ij&;Hj?5JD^si-xWSaVS$hvUIjVZdLmd5_ZG#v?3{xDm z3%H48+`=k{?F)<`joYv}H^0F>ug)<9&KRr+Hc}{PRfvN&fB8&YoSl*W%U-1C3w&8- z`Ej|u9n4oD!9^_5ifo)9Rm4gpe1f$LeKf+)= 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); + } + + +}