Skip to content

Update #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 31 commits into from
Feb 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
3259944
Update BubbleSort.java
cganey Nov 23, 2019
9f76ad5
Update README.md
BryanChan777 Nov 23, 2019
862ac23
Merge pull request #1175 from BryanChan777/patch-1
yanglbme Dec 6, 2019
79d29c0
Comment revisions
Arogon1 Dec 11, 2019
b14cb96
Merge pull request #1182 from Arogon1/master
yanglbme Dec 11, 2019
d9c7b84
Merge pull request #1174 from cganey/BubbleSortLogic
yanglbme Dec 16, 2019
a6ae951
fix: removed warning for Sorts 'C-style array declaration of paramete…
valerydec17 Dec 30, 2019
01283e3
Merge pull request #1197 from valerydec17/master
yanglbme Dec 31, 2019
dc6f830
optimization
realDuYuanChao Jan 9, 2020
6f06de1
Create update_directory_md.yml
cclauss Jan 9, 2020
23874ff
updating DIRECTORY.md
Jan 9, 2020
fc4ec2c
Merge pull request #1201 from shellhub/dev
yanglbme Jan 10, 2020
0ff74ca
optimization
realDuYuanChao Jan 11, 2020
726aab9
Merge pull request #1202 from shellhub/dev
yanglbme Jan 11, 2020
be6b259
Fix bug
StepfenShawn Jan 26, 2020
79467b3
Added Best/First/Worst Fit algorithm implementation
DekasDimitrios Jan 26, 2020
d40464a
Change Done
DekasDimitrios Jan 26, 2020
6d50ec3
Merge pull request #1214 from DekasDimitrios/master
StepfenShawn Jan 26, 2020
3584990
Update update_directory_md.yml
cclauss Jan 27, 2020
e919997
updating DIRECTORY.md
Jan 27, 2020
4f45c5a
Fixing packages.
Hassan-Elseoudy Jan 28, 2020
98ff29d
Merge pull request #1216 from Hassan-Elseoudy/master
nikhilkala Jan 28, 2020
a1f59c3
Closing scanners.
Hassan-Elseoudy Jan 28, 2020
926ed2e
Merge pull request #1217 from Hassan-Elseoudy/master
nikhilkala Jan 28, 2020
d5ddc35
Simple Substitution Cipher Algorithm added.
Hassan-Elseoudy Jan 28, 2020
e21d0ef
Update SimpleSubstitutionCipher.java
nikhilkala Jan 28, 2020
81612b4
Merge pull request #1218 from Hassan-Elseoudy/master
nikhilkala Jan 28, 2020
bf8845e
updating DIRECTORY.md
Jan 28, 2020
5aa05fd
Delete Dijkshtra.java
nikhilkala Jan 28, 2020
1f0f1a3
updating DIRECTORY.md
Jan 28, 2020
fcac632
Merge pull request #1219 from TheAlgorithms/nikhilkala-patch-1
nikhilkala Jan 28, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/update_directory_md.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# This GitHub Action updates the DIRECTORY.md file (if needed) when doing a git push
name: update_directory_md
on: [push]
jobs:
update_directory_md:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/setup-python@master
- name: update_directory_md
shell: python
run: |
import os
from typing import Iterator

URL_BASE = "https://github.com/TheAlgorithms/Java/blob/master"
g_output = []


def good_filepaths(top_dir: str = ".") -> Iterator[str]:
for dirpath, dirnames, filenames in os.walk(top_dir):
dirnames[:] = [d for d in dirnames if d[0] not in "._"]
for filename in filenames:
if os.path.splitext(filename)[1].lower() == ".java":
yield os.path.join(dirpath, filename).lstrip("./")


def md_prefix(i):
return f"{i * ' '}*" if i else "\n##"


def print_path(old_path: str, new_path: str) -> str:
global g_output
old_parts = old_path.split(os.sep)
for i, new_part in enumerate(new_path.split(os.sep)):
if i + 1 > len(old_parts) or old_parts[i] != new_part:
if new_part:
g_output.append(f"{md_prefix(i)} {new_part.replace('_', ' ')}")
return new_path


def build_directory_md(top_dir: str = ".") -> str:
global g_output
old_path = ""
for filepath in sorted(good_filepaths(), key=str.lower):
filepath, filename = os.path.split(filepath)
if filepath != old_path:
old_path = print_path(old_path, filepath)
indent = (filepath.count(os.sep) + 1) if filepath else 0
url = "/".join((URL_BASE, filepath, filename)).replace(" ", "%20")
filename = os.path.splitext(filename.replace("_", " "))[0]
g_output.append(f"{md_prefix(indent)} [{filename}]({url})")
return "\n".join(g_output)


with open("DIRECTORY.md", "w") as out_file:
out_file.write(build_directory_md(".") + "\n")

- name: Update DIRECTORY.md
run: |
cat DIRECTORY.md
git config --global user.name github-actions
git config --global user.email '${GITHUB_ACTOR}@users.noreply.github.com'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
git add DIRECTORY.md
git commit -am "updating DIRECTORY.md" || true
git push --force origin HEAD:$GITHUB_REF || true
1 change: 1 addition & 0 deletions Conversions/AnyBaseToAnyBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public static void main(String[] args) {
}
}
System.out.println(base2base(n, b1, b2));
in.close();
}

/**
Expand Down
1 change: 1 addition & 0 deletions Conversions/AnytoAny.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public static void main(String[] args) {
dec /= db;
}
System.out.println(dn);
scn.close();
}

}
3 changes: 2 additions & 1 deletion Conversions/DecimalToBinary.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/**
* This class converts a Decimal number to a Binary number
*
* @author Unknown
*
*/
class DecimalToBinary {

Expand Down Expand Up @@ -53,6 +53,7 @@ public static void bitwiseConversion() {
n >>= 1;
}
System.out.println("\tBinary number: " + b);
input.close();
}

}
1 change: 1 addition & 0 deletions Conversions/DecimalToHexaDecimal.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package Conversions;

//hex = [0 - 9] -> [A - F]
class DecimalToHexaDecimal {
private static final int sizeOfIntInHalfBytes = 8;
private static final int numberOfBitsInAHalfByte = 4;
Expand Down
4 changes: 3 additions & 1 deletion Conversions/DecimalToOctal.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
/**
* This class converts Decimal numbers to Octal Numbers
*
* @author Unknown
*
*/
public class DecimalToOctal {
/**
* Main Method
*
* @param args Command line Arguments
*/

//enter in a decimal value to get Octal output
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n, k, d, s = 0, c = 0;
Expand Down
3 changes: 1 addition & 2 deletions Conversions/HexToOct.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ public static void main(String args[]) {
// convert decimal to octal
octalnum = decimal2octal(decnum);
System.out.println("Number in octal: " + octalnum);


scan.close();
}
}
4 changes: 3 additions & 1 deletion Conversions/HexaDecimalToBinary.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package Conversions;

//Hex [0-9],[A-F] -> Binary [0,1]

public class HexaDecimalToBinary {

private final int LONG_BITS = 8;
Expand All @@ -9,7 +11,7 @@ public void convert(String numHex) {
int conHex = Integer.parseInt(numHex, 16);
// Hex a Binary:
String binary = Integer.toBinaryString(conHex);
// Presentation:
// Output:
System.out.println(numHex + " = " + completeDigits(binary));
}

Expand Down
2 changes: 1 addition & 1 deletion Conversions/HexaDecimalToDecimal.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public static void main(String args[]) {
and it returns the decimal form in the variable dec_output.
*/
System.out.println("Number in Decimal: " + dec_output);

scan.close();

}
}
20 changes: 20 additions & 0 deletions Conversions/IntegerToRoman.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,29 @@
package Conversions;

/**
* Converting Integers into Roman Numerals
*
*('I', 1);
*('IV',4);
*('V', 5);
*('IV',9);
*('X', 10);
*('XL',40;
*('L', 50);
*('XC',90);
*('C', 100);
*('D', 500);
*('M', 1000);
*
*/


public class IntegerToRoman {
private static int[] allArabianRomanNumbers = new int[]{1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1};
private static String[] allRomanNumbers = new String[]{"M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"};

//Value must be > 0

public static String integerToRoman(int num) {
if (num <= 0) {
return "";
Expand Down
1 change: 1 addition & 0 deletions Conversions/OctalToHexadecimal.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public static void main(String args[]) {
// Pass the decimla number to function and get converted Hex form of the number
String hex = DecimalToHex(decimal);
System.out.println("The Hexadecimal equivalant is: " + hex);
input.close();
}
}

1 change: 1 addition & 0 deletions Conversions/RomanToInteger.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class RomanToInteger {
put('D', 500);
put('M', 1000);
}};
//Roman Number = Roman Numerals

/**
* This function convert Roman number into Integer
Expand Down
Loading