[BAEL-9551] - Splitted algorithms into 4 modules
This commit is contained in:
		
							parent
							
								
									c10101a9ac
								
							
						
					
					
						commit
						539ce3e787
					
				
							
								
								
									
										4
									
								
								algorithms-genetic/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								algorithms-genetic/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,4 @@ | ||||
| /target/ | ||||
| .settings/ | ||||
| .classpath | ||||
| .project | ||||
							
								
								
									
										4
									
								
								algorithms-genetic/README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								algorithms-genetic/README.md
									
									
									
									
									
										Normal file
									
								
							| @ -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) | ||||
| @ -2,7 +2,7 @@ | ||||
|     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> | ||||
|     <artifactId>algorithms-genetic</artifactId> | ||||
|     <version>0.0.1-SNAPSHOT</version> | ||||
| 
 | ||||
|     <parent> | ||||
							
								
								
									
										4
									
								
								algorithms-miscellaneous-1/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								algorithms-miscellaneous-1/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,4 @@ | ||||
| /target/ | ||||
| .settings/ | ||||
| .classpath | ||||
| .project | ||||
							
								
								
									
										12
									
								
								algorithms-miscellaneous-1/README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								algorithms-miscellaneous-1/README.md
									
									
									
									
									
										Normal file
									
								
							| @ -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) | ||||
							
								
								
									
										96
									
								
								algorithms-miscellaneous-1/pom.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										96
									
								
								algorithms-miscellaneous-1/pom.xml
									
									
									
									
									
										Normal file
									
								
							| @ -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> | ||||
							
								
								
									
										1
									
								
								algorithms-miscellaneous-1/roundUpToHundred/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								algorithms-miscellaneous-1/roundUpToHundred/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1 @@ | ||||
| /bin/ | ||||
| @ -0,0 +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; | ||||
|     }; | ||||
| 
 | ||||
| } | ||||
| @ -0,0 +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)); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										13
									
								
								algorithms-miscellaneous-1/src/main/resources/logback.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								algorithms-miscellaneous-1/src/main/resources/logback.xml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,13 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <configuration> | ||||
|     <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | ||||
|         <encoder> | ||||
|             <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n | ||||
|             </pattern> | ||||
|         </encoder> | ||||
|     </appender> | ||||
| 
 | ||||
|     <root level="INFO"> | ||||
|         <appender-ref ref="STDOUT" /> | ||||
|     </root> | ||||
| </configuration> | ||||
							
								
								
									
										4
									
								
								algorithms-miscellaneous-2/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								algorithms-miscellaneous-2/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,4 @@ | ||||
| /target/ | ||||
| .settings/ | ||||
| .classpath | ||||
| .project | ||||
| @ -2,20 +2,8 @@ | ||||
| 
 | ||||
| - [Dijkstra Algorithm in Java](http://www.baeldung.com/java-dijkstra) | ||||
| - [Introduction to Cobertura](http://www.baeldung.com/cobertura) | ||||
| - [Ant Colony Optimization](http://www.baeldung.com/java-ant-colony-optimization) | ||||
| - [Validating Input With Finite Automata in Java](http://www.baeldung.com/java-finite-automata) | ||||
| - [Introduction to Jenetics Library](http://www.baeldung.com/jenetics) | ||||
| - [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) | ||||
| - [String Search Algorithms for Large Texts](http://www.baeldung.com/java-full-text-search-algorithms) | ||||
| - [Test a Linked List for Cyclicity](http://www.baeldung.com/java-linked-list-cyclicity) | ||||
| - [Binary Search Algorithm in Java](http://www.baeldung.com/java-binary-search) | ||||
| - [Bubble Sort in Java](http://www.baeldung.com/java-bubble-sort) | ||||
| - [Introduction to JGraphT](http://www.baeldung.com/jgrapht) | ||||
| - [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) | ||||
| - [A Maze Solver in Java](http://www.baeldung.com/java-solve-maze) | ||||
| - [Create a Sudoku Solver in Java](http://www.baeldung.com/java-sudoku) | ||||
| - [Displaying Money Amounts in Words](http://www.baeldung.com/java-money-into-words) | ||||
| @ -27,10 +15,6 @@ | ||||
| - [Check If Two Rectangles Overlap In Java](https://www.baeldung.com/java-check-if-two-rectangles-overlap) | ||||
| - [Calculate the Distance Between Two Points in Java](https://www.baeldung.com/java-distance-between-two-points) | ||||
| - [Find the Intersection of Two Lines in Java](https://www.baeldung.com/java-intersection-of-two-lines) | ||||
| - [Check If a String Contains All The Letters of The Alphabet](https://www.baeldung.com/java-string-contains-all-letters) | ||||
| - [Round Up to the Nearest Hundred](https://www.baeldung.com/java-round-up-nearest-hundred) | ||||
| - [Merge Sort in Java](https://www.baeldung.com/java-merge-sort) | ||||
| - [Calculate Percentage in Java](https://www.baeldung.com/java-calculate-percentage) | ||||
| - [Quicksort Algorithm Implementation in Java](https://www.baeldung.com/java-quicksort) | ||||
| - [Insertion Sort in Java](https://www.baeldung.com/java-insertion-sort) | ||||
| - [Converting Between Byte Arrays and Hexadecimal Strings in Java](https://www.baeldung.com/java-byte-arrays-hex-strings) | ||||
							
								
								
									
										96
									
								
								algorithms-miscellaneous-2/pom.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										96
									
								
								algorithms-miscellaneous-2/pom.xml
									
									
									
									
									
										Normal file
									
								
							| @ -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-2</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> | ||||
							
								
								
									
										1
									
								
								algorithms-miscellaneous-2/roundUpToHundred/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								algorithms-miscellaneous-2/roundUpToHundred/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1 @@ | ||||
| /bin/ | ||||
| @ -0,0 +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; | ||||
|     }; | ||||
| 
 | ||||
| } | ||||
| @ -0,0 +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)); | ||||
|     } | ||||
| } | ||||
Some files were not shown because too many files have changed in this diff Show More
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user