forked from eugenp/tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BAEL-9551] - Splitted algorithms into 4 modules
- Loading branch information
Showing
164 changed files
with
1,735 additions
and
1,241 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/target/ | ||
.settings/ | ||
.classpath | ||
.project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
## Relevant articles: | ||
|
||
- [Introduction to Jenetics Library](http://www.baeldung.com/jenetics) | ||
- [Ant Colony Optimization](http://www.baeldung.com/java-ant-colony-optimization) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,96 +1,96 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.baeldung</groupId> | ||
<artifactId>algorithms</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
|
||
<parent> | ||
<groupId>com.baeldung</groupId> | ||
<artifactId>parent-modules</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-math3</artifactId> | ||
<version>${commons-math3.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>commons-codec</groupId> | ||
<artifactId>commons-codec</artifactId> | ||
<version>${commons-codec.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
<version>${lombok.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.jenetics</groupId> | ||
<artifactId>jenetics</artifactId> | ||
<version>${io.jenetics.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jgrapht</groupId> | ||
<artifactId>jgrapht-core</artifactId> | ||
<version>${org.jgrapht.core.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>pl.allegro.finance</groupId> | ||
<artifactId>tradukisto</artifactId> | ||
<version>${tradukisto.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.assertj</groupId> | ||
<artifactId>assertj-core</artifactId> | ||
<version>${org.assertj.core.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<pluginManagement> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>exec-maven-plugin</artifactId> | ||
<version>${exec-maven-plugin.version}</version> | ||
</plugin> | ||
</plugins> | ||
</pluginManagement> | ||
</build> | ||
|
||
<reporting> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>cobertura-maven-plugin</artifactId> | ||
<version>2.7</version> | ||
<configuration> | ||
<instrumentation> | ||
<ignores> | ||
<ignore>com/baeldung/algorithms/dijkstra/*</ignore> | ||
</ignores> | ||
<excludes> | ||
<exclude>com/baeldung/algorithms/dijkstra/*</exclude> | ||
</excludes> | ||
</instrumentation> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</reporting> | ||
|
||
<properties> | ||
<lombok.version>1.16.12</lombok.version> | ||
<commons-math3.version>3.6.1</commons-math3.version> | ||
<tradukisto.version>1.0.1</tradukisto.version> | ||
<io.jenetics.version>3.7.0</io.jenetics.version> | ||
<org.jgrapht.core.version>1.0.1</org.jgrapht.core.version> | ||
<org.assertj.core.version>3.9.0</org.assertj.core.version> | ||
<commons-codec.version>1.11</commons-codec.version> | ||
</properties> | ||
|
||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.baeldung</groupId> | ||
<artifactId>algorithms-genetic</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
|
||
<parent> | ||
<groupId>com.baeldung</groupId> | ||
<artifactId>parent-modules</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-math3</artifactId> | ||
<version>${commons-math3.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>commons-codec</groupId> | ||
<artifactId>commons-codec</artifactId> | ||
<version>${commons-codec.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
<version>${lombok.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.jenetics</groupId> | ||
<artifactId>jenetics</artifactId> | ||
<version>${io.jenetics.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jgrapht</groupId> | ||
<artifactId>jgrapht-core</artifactId> | ||
<version>${org.jgrapht.core.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>pl.allegro.finance</groupId> | ||
<artifactId>tradukisto</artifactId> | ||
<version>${tradukisto.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.assertj</groupId> | ||
<artifactId>assertj-core</artifactId> | ||
<version>${org.assertj.core.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<pluginManagement> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>exec-maven-plugin</artifactId> | ||
<version>${exec-maven-plugin.version}</version> | ||
</plugin> | ||
</plugins> | ||
</pluginManagement> | ||
</build> | ||
|
||
<reporting> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>cobertura-maven-plugin</artifactId> | ||
<version>2.7</version> | ||
<configuration> | ||
<instrumentation> | ||
<ignores> | ||
<ignore>com/baeldung/algorithms/dijkstra/*</ignore> | ||
</ignores> | ||
<excludes> | ||
<exclude>com/baeldung/algorithms/dijkstra/*</exclude> | ||
</excludes> | ||
</instrumentation> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</reporting> | ||
|
||
<properties> | ||
<lombok.version>1.16.12</lombok.version> | ||
<commons-math3.version>3.6.1</commons-math3.version> | ||
<tradukisto.version>1.0.1</tradukisto.version> | ||
<io.jenetics.version>3.7.0</io.jenetics.version> | ||
<org.jgrapht.core.version>1.0.1</org.jgrapht.core.version> | ||
<org.assertj.core.version>3.9.0</org.assertj.core.version> | ||
<commons-codec.version>1.11</commons-codec.version> | ||
</properties> | ||
|
||
</project> |
File renamed without changes.
40 changes: 20 additions & 20 deletions
40
...ed/src/com/java/src/RoundUpToHundred.java → ...ed/src/com/java/src/RoundUpToHundred.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
package com.java.src; | ||
|
||
import java.util.Scanner; | ||
|
||
public class RoundUpToHundred { | ||
|
||
public static void main(String[] args) { | ||
Scanner scanner = new Scanner(System.in); | ||
double input = scanner.nextDouble(); | ||
scanner.close(); | ||
|
||
RoundUpToHundred.round(input); | ||
} | ||
|
||
static long round(double input) { | ||
long i = (long) Math.ceil(input); | ||
return ((i + 99) / 100) * 100; | ||
}; | ||
|
||
} | ||
package com.java.src; | ||
|
||
import java.util.Scanner; | ||
|
||
public class RoundUpToHundred { | ||
|
||
public static void main(String[] args) { | ||
Scanner scanner = new Scanner(System.in); | ||
double input = scanner.nextDouble(); | ||
scanner.close(); | ||
|
||
RoundUpToHundred.round(input); | ||
} | ||
|
||
static long round(double input) { | ||
long i = (long) Math.ceil(input); | ||
return ((i + 99) / 100) * 100; | ||
}; | ||
|
||
} |
28 changes: 14 additions & 14 deletions
28
...rc/com/java/src/RoundUpToHundredTest.java → ...rc/com/java/src/RoundUpToHundredTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
package com.java.src; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
import org.junit.Test; | ||
|
||
public class RoundUpToHundredTest { | ||
@Test | ||
public void givenInput_whenRound_thenRoundUpToTheNearestHundred() { | ||
assertEquals("Rounded up to hundred", 100, RoundUpToHundred.round(99)); | ||
assertEquals("Rounded up to three hundred ", 300, RoundUpToHundred.round(200.2)); | ||
assertEquals("Returns same rounded value", 400, RoundUpToHundred.round(400)); | ||
} | ||
} | ||
package com.java.src; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
import org.junit.Test; | ||
|
||
public class RoundUpToHundredTest { | ||
@Test | ||
public void givenInput_whenRound_thenRoundUpToTheNearestHundred() { | ||
assertEquals("Rounded up to hundred", 100, RoundUpToHundred.round(99)); | ||
assertEquals("Rounded up to three hundred ", 300, RoundUpToHundred.round(200.2)); | ||
assertEquals("Returns same rounded value", 400, RoundUpToHundred.round(400)); | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/target/ | ||
.settings/ | ||
.classpath | ||
.project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
## Relevant articles: | ||
|
||
- [Validating Input With Finite Automata in Java](http://www.baeldung.com/java-finite-automata) | ||
- [Example of Hill Climbing Algorithm](http://www.baeldung.com/java-hill-climbing-algorithm) | ||
- [Monte Carlo Tree Search for Tic-Tac-Toe Game](http://www.baeldung.com/java-monte-carlo-tree-search) | ||
- [Binary Search Algorithm in Java](http://www.baeldung.com/java-binary-search) | ||
- [Introduction to Minimax Algorithm](http://www.baeldung.com/java-minimax-algorithm) | ||
- [How to Calculate Levenshtein Distance in Java?](http://www.baeldung.com/java-levenshtein-distance) | ||
- [How to Find the Kth Largest Element in Java](http://www.baeldung.com/java-kth-largest-element) | ||
- [Multi-Swarm Optimization Algorithm in Java](http://www.baeldung.com/java-multi-swarm-algorithm) | ||
- [String Search Algorithms for Large Texts](http://www.baeldung.com/java-full-text-search-algorithms) | ||
- [Check If a String Contains All The Letters of The Alphabet](https://www.baeldung.com/java-string-contains-all-letters) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.baeldung</groupId> | ||
<artifactId>algorithms-miscellaneous-1</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
|
||
<parent> | ||
<groupId>com.baeldung</groupId> | ||
<artifactId>parent-modules</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-math3</artifactId> | ||
<version>${commons-math3.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>commons-codec</groupId> | ||
<artifactId>commons-codec</artifactId> | ||
<version>${commons-codec.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
<version>${lombok.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.jenetics</groupId> | ||
<artifactId>jenetics</artifactId> | ||
<version>${io.jenetics.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jgrapht</groupId> | ||
<artifactId>jgrapht-core</artifactId> | ||
<version>${org.jgrapht.core.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>pl.allegro.finance</groupId> | ||
<artifactId>tradukisto</artifactId> | ||
<version>${tradukisto.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.assertj</groupId> | ||
<artifactId>assertj-core</artifactId> | ||
<version>${org.assertj.core.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<pluginManagement> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>exec-maven-plugin</artifactId> | ||
<version>${exec-maven-plugin.version}</version> | ||
</plugin> | ||
</plugins> | ||
</pluginManagement> | ||
</build> | ||
|
||
<reporting> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>cobertura-maven-plugin</artifactId> | ||
<version>2.7</version> | ||
<configuration> | ||
<instrumentation> | ||
<ignores> | ||
<ignore>com/baeldung/algorithms/dijkstra/*</ignore> | ||
</ignores> | ||
<excludes> | ||
<exclude>com/baeldung/algorithms/dijkstra/*</exclude> | ||
</excludes> | ||
</instrumentation> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</reporting> | ||
|
||
<properties> | ||
<lombok.version>1.16.12</lombok.version> | ||
<commons-math3.version>3.6.1</commons-math3.version> | ||
<tradukisto.version>1.0.1</tradukisto.version> | ||
<io.jenetics.version>3.7.0</io.jenetics.version> | ||
<org.jgrapht.core.version>1.0.1</org.jgrapht.core.version> | ||
<org.assertj.core.version>3.9.0</org.assertj.core.version> | ||
<commons-codec.version>1.11</commons-codec.version> | ||
</properties> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/bin/ |
Oops, something went wrong.