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 = decnum =
hex2decimal( hex2decimal(
hexadecnum); // Pass the string to the hex2decimal function and get the decimal form in hexadecnum); // Pass the string to the hex2decimal function and get the decimal form in
// variable decnum // variable decnum
// convert decimal to octal // convert decimal to octal
octalnum = decimal2octal(decnum); octalnum = decimal2octal(decnum);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,5 @@
package Others; package Others;
/** /**
* Guass Legendre Algorithm ref https://en.wikipedia.org/wiki/GaussLegendre_algorithm * 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) { private static String[] returnSubsequence(String givenString) {
if (givenString.length() if (givenString.length()
== 0) // If string is empty we will create an array of size=1 and insert "" (Empty string) == 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]; String[] ans = new String[1];
ans[0] = ""; ans[0] = "";
@ -33,7 +33,7 @@ public class ReturnSubsequence {
returnSubsequence( returnSubsequence(
givenString.substring( givenString.substring(
1)); // recursive call to get subsequences of substring starting from index 1)); // recursive call to get subsequences of substring starting from index
// position=1 // position=1
String[] ans = String[] ans =
new String new String
@ -47,7 +47,7 @@ public class ReturnSubsequence {
givenString.charAt(0) givenString.charAt(0)
+ SmallAns[ + SmallAns[
k]; // Insert character at index=0 of the given substring in front of every string k]; // Insert character at index=0 of the given substring in front of every string
// in SmallAns // in SmallAns
} }
return ans; return ans;
} }

View File

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