Skip to content

Commit 83f568b

Browse files
committed
fix all files to Java Standard
1 parent 5b500ec commit 83f568b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+198
-53
lines changed

.gitignore

+108
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
2+
# Eclipse
3+
*.class
4+
target/
5+
.project
6+
.classpath
7+
.settings
8+
.factorypath
9+
.attach*
10+
11+
# Package Files #
12+
*.jar
13+
*.war
14+
*.ear
15+
16+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
17+
hs_err_pid*
18+
19+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
20+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
21+
22+
.idea/
23+
.idea/**/*.xml
24+
.idea/*.xml
25+
26+
.idea/.gitignore
27+
.idea/codeStyles/Project.xml
28+
.idea/codeStyles/codeStyleConfig.xml
29+
.idea/compiler.xml
30+
.idea/encodings.xml
31+
.idea/jarRepositories.xml
32+
.idea/misc.xml
33+
.idea/vcs.xml
34+
35+
# User-specific stuff
36+
.idea/**/workspace.xml
37+
.idea/**/tasks.xml
38+
.idea/**/usage.statistics.xml
39+
.idea/**/dictionaries
40+
.idea/**/shelf
41+
42+
# AWS User-specific
43+
.idea/**/aws.xml
44+
45+
# Generated files
46+
.idea/**/contentModel.xml
47+
48+
# Sensitive or high-churn files
49+
.idea/**/dataSources/
50+
.idea/**/dataSources.ids
51+
.idea/**/dataSources.local.xml
52+
.idea/**/sqlDataSources.xml
53+
.idea/**/dynamic.xml
54+
.idea/**/uiDesigner.xml
55+
.idea/**/dbnavigator.xml
56+
57+
# Gradle
58+
.idea/**/gradle.xml
59+
.idea/**/libraries
60+
61+
# Gradle and Maven with auto-import
62+
# When using Gradle or Maven with auto-import, you should exclude module files,
63+
# since they will be recreated, and may cause churn. Uncomment if using
64+
# auto-import.
65+
# .idea/artifacts
66+
# .idea/compiler.xml
67+
# .idea/jarRepositories.xml
68+
# .idea/modules.xml
69+
# .idea/*.iml
70+
# .idea/modules
71+
# *.iml
72+
# *.ipr
73+
74+
# CMake
75+
cmake-build-*/
76+
77+
# Mongo Explorer plugin
78+
.idea/**/mongoSettings.xml
79+
80+
# File-based project format
81+
*.iws
82+
83+
# IntelliJ
84+
out/
85+
86+
# mpeltonen/sbt-idea plugin
87+
.idea_modules/
88+
89+
# JIRA plugin
90+
atlassian-ide-plugin.xml
91+
92+
# Cursive Clojure plugin
93+
.idea/replstate.xml
94+
95+
# SonarLint plugin
96+
.idea/sonarlint/
97+
98+
# Crashlytics plugin (for Android Studio and IntelliJ)
99+
com_crashlytics_export_strings.xml
100+
crashlytics.properties
101+
crashlytics-build.properties
102+
fabric.properties
103+
104+
# Editor-based Rest Client
105+
.idea/httpRequests
106+
107+
# Android studio 3.1+ serialized cache file
108+
.idea/caches/build_file_checksums.ser

Automorphic_Number.java AutomorphicNumber.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Java program to check if a number is Automorphic
2-
import java.io.*;
3-
class Test {
2+
3+
class AutomorphicNumber {
44
// Function to check Automorphic number
55
static boolean isAutomorphic(int N)
66
{

BellmanFordAlgoImplement.java

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
import java.io.*;
21
import java.lang.*;
3-
import java.util.*;
42

53
// A class to represent a connected, directed and weighted
64
// graph
7-
class Graph {
5+
class BellmanFordAlgoImplement {
86

97
// A class to represent a weighted edge in graph
108
class Edge {
@@ -16,7 +14,7 @@ class Edge {
1614
Edge edge[];
1715

1816
// Creates a graph with V vertices and E edges
19-
Graph(int v, int e)
17+
BellmanFordAlgoImplement(int v, int e)
2018
{
2119
V = v;
2220
E = e;
@@ -29,7 +27,7 @@ class Edge {
2927
// src to all other vertices using Bellman-Ford
3028
// algorithm. The function also detects negative weight
3129
// cycle
32-
void BellmanFord(Graph graph, int src)
30+
void BellmanFord(BellmanFordAlgoImplement graph, int src)
3331
{
3432
int V = graph.V, E = graph.E;
3533
int dist[] = new int[V];
@@ -86,7 +84,7 @@ public static void main(String[] args)
8684
int V = 5; // Number of vertices in graph
8785
int E = 8; // Number of edges in graph
8886

89-
Graph graph = new Graph(V, E);
87+
BellmanFordAlgoImplement graph = new BellmanFordAlgoImplement(V, E);
9088

9189
// add edge 0-1 (or A-B in above figure)
9290
graph.edge[0].src = 0;
File renamed without changes.

Boolean_matrix.java BooleanMatrix.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Link Of Problem - https://practice.geeksforgeeks.org/problems/boolean-matrix-problem-1587115620/1
44
*/
55

6-
class Solution
6+
class BooleanMatrix
77
{
88
//Function to modify the matrix such that if a matrix cell matrix[i][j]
99
//is 1 then all the cells in its ith row and jth column will become 1.

bubblesort.java BubbleSort.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import java.util.Scanner;
2-
public class bubblesort{
2+
public class BubbleSort {
33
public static void main(String[] args){
44
Scanner sc = new Scanner(System.in);
55
System.out.println("Enter the number of elements");

Column_name_for_given_Column_Number.java ColumnNameForGivenColumnNumber.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
class Solution
1+
import java.util.ArrayList;
2+
3+
class ColumnNameForGivenColumnNumber
24
{
35
//Function to return list of integers that form the boundary
46
//traversal of the matrix in a clockwise manner.

Column_name_from_given_column_number.java ColumnNameFromGivenColumnNumber.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@
66
//{ Driver Code Starts
77
//Initial Template for Java
88

9-
import java.io.*;
109
import java.util.*;
1110
import java.lang.*;
12-
class GfG
11+
class ColumnNameFromGivenColumnNumber
1312
{
1413
public static void main (String[] args)
1514
{

FindTotalNumberOfNodesInBST FindTotalNumberOfNodesInBST.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Java program for the above approach
22
import java.io.*;
33

4-
class GFG {
4+
class FindTotalNumberOfNodesInBST {
55
// tree node
66
static class node
77
{

Cycle Sort Hanoi1.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
import java.util.*;
2-
import java.lang.*;
3-
4-
class GFG {
1+
class Hanoi1 {
52
public static void cycleSort(int arr[], int n)
63
{
74
int writes = 0;

hanoi.java Hanoi2.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
class GFG
1+
class Hanoi2
22
{
33
// Java recursive function to solve tower of hanoi puzzle
44
static void towerOfHanoi(int n, char from_rod, char to_rod, char aux_rod)
@@ -17,6 +17,6 @@ static void towerOfHanoi(int n, char from_rod, char to_rod, char aux_rod)
1717
public static void main(String args[])
1818
{
1919
int n = 4; // Number of disks
20-
towerOfHanoi(n, \'A\', \'C\', \'B\'); // A, B and C are names of rods
20+
towerOfHanoi(n, 'A', 'C', 'B'); // A, B and C are names of rods
2121
}
2222
}

Heap_sort.java HeapSort.java

File renamed without changes.

Java-problem-2023.iml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module type="JAVA_MODULE" version="4">
3+
<component name="NewModuleRootManager" inherit-compiler-output="true">
4+
<exclude-output />
5+
<content url="file://$MODULE_DIR$">
6+
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
7+
</content>
8+
<orderEntry type="inheritedJdk" />
9+
<orderEntry type="sourceFolder" forTests="false" />
10+
</component>
11+
</module>

largest_sum_subarray(kadanes_algorithm) Kadane.java

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
// Java program to print largest contiguous array sum
2-
import java.io.*;
3-
import java.util.*;
42

53
class Kadane {
64
// Driver Code

Knapsack.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import java.util.*;
2-
public class knapsack {
2+
public class Knapsack {
33

44

55
static int max(int a, int b)

Implemention of a Kruskal's Algorithm KruskalsAlgorithm.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ using namespace std;
88
typedef pair<int, int> iPair;
99

1010
// Structure to represent a graph
11-
struct Graph
11+
struct BellmanFordAlgoImplement
1212
{
1313
int V, E;
1414
vector< pair<int, iPair> > edges;
1515

1616
// Constructor
17-
Graph(int V, int E)
17+
BellmanFordAlgoImplement(int V, int E)
1818
{
1919
this->V = V;
2020
this->E = E;
@@ -86,7 +86,7 @@ struct DisjointSets
8686

8787
/* Functions returns weight of the MST*/
8888

89-
int Graph::kruskalMST()
89+
int BellmanFordAlgoImplement::kruskalMST()
9090
{
9191
int mst_wt = 0; // Initialize result
9292

@@ -132,7 +132,7 @@ int main()
132132
/* Let us create above shown weighted
133133
and undirected graph */
134134
int V = 9, E = 14;
135-
Graph g(V, E);
135+
BellmanFordAlgoImplement g(V, E);
136136

137137
// making above shown graph
138138
g.addEdge(0, 1, 4);

longest_common_subsequence_with_sum_k.java LongestCommonSubsequenceWithSumK.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Java code to implement the approach
2-
import java.io.*;
3-
class answer {
2+
3+
class LongestCommonSubsequenceWithSumK {
44

55
static int solve(int a[], int b[], int i, int j, int sum)
66
{

Merge_sort.java MergeSort.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import java.util.*;
2-
public class merge {
2+
public class MergeSort {
33

44
void mergesort(int arr[], int l, int m, int r)
55

@@ -83,8 +83,8 @@ public static void main(String args[])
8383

8484
for (i = 0;i<n; i++)
8585
arr[i] = s.nextInt();
86-
87-
merge ob = new merge();
86+
87+
MergeSort ob = new MergeSort();
8888
ob.sort(arr, 0, arr.length - 1);
8989
System.out.println("\nSorted array is");
9090

pattern132.java Pattern132.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
import java.util.*;
1717

18-
public class pattern132{
18+
public class Pattern132 {
1919
private static boolean find132pattern(int[] nums) {
2020
int n = nums.length;
2121
if (n < 3)

Print Maze Paths.java PrintMazePaths.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@
1616
1717
*/
1818

19-
import java.io.*;
2019
import java.util.*;
2120

22-
public class Solution {
21+
public class PrintMazePaths {
2322
static void generate(int i, int j, int n, int m, String curr, ArrayList<String> ans){
2423
if(i==n-1 && j==m-1){
2524
ans.add(curr);

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Java-problem-2023
22

3-
Submit your java realted problem and solution.
3+
Submit your Java related problem and solution.

Radix_sort.java RadixSort.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// Radix sort Java implementation
22

3-
import java.io.*;
4-
import java.util.*;
3+
import java.util.Arrays;
54

6-
class Radix {
5+
class RadixSort {
76

87
// A utility function to get maximum value in arr[]
98
static int getMax(int arr[], int n)

reverse.java Reverse.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
class Main {
1+
class Reverse {
22
public static void main(String[] args) {
33

44
int num = 1234, reversed = 0;
File renamed without changes.

stackUsingQueue.java StackUsingQueue.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
two queue */
33
import java.util.*;
44

5-
class stackUsingQueue {
5+
class StackUsingQueue {
66

77
static class Stack {
88
// Two inbuilt queues

all_subsequences_with_sum_equal_k.java SubsequencesSumK.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//Question : Find all subsequences with sum equals to K
22

33
import java.util.*;
4-
public class SubsequenceSumK
4+
public class SubsequencesSumK
55
{
66

77
// Function to find the subsequences

Graph algorithms/BellmanFordAlgorithm.java graph/algorithms/BellmanFordAlgorithm.java

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
package graph.algorithms;
2+
13
import java.util.*;
24

35
public class BellmanFordAlgorithm {

Graph algorithms/DijkstrasAlgorithmMST.java graph/algorithms/DijkstrasAlgorithmMST.java

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
package graph.algorithms;
2+
13
import java.util.*;
24

35
public class DijkstrasAlgorithmMST {

Graph algorithms/DijkstrasAlgorithmSP.java graph/algorithms/DijkstrasAlgorithmSP.java

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
package graph.algorithms;
2+
13
import java.util.*;
24

35
public class DijkstrasAlgorithmSP {

Graph algorithms/FloodFill.java graph/algorithms/FloodFill.java

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
package graph.algorithms;
2+
13
public class FloodFill {
24

35
public static void floodFill(int[][] image, int sr, int sc, int newColor) {

0 commit comments

Comments
 (0)