phishman3579/java-algorithms-implementation


Algorithms and Data Structures implemented in Java

Download


Step 1. Add the JitPack repository to your build file

Add it in your root build.gradle at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url 'https://jitpack.io' }
		}
	}
	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>

Add it in your build.sbt at the end of resolvers:

 
    resolvers += "jitpack" at "https://jitpack.io"
        
    

Add it in your project.clj at the end of repositories:

 
    :repositories [["jitpack" "https://jitpack.io"]]
        
    

Step 2. Add the dependency

	dependencies {
		implementation 'com.github.phishman3579:java-algorithms-implementation:'
	}
	<dependency>
	    <groupId>com.github.phishman3579</groupId>
	    <artifactId>java-algorithms-implementation</artifactId>
	    <version></version>
	</dependency>

                            
    libraryDependencies += "com.github.phishman3579" % "java-algorithms-implementation" % ""
        
        

                            
    :dependencies [[com.github.phishman3579/java-algorithms-implementation ""]]
        
        

Readme


Java : Algorithms and Data Structure alt tag

The algorithms and data structures are implemented in Java.

This is a collection of algorithms and data structures I've implemented in my academic and professional life. The code isn't optimized but is written to be correct and readable. The algorithms and data structures are tested and, unless noted, believed to be correct.

Created by Justin Wetherell

  • For questions use: http://groups.google.com/forum/#!forum/java-algorithms-implementation
  • Google: http://code.google.com/p/java-algorithms-implementation
  • Github: http://github.com/phishman3579/java-algorithms-implementation
  • LinkedIn: http://www.linkedin.com/in/phishman3579
  • E-mail: phishman3579@gmail.com
  • Twitter: http://twitter.com/phishman3579

Support me with a donation

<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=phishman3579%40gmail%2ecom&lc=US&item_name=Support%20open%20source&item_number=JavaAlgorithms&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_SM%2egif%3aNonHosted" target="_new"><img border="0" alt="Donate to this project" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif"></a>

What's been implemented:

Table of Contents

Data Structures

Mathematics

Numbers

  • Integers
    • to binary String
      • using divide and modulus
      • using right shift and modulus
      • using BigDecimal
      • using divide and double
    • is a power of 2
      • using a loop
      • using recursion
      • using logarithm
      • using bits
    • to English (e.g. 1 would return "one")
  • Longs
    • to binary String
      • using divide and modulus
      • using right shift and modulus
      • using BigDecimal
  • Complex
    • addition
    • subtraction
    • multiplication
    • absolute value
    • polar value

Graphs

Search

Sequences

Sorts

String Functions

String Functions

  • Reverse characters in a string
    • using additional storage (a String or StringBuilder)
    • using in-place swaps
    • using in-place XOR
  • Reverse words in a string
    • using char swaps and additional storage (a StringBuilder)
    • using StringTokenizer and additional (a String)
    • using split() method and additional storage (a StringBuilder and String[])
    • using in-place swaps
  • Is Palindrome
    • using additional storage (a StringBuilder)
    • using in-place symetric element compares
  • Subsets of characters in a String
  • Edit (Levenshtein) Distance of two Strings (Recursive, Iterative)

    Manacher's algorithm (Find the longest Palindrome)

    KMP (Knuth–Morris–Pratt) Algorithm - Length of maximal prefix-suffix for each prefix

    String rotations

    • Find in lexicographically minimal string rotation
    • Find in lexicographically maximal string rotation