This commit is contained in:
Libkyy
2022-04-21 14:44:41 +02:00
parent 43f5063196
commit 70c87ffab0
8 changed files with 74 additions and 14 deletions

2
.idea/discord.xml generated
View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="DiscordProjectSettings"> <component name="DiscordProjectSettings">
<option name="show" value="ASK" /> <option name="show" value="PROJECT_FILES" />
<option name="description" value="" /> <option name="description" value="" />
</component> </component>
</project> </project>

View File

@@ -62,6 +62,8 @@ public class AdvancedEncryption
Assertions.assertEquals(input, plainText); Assertions.assertEquals(input, plainText);
long time = finish - start; long time = finish - start;
System.out.println(time + " nanoseconds"); System.out.println(time + " nanoseconds");
System.out.println(cipherText);
System.out.println(plainText);
} }
} }

View File

@@ -36,7 +36,7 @@ class FindPathsMatrixTest
} }
@Test @Test
void rxC() void RowMultiplyColumn()
{ {
int[][] M1 = int[][] M1 =
{ {

View File

@@ -120,5 +120,4 @@ public class PathFinder
{ {
return input.get(index); return input.get(index);
} }
} }

View File

@@ -8,8 +8,7 @@ public class linkedlist
linkedlist() linkedlist()
{ {
size = -1; size = 0;
} }
linkedlist(int value) linkedlist(int value)
@@ -17,7 +16,7 @@ public class linkedlist
node inserted =new node(value); node inserted =new node(value);
this.head = inserted; this.head = inserted;
this.tail = inserted; this.tail = inserted;
size = 0; size = 1;
} }
@@ -27,19 +26,19 @@ public class linkedlist
if(index == 0) if(index == 0)
return head; return head;
else if(index == size) else if(index == size-1)
return tail; return tail;
else if(index > size/2 && size > 10) else if(index > size/2)
{ {
node current = tail; node current = tail;
for(int count = size; count > index-2; count--) for(int count = size-1; count > index; count--)
current = current.prev; current = current.prev;
return current; return current;
} }
else if(index <= size/2 || size < 10) else if(index <= size/2)
{ {
node current = head; node current = head;
for(int count = 0; count < index-1; count++) for(int count = 0; count < index-1; count++)
@@ -117,4 +116,6 @@ public class linkedlist
} }
size--; size--;
} }
// Get factorial of number
} }

View File

@@ -30,9 +30,6 @@ public class node
@Override @Override
public String toString() public String toString()
{ {
return String.valueOf(this.data); return Integer.toString(data);
} }
} }

Binary file not shown.

View File

@@ -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<Integer> 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);
}
}