Formatted with Google Java Formatter

This commit is contained in:
github-actions 2020-10-24 10:31:42 +00:00
parent d27ded91a0
commit 0db62bb450
9 changed files with 12 additions and 14 deletions

View File

@ -63,7 +63,7 @@ public class HexToOct {
decnum =
hex2decimal(
hexadecnum); // Pass the string to the hex2decimal function and get the decimal form in
// variable decnum
// variable decnum
// convert decimal to octal
octalnum = decimal2octal(decnum);

View File

@ -48,7 +48,7 @@ start vertex, end vertes and weights. Vertices should be labelled with a number
public void
go() // Interactive run for understanding the class first time. Assumes source vertex is 0 and
// shows distaance to all vertices
// shows distaance to all vertices
{
Scanner sc = new Scanner(System.in); // Grab scanner object for user input
int i, v, e, u, ve, w, j, neg = 0;
@ -66,7 +66,7 @@ start vertex, end vertes and weights. Vertices should be labelled with a number
int dist[] =
new int
[v]; // Distance array for holding the finalized shortest path distance between source
// and all vertices
// and all vertices
int p[] = new int[v]; // Parent array for holding the paths
for (i = 0; i < v; i++) dist[i] = Integer.MAX_VALUE; // Initializing distance values
dist[0] = 0;
@ -115,7 +115,7 @@ start vertex, end vertes and weights. Vertices should be labelled with a number
double dist[] =
new double
[v]; // Distance array for holding the finalized shortest path distance between source
// and all vertices
// and all vertices
int p[] = new int[v]; // Parent array for holding the paths
for (i = 0; i < v; i++) dist[i] = Integer.MAX_VALUE; // Initializing distance values
dist[source] = 0;

View File

@ -13,7 +13,7 @@ public class FloydWarshall {
new int[numberofvertices + 1]
[numberofvertices
+ 1]; // stores the value of distance from all the possible path form the source
// vertex to destination vertex
// vertex to destination vertex
Arrays.fill(DistanceMatrix, 0);
this.numberofvertices = numberofvertices;
}

View File

@ -1,6 +1,5 @@
package DataStructures.Heaps;
/**
* Class for heap elements.<br>
*

View File

@ -61,12 +61,12 @@ public class SinglyLinkedList {
checkBounds(position, 0, size);
Node newNode = new Node(data);
if (head == null) {
/* the list is empty */
/* the list is empty */
head = newNode;
size++;
return;
} else if (position == 0) {
/* insert at the head of the list */
/* insert at the head of the list */
newNode.next = head;
head = newNode;
size++;

View File

@ -38,7 +38,7 @@ public class BestFit {
int minDiff = findMaxElement(blockSizes);
int index =
NO_ALLOCATION; // If there is no block that can fit the process, return NO_ALLOCATION as the
// result.
// result.
for (int i = 0;
i < blockSizes.length;
i++) { // Find the most fitting memory block for the given process.

View File

@ -1,6 +1,5 @@
package Others;
/**
* Guass Legendre Algorithm ref https://en.wikipedia.org/wiki/GaussLegendre_algorithm
*

View File

@ -23,7 +23,7 @@ public class ReturnSubsequence {
private static String[] returnSubsequence(String givenString) {
if (givenString.length()
== 0) // If string is empty we will create an array of size=1 and insert "" (Empty string)
// in it
// in it
{
String[] ans = new String[1];
ans[0] = "";
@ -33,7 +33,7 @@ public class ReturnSubsequence {
returnSubsequence(
givenString.substring(
1)); // recursive call to get subsequences of substring starting from index
// position=1
// position=1
String[] ans =
new String
@ -47,7 +47,7 @@ public class ReturnSubsequence {
givenString.charAt(0)
+ SmallAns[
k]; // Insert character at index=0 of the given substring in front of every string
// in SmallAns
// in SmallAns
}
return ans;
}

View File

@ -31,7 +31,7 @@ public class JumpSearch implements SearchAlgorithm {
for (int i = limit - blockSize; i <= limit; i++) {
if (array[i] == key) {
/* execute linear search */
/* execute linear search */
return i;
}
}