diff --git a/.classpath b/.classpath new file mode 100644 index 00000000..84ed1b40 --- /dev/null +++ b/.classpath @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 00000000..68ff5263 --- /dev/null +++ b/.project @@ -0,0 +1,29 @@ + + + Algorithms-and-Data-Structures-in-Java + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.jdt.core.javanature + + diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 00000000..99f26c02 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..01b22191 --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,10 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 00000000..f4ef8aa0 --- /dev/null +++ b/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,4 @@ + + + + diff --git a/bin/com/rampatra/bits/README.md b/bin/com/rampatra/bits/README.md new file mode 100644 index 00000000..30119f20 --- /dev/null +++ b/bin/com/rampatra/bits/README.md @@ -0,0 +1,122 @@ +# Bits + +## Basic Operators + +#### AND: + +| x | y | x `&` y | +----|---|:-------:| +| 0 | 0 | 0 | +| 0 | 1 | 0 | +| 1 | 0 | 0 | +| 1 | 1 | 1 | + +#### OR: + +| x | y | x `\|` y | +|---|---|:--------:| +| 0 | 0 | 0 | +| 0 | 1 | 1 | +| 1 | 0 | 1 | +| 1 | 1 | 1 | + +#### XOR: + +| x | y | x `^` y | +|---|---|:-------:| +| 0 | 0 | 0 | +| 0 | 1 | 1 | +| 1 | 0 | 1 | +| 1 | 1 | 0 | + + +## Shifts + +_Disclaimer: We are taking `byte` (8 bits) as our datatype to explain the + concepts instead of the usual integer._ + +#### 1. Left Shift (<<): + +1 << 3 = 8 + +> 00000001 << 3 = 00001000 + +#### 2. Right Shift: + +**Two types:** + +**a. Signed Right Shift (>>):** + +64 >> 2 = 16 + +> 001000000 >> 2 = 00010000 + +-64 >> 2 = -16 + +> 111000000 >> 2 = 11110000 + +**b. Unsigned Right Shift (>>>):** + +64 >>> 2 = 16 + +> 001000000 >>> 2 = 00010000 + +-64 >>> 2 = 56 + +> 111000000 >>> 2 = 00111000 + +## Helpful Masks + +#### 1. Set the 4th bit from right: + +```java +byte mask = 1 << 3; +``` + +Explanation, + +``` +00000001 << 3 = 00001000 +``` + +#### 2. Set the first 3 bits from right: + +```java +byte mask = (1 << 3) - 1; +``` + +Explanation, + +``` +00000001 << 3 = 00001000 + +00001000 - 00000001 = 00000111 +``` + +#### 3. Mask with alternating 1010...10 + +```java +byte mask = 0x55; +``` + +#### 4. Mask with alternating 0101...01 + +```java +byte mask = 0xaa; +``` + +#### 5. Unset the 4th bit + +```java +byte mask = 1 << 3; + +byte num = num & ~mask; +``` + +Explanation, + +``` +00000001 << 3 = 00001000 + +~(00001000) = 11110111 +``` \ No newline at end of file diff --git a/bin/com/rampatra/database/README.md b/bin/com/rampatra/database/README.md new file mode 100644 index 00000000..0ea2737c --- /dev/null +++ b/bin/com/rampatra/database/README.md @@ -0,0 +1,76 @@ +# Relational Database (WIP) + +A __relational database__ is a digital database based on +the [relational model](https://en.wikipedia.org/wiki/Relational_model) of +data. In simple words, it is a collection of data items with pre-defined +relationships between them. These items are organized as a set of tables, +with columns and rows. Each column stores some specific attribute of an object/entity and the +row represents a specific object/entity. + +A software system used to maintain relational databases is a __relational +database management system (RDBMS)__, for e.g., MySQL, Oracle DB, PostgreSQL, etc. +Virtually all relational database systems use __SQL (Structured Query Language)__ +for querying and maintaining the database. + +## Basic Definitions + +1. Primary Key + +2. Candidate Key + +3. Composite Key + +4. Prime/Non-prime attribute + +## Types of SQL commands + +1. DDL +2. DML +3. DCL +4. TCL + +| Type | Command List | +|-------|-------------------| +| DDL | CREATE | +| | DROP | +| | ALTER | +| | RENAME | +| | TRUNCATE | +| | | +| DML | SELECT | +| | INSERT | +| | UPDATE | +| | DELETE | +| | | +| DCL | GRANT | +| | REVOKE | +| | | +| TCL | START TRANSACTION | +| | COMMIT | +| | ROLLBACK | + +## Types of Joins + +1. Inner Join +2. Left Outer Join +3. Right Outer Join +4. Full Join +5. Self Join + +## Normalization Forms + +1. 1NF +2. 2NF +3. 3NF +4. BCNF +5. 4NF +6. 5NF + +#### 1NF + +Required conditions: + +a. All values should be atomic (non-breakable). +b. There should be a candidate key or a composite key (basically you should be able to uniquely identify all records in the table). + + \ No newline at end of file diff --git a/bin/com/rampatra/misc/parenthesis.txt b/bin/com/rampatra/misc/parenthesis.txt new file mode 100644 index 00000000..077f4ab6 --- /dev/null +++ b/bin/com/rampatra/misc/parenthesis.txt @@ -0,0 +1,1587 @@ +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{{{{}}}} +{[]}{[]} +{[()]} +{[] +{{]][[}} +{[]}{[]}{[]}{[]}{[]}{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}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} \ No newline at end of file diff --git a/bin/com/rampatra/misc/reverseandadd.txt b/bin/com/rampatra/misc/reverseandadd.txt new file mode 100644 index 00000000..9e1727db --- /dev/null +++ b/bin/com/rampatra/misc/reverseandadd.txt @@ -0,0 +1,225 @@ +1 +5 +59 +69 +79 +89 +166 +188 +193 +829 +167 +849 +177 +999 +739 +989 +869 +187 +1397 +2069 +1797 +1798 +6999 +1297 +10797 +10853 +10921 +10971 +13297 +10548 +13293 +17793 +20889 +80359 +13697 +10794 +15891 +70759 +70269 +10677 +10833 +10911 +700269 +106977 +108933 +600259 +131996 +600279 +141996 +600579 +147996 +178992 +190890 +600589 +150296 +1009227 +1007619 +1009246 +1008628 +1007377 +1001699 +1009150 +1058921 +1050995 +1003569 +1036974 +1490991 +3009179 +1008595 +1064912 +1998999 +7008429 +1000689 +1005744 +1007601 +7008899 +9008299 +10905963 +10069785 +10089342 +11979990 +10029372 +10029826 +16207990 +90000589 +10309988 +100389898 +100055896 +110909992 +160009490 +800067199 +151033997 +100093573 +103249931 +107025910 +180005498 +100239862 +140669390 +1090001921 +7007009909 +1009049407 +9000046899 +1050027948 +1304199693 +5020089949 +1005499526 +10000505448 +10000922347 +10000696511 +10701592943 +10018999583 +10000442119 +10000761554 +10084899970 +10006198250 +18060009890 +11400245996 +16002897892 +18317699990 +37000488999 +10050289485 +90000626389 +10000853648 +13003696093 +10050859271 +10287799930 +10000973037 +10600713933 +10942399911 +60000180709 +11009599796 +16000097392 +10031199494 +10306095991 +10087799570 +100900509906 +100000055859 +104000146950 +180005998298 +300000185539 +100001987765 +1000007614641 +1000043902320 +1000006653746 +1000005469548 +4000096953659 +1332003929995 +1000201995662 +6000008476379 +1200004031698 +1631002019993 +1000006412206 +1090604591930 +1600005969190 +10090899969901 +40000004480279 +14104229999995 +100000109584608 +100000098743648 +100004789906151 +100079239995161 +100389619999030 +200000729975309 +107045067996994 +105420999199982 +101000269830970 +104000047066970 +700000001839569 +100000050469737 +101000789812993 +100907098999571 +100017449991820 +890000023937399 +100009989989199 +101507024989944 +107405139999943 +100057569996821 +103500369729970 +900000076152049 +100000439071028 +120000046510993 +103000015331997 +100617081999573 +100009029910821 +107000020928910 +100000090745299 +102000149322944 +130000074931591 +100120849299260 +-1 +-5 +-59 +-69 +-79 +-89 +-166 +-188 +-193 +-829 +-167 +-849 +-177 +-999 +-739 +-989 +-869 +-187 +-1397 +-2069 +-1797 +-1798 +-6999 +-1297 +-103500369729970 +-900000076152049 +-100000439071028 +-120000046510993 +-103000015331997 +-100617081999573 +-100009029910821 +-107000020928910 +-100000090745299 +-102000149322944 +-130000074931591 +-100120849299260 \ No newline at end of file diff --git a/main b/main new file mode 160000 index 00000000..db15c1e0 --- /dev/null +++ b/main @@ -0,0 +1 @@ +Subproject commit db15c1e0450c801aa3ee56e0d930fa3e33e3fb62 diff --git a/pom.xml b/pom.xml index 4db680c0..8b3cec1e 100644 --- a/pom.xml +++ b/pom.xml @@ -1,132 +1,134 @@ - - 4.0.0 + + 4.0.0 - com.rampatra.adsj - adsj - 1.0.1-SNAPSHOT - pom + com.rampatra.adsj + adsj + 1.0.1-SNAPSHOT + pom - Algorithms and Data Structures in Java - My solutions to some of the algorithm and data structure questions in Java - https://github.com/rampatra/Algorithms-and-Data-Structures-in-Java + Algorithms and Data Structures in Java + My solutions to some of the algorithm and data structure questions in Java + https://github.com/rampatra/Algorithms-and-Data-Structures-in-Java - - - ram - Ram Patra - hi at rampatra.com - RamPatra.com - http://www.rampatra.com - - + + + ram + Ram Patra + hi at rampatra.com + RamPatra.com + http://www.rampatra.com + + - - - GPL-3.0 - https://opensource.org/licenses/GPL-3.0 - - + + + GPL-3.0 + https://opensource.org/licenses/GPL-3.0 + + - - https://github.com/rampatra/Algorithms-and-Data-Structures-in-Java - scm:git:git://github.com/rampatra/Algorithms-and-Data-Structures-in-Java.git - scm:git:ssh://git@github.com/rampatra/Algorithms-and-Data-Structures-in-Java.git - HEAD - + + https://github.com/rampatra/Algorithms-and-Data-Structures-in-Java + scm:git:git://github.com/rampatra/Algorithms-and-Data-Structures-in-Java.git + scm:git:ssh://git@github.com/rampatra/Algorithms-and-Data-Structures-in-Java.git + HEAD + - - - ossrh - https://oss.sonatype.org/content/repositories/snapshots - - - ossrh - https://oss.sonatype.org/service/local/staging/deploy/maven2 - - + + + ossrh + https://oss.sonatype.org/content/repositories/snapshots + + + ossrh + https://oss.sonatype.org/service/local/staging/deploy/maven2 + + - - UTF-8 - 1.8 - ${java.version} - ${java.version} - + + UTF-8 + 1.8 + ${java.version} + ${java.version} + - - - - org.junit.jupiter - junit-jupiter-api - 5.5.1 - - + + + + org.junit.jupiter + junit-jupiter-api + 5.5.1 + + - - - release - - - - org.apache.maven.plugins - maven-source-plugin - 2.2.1 - - - attach-sources - - jar-no-fork - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.9.1 - - - attach-javadocs - - jar - - - - - - org.apache.maven.plugins - maven-gpg-plugin - 1.5 - - - sign-artifacts - verify - - sign - - - - - - - - + + + release + + + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + attach-sources + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.9.1 + + + attach-javadocs + + jar + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + + + + + - - - - org.apache.maven.plugins - maven-release-plugin - 2.5 - - true - false - release - deploy - - - - + + + + org.apache.maven.plugins + maven-release-plugin + 2.5 + + true + false + release + deploy + + + + \ No newline at end of file diff --git a/src/main/java/com/ctci/stacksandqueues/SortStack.java b/src/main/java/com/ctci/stacksandqueues/SortStack.java index b94c68fb..1a459bdc 100644 --- a/src/main/java/com/ctci/stacksandqueues/SortStack.java +++ b/src/main/java/com/ctci/stacksandqueues/SortStack.java @@ -13,7 +13,7 @@ */ public class SortStack { - private static void sortStack(Stack stack) { + public static void sortStack(Stack stack) { Stack tempStack = new Stack<>(); while (!stack.empty()) { tempStack.push(stack.pop()); @@ -31,16 +31,16 @@ private static void sortStack(Stack stack) { } } - private static void printStack(Stack stack) { + public static void printStack(Stack stack) { System.out.println(Arrays.toString(stack.toArray())); } public static void main(String[] args) { Stack unsortedStack = new Stack<>(); - unsortedStack.push(2); - unsortedStack.push(5); - unsortedStack.push(1); - unsortedStack.push(3); +// unsortedStack.push(2); +// unsortedStack.push(5); +// unsortedStack.push(1); +// unsortedStack.push(3); printStack(unsortedStack); sortStack(unsortedStack); printStack(unsortedStack); diff --git a/src/main/java/com/ctci/stacksandqueues/StackMin.java b/src/main/java/com/ctci/stacksandqueues/StackMin.java deleted file mode 100644 index 0a5d2d59..00000000 --- a/src/main/java/com/ctci/stacksandqueues/StackMin.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.ctci.stacksandqueues; - -import com.sun.tools.javac.util.Assert; - -import java.util.Stack; - -/** - * How would you design a stack which, in addition to push and pop, has a function min - * which returns the minimum element? Push, pop and min should all operate in 0(1) time. - * - * @author rampatra - * @since 2019-02-04 - */ -public class StackMin { - - // the main stack to do push, pop, and min operations - private static Stack stack = new Stack<>(); - // another stack to store the mins (needed to make min() call O(1)) - private static Stack minStack = new Stack<>(); - - private static int push(int item) { - minPush(item); - return stack.push(item); - } - - private static int pop() { - minPop(stack.peek()); - return stack.pop(); - } - - private static int min() { - return minStack.peek(); - } - - private static void minPush(int item) { - if (minStack.empty() || item <= minStack.peek()) { - minStack.push(item); - } - } - - private static void minPop(int item) { - if (item == minStack.peek()) { - minStack.pop(); - } - } - - public static void main(String[] args) { - push(2); - push(5); - push(1); - push(1); - push(6); - push(8); - Assert.check(min() == 1); - pop(); - pop(); - pop(); - Assert.check(min() == 1); - pop(); - Assert.check(min() == 2); - } -} \ No newline at end of file diff --git a/src/main/java/com/leetcode/graphs/WordLadder.java b/src/main/java/com/leetcode/graphs/WordLadder.java deleted file mode 100644 index 61e706ce..00000000 --- a/src/main/java/com/leetcode/graphs/WordLadder.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.leetcode.graphs; - - -import javafx.util.Pair; - -import java.util.*; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Level: Medium - * Link: https://leetcode.com/problems/word-ladder/ - * Description: - * Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation - * sequence from beginWord to endWord, such that: - *

- * Only one letter can be changed at a time. Each transformed word must exist in the word list. Note that beginWord - * is not a transformed word. - *

- * Note: - * - Return 0 if there is no such transformation sequence. - * - All words have the same length. - * - All words contain only lowercase alphabetic characters. - * - You may assume no duplicates in the word list. - * - You may assume beginWord and endWord are non-empty and are not the same. - *

- * Example 1: - * Input: - * beginWord = "hit", - * endWord = "cog", - * wordList = ["hot","dot","dog","lot","log","cog"] - *

- * Output: 5 - *

- * Explanation: As one shortest transformation is "hit" -> "hot" -> "dot" -> "dog" -> "cog", - * return its length 5. - *

- * Example 2: - * Input: - * beginWord = "hit" - * endWord = "cog" - * wordList = ["hot","dot","dog","lot","log"] - *

- * Output: 0 - *

- * Explanation: The endWord "cog" is not in wordList, therefore no possible transformation. - * - * @author rampatra - * @since 2019-08-15 - */ -public class WordLadder { - - /** - * Runtime: 79 ms. - * - * @param beginWord - * @param endWord - * @param wordList - * @return - */ - public static int ladderLength(String beginWord, String endWord, List wordList) { - int L = beginWord.length(); - Map> transformedToOriginalWordMap = new HashMap<>(); - Queue> queue = new LinkedList<>(); - - wordList.forEach(word -> { - String transformedWord; - for (int i = 0; i < L; i++) { - transformedWord = word.substring(0, i) + "*" + word.substring(i + 1, L); - transformedToOriginalWordMap.putIfAbsent(transformedWord, new HashSet<>()); - transformedToOriginalWordMap.get(transformedWord).add(word); - } - } - ); - - Set visited = new HashSet<>(); - queue.add(new Pair<>(beginWord, 1)); - visited.add(beginWord); - - while (!queue.isEmpty()) { - Pair currPair = queue.poll(); - String word = currPair.getKey(); - Integer level = currPair.getValue(); - - if (word.equals(endWord)) { - return level; - } - - String transformedWord; - for (int i = 0; i < L; i++) { - transformedWord = word.substring(0, i) + "*" + word.substring(i + 1, L); - - for (String originalWord : transformedToOriginalWordMap.getOrDefault(transformedWord, Collections.emptySet())) { - if (!visited.contains(originalWord)) { - queue.add(new Pair<>(originalWord, level + 1)); - visited.add(originalWord); - } - } - } - } - - return 0; - } - - /** - * TODO: Optimized both end BFS solution - * - * @param beginWord - * @param endWord - * @param wordList - * @return - */ - public static int ladderLengthOptimized(String beginWord, String endWord, List wordList) { - return -1; - } - - public static void main(String[] args) { - assertEquals(5, ladderLength("hit", "cog", Arrays.asList("hot", "dot", "dog", "lot", "log", "cog"))); - assertEquals(0, ladderLength("hit", "cog", Arrays.asList("hot", "dot", "dog", "lot", "log"))); - } -} \ No newline at end of file diff --git a/src/main/java/com/leetcode/graphs/WordLadderII.java b/src/main/java/com/leetcode/graphs/WordLadderII.java deleted file mode 100644 index 8265c259..00000000 --- a/src/main/java/com/leetcode/graphs/WordLadderII.java +++ /dev/null @@ -1,152 +0,0 @@ -package com.leetcode.graphs; - -import javafx.util.Pair; - -import java.util.*; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Level: Hard - * Link: https://leetcode.com/problems/word-ladder-ii/ - * Description: - * Given two words (beginWord and endWord), and a dictionary's word list, find all shortest transformation sequence(s) - * from beginWord to endWord, such that: - *

- * Only one letter can be changed at a time - * Each transformed word must exist in the word list. Note that beginWord is not a transformed word. - *

- * Note: - * - Return an empty list if there is no such transformation sequence. - * - All words have the same length. - * - All words contain only lowercase alphabetic characters. - * - You may assume no duplicates in the word list. - * - You may assume beginWord and endWord are non-empty and are not the same. - *

- * Example 1: - * Input: - * beginWord = "hit", - * endWord = "cog", - * wordList = ["hot","dot","dog","lot","log","cog"] - *

- * Output: - * [ - * ["hit","hot","dot","dog","cog"], - * ["hit","hot","lot","log","cog"] - * ] - *

- *

- * Example 2: - * Input: - * beginWord = "hit" - * endWord = "cog" - * wordList = ["hot","dot","dog","lot","log"] - *

- * Output: [] - * Explanation: The endWord "cog" is not in wordList, therefore no possible transformation. - * - * @author rampatra - * @since 2019-08-15 - */ -public class WordLadderII { - - /** - * The approach is same as {@link WordLadder}. We calculate the {@code minDistance} from start to end word and also - * keep a map of words and its adjacent words (i.e, with only character difference). After we are done calculating - * the {@code mindistance}, we perform a dfs on the map upto depth {@code minDistance} and if the last word at this - * depth is equal to the end word then we add all words to the result. - * - * @param beginWord - * @param endWord - * @param wordList - * @return - */ - public static List> findLadders(String beginWord, String endWord, List wordList) { - int L = beginWord.length(); - List> ladders = new LinkedList<>(); - Map> transformedToOriginalWordMap = new HashMap<>(); - Queue> queue = new LinkedList<>(); - - wordList.forEach(word -> { - String transformedWord; - for (int i = 0; i < L; i++) { - transformedWord = word.substring(0, i) + "*" + word.substring(i + 1, L); - transformedToOriginalWordMap.putIfAbsent(transformedWord, new HashSet<>()); - transformedToOriginalWordMap.get(transformedWord).add(word); - } - } - ); - - int minDistance = -1; - Set visited = new HashSet<>(); - queue.add(new Pair<>(beginWord, 1)); - visited.add(beginWord); - - HashMap> connectedNodes = new HashMap<>(); - - while (!queue.isEmpty()) { - Pair currPair = queue.poll(); - String word = currPair.getKey(); - Integer level = currPair.getValue(); - - if (word.equals(endWord) && minDistance == -1) { - minDistance = level - 1; - } - - String transformedWord; - for (int i = 0; i < L; i++) { - transformedWord = word.substring(0, i) + "*" + word.substring(i + 1, L); - - for (String originalWord : transformedToOriginalWordMap.getOrDefault(transformedWord, Collections.emptySet())) { - if (!visited.contains(originalWord)) { - queue.add(new Pair<>(originalWord, level + 1)); - visited.add(originalWord); - } - - if (!word.equals(originalWord)) { - connectedNodes.putIfAbsent(word, new HashSet<>()); - connectedNodes.get(word).add(originalWord); - } - } - } - } - - dfs(ladders, new LinkedHashSet<>(), connectedNodes, beginWord, endWord, 0, minDistance); - - return ladders; - } - - /** - * Perform dfs on the map which contains words and its adjacent words. - * - * @param ladders - * @param ladder - * @param connectedNodes - * @param startNode - * @param endNode - * @param distance - * @param minDistance - */ - private static void dfs(List> ladders, Set ladder, Map> connectedNodes, - String startNode, String endNode, int distance, int minDistance) { - if (distance == minDistance && startNode.equals(endNode)) { - ladder.add(endNode); - ladders.add(new ArrayList<>(ladder)); - return; - } else if (distance > minDistance) { - return; - } - - ladder.add(startNode); - for (String nextNode : connectedNodes.getOrDefault(startNode, new HashSet<>())) { - if (!ladder.contains(nextNode)) { - dfs(ladders, new LinkedHashSet<>(ladder), connectedNodes, nextNode, endNode, distance + 1, minDistance); - } - } - } - - public static void main(String[] args) { - assertEquals("[[hit, hot, lot, log, cog], [hit, hot, dot, dog, cog]]", findLadders("hit", "cog", Arrays.asList("hot", "dot", "dog", "lot", "log", "cog")).toString()); - // TODO Fix this test case System.out.println(findLadders("cet", "ism", Arrays.asList("kid", "tag", "pup", "ail", "tun", "woo", "erg", "luz", "brr", "gay", "sip", "kay", "per", "val", "mes", "ohs", "now", "boa", "cet", "pal", "bar", "die", "war", "hay", "eco", "pub", "lob", "rue", "fry", "lit", "rex", "jan", "cot", "bid", "ali", "pay", "col", "gum", "ger", "row", "won", "dan", "rum", "fad", "tut", "sag", "yip", "sui", "ark", "has", "zip", "fez", "own", "ump", "dis", "ads", "max", "jaw", "out", "btu", "ana", "gap", "cry", "led", "abe", "box", "ore", "pig", "fie", "toy", "fat", "cal", "lie", "noh", "sew", "ono", "tam", "flu", "mgm", "ply", "awe", "pry", "tit", "tie", "yet", "too", "tax", "jim", "san", "pan", "map", "ski", "ova", "wed", "non", "wac", "nut", "why", "bye", "lye", "oct", "old", "fin", "feb", "chi", "sap", "owl", "log", "tod", "dot", "bow", "fob", "for", "joe", "ivy", "fan", "age", "fax", "hip", "jib", "mel", "hus", "sob", "ifs", "tab", "ara", "dab", "jag", "jar", "arm", "lot", "tom", "sax", "tex", "yum", "pei", "wen", "wry", "ire", "irk", "far", "mew", "wit", "doe", "gas", "rte", "ian", "pot", "ask", "wag", "hag", "amy", "nag", "ron", "soy", "gin", "don", "tug", "fay", "vic", "boo", "nam", "ave", "buy", "sop", "but", "orb", "fen", "paw", "his", "sub", "bob", "yea", "oft", "inn", "rod", "yam", "pew", "web", "hod", "hun", "gyp", "wei", "wis", "rob", "gad", "pie", "mon", "dog", "bib", "rub", "ere", "dig", "era", "cat", "fox", "bee", "mod", "day", "apr", "vie", "nev", "jam", "pam", "new", "aye", "ani", "and", "ibm", "yap", "can", "pyx", "tar", "kin", "fog", "hum", "pip", "cup", "dye", "lyx", "jog", "nun", "par", "wan", "fey", "bus", "oak", "bad", "ats", "set", "qom", "vat", "eat", "pus", "rev", "axe", "ion", "six", "ila", "lao", "mom", "mas", "pro", "few", "opt", "poe", "art", "ash", "oar", "cap", "lop", "may", "shy", "rid", "bat", "sum", "rim", "fee", "bmw", "sky", "maj", "hue", "thy", "ava", "rap", "den", "fla", "auk", "cox", "ibo", "hey", "saw", "vim", "sec", "ltd", "you", "its", "tat", "dew", "eva", "tog", "ram", "let", "see", "zit", "maw", "nix", "ate", "gig", "rep", "owe", "ind", "hog", "eve", "sam", "zoo", "any", "dow", "cod", "bed", "vet", "ham", "sis", "hex", "via", "fir", "nod", "mao", "aug", "mum", "hoe", "bah", "hal", "keg", "hew", "zed", "tow", "gog", "ass", "dem", "who", "bet", "gos", "son", "ear", "spy", "kit", "boy", "due", "sen", "oaf", "mix", "hep", "fur", "ada", "bin", "nil", "mia", "ewe", "hit", "fix", "sad", "rib", "eye", "hop", "haw", "wax", "mid", "tad", "ken", "wad", "rye", "pap", "bog", "gut", "ito", "woe", "our", "ado", "sin", "mad", "ray", "hon", "roy", "dip", "hen", "iva", "lug", "asp", "hui", "yak", "bay", "poi", "yep", "bun", "try", "lad", "elm", "nat", "wyo", "gym", "dug", "toe", "dee", "wig", "sly", "rip", "geo", "cog", "pas", "zen", "odd", "nan", "lay", "pod", "fit", "hem", "joy", "bum", "rio", "yon", "dec", "leg", "put", "sue", "dim", "pet", "yaw", "nub", "bit", "bur", "sid", "sun", "oil", "red", "doc", "moe", "caw", "eel", "dix", "cub", "end", "gem", "off", "yew", "hug", "pop", "tub", "sgt", "lid", "pun", "ton", "sol", "din", "yup", "jab", "pea", "bug", "gag", "mil", "jig", "hub", "low", "did", "tin", "get", "gte", "sox", "lei", "mig", "fig", "lon", "use", "ban", "flo", "nov", "jut", "bag", "mir", "sty", "lap", "two", "ins", "con", "ant", "net", "tux", "ode", "stu", "mug", "cad", "nap", "gun", "fop", "tot", "sow", "sal", "sic", "ted", "wot", "del", "imp", "cob", "way", "ann", "tan", "mci", "job", "wet", "ism", "err", "him", "all", "pad", "hah", "hie", "aim", "ike", "jed", "ego", "mac", "baa", "min", "com", "ill", "was", "cab", "ago", "ina", "big", "ilk", "gal", "tap", "duh", "ola", "ran", "lab", "top", "gob", "hot", "ora", "tia", "kip", "han", "met", "hut", "she", "sac", "fed", "goo", "tee", "ell", "not", "act", "gil", "rut", "ala", "ape", "rig", "cid", "god", "duo", "lin", "aid", "gel", "awl", "lag", "elf", "liz", "ref", "aha", "fib", "oho", "tho", "her", "nor", "ace", "adz", "fun", "ned", "coo", "win", "tao", "coy", "van", "man", "pit", "guy", "foe", "hid", "mai", "sup", "jay", "hob", "mow", "jot", "are", "pol", "arc", "lax", "aft", "alb", "len", "air", "pug", "pox", "vow", "got", "meg", "zoe", "amp", "ale", "bud", "gee", "pin", "dun", "pat", "ten", "mob"))); - } -} diff --git a/src/main/java/com/leetcode/heaps/TopKFrequentElements.java b/src/main/java/com/leetcode/heaps/TopKFrequentElements.java deleted file mode 100644 index 5a684325..00000000 --- a/src/main/java/com/leetcode/heaps/TopKFrequentElements.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.leetcode.heaps; - -import javafx.util.Pair; - -import java.util.*; -import java.util.stream.Collectors; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Level: Medium - * Link: https://leetcode.com/problems/top-k-frequent-elements/ - * Description: - * Given a non-empty array of integers, return the k most frequent elements. - *

- * Example 1: - * Input: nums = [1,1,1,2,2,3], k = 2 - * Output: [1,2] - *

- * Example 2: - * Input: nums = [1], k = 1 - * Output: [1] - *

- * Note: - * - You may assume k is always valid, 1 ≤ k ≤ number of unique elements. - * - Your algorithm's time complexity must be better than O(n log n), where n is the array's size. - * - * @author rampatra - * @since 2019-08-19 - */ -public class TopKFrequentElements { - - /** - * TODO: A faster approach without using Pair. - *

- * Runtime: 51 ms. - * - * @param nums - * @param k - * @return - */ - public static List topKFrequent(int[] nums, int k) { - Map numCount = new HashMap<>(); - PriorityQueue> pq = new PriorityQueue<>(Comparator.comparing(Pair::getValue)); - - for (int num : nums) { - numCount.put(num, numCount.getOrDefault(num, 0) + 1); - } - - for (Map.Entry entry : numCount.entrySet()) { - pq.add(new Pair<>(entry.getKey(), entry.getValue())); - - if (pq.size() > k) { - pq.poll(); - } - } - - return pq.stream().map(Pair::getKey).collect(Collectors.toList()); - } - - public static void main(String[] args) { - assertEquals("[2, 1]", topKFrequent(new int[]{1, 1, 1, 2, 2, 3}, 2).toString()); - assertEquals("[0]", topKFrequent(new int[]{3, 0, 1, 0}, 1).toString()); - assertEquals("[1]", topKFrequent(new int[]{1}, 1).toString()); - assertEquals("[1, 2]", topKFrequent(new int[]{1, 2}, 2).toString()); - assertEquals("[2, -1]", topKFrequent(new int[]{4, 1, -1, 2, -1, 2, 3}, 2).toString()); - } -} diff --git a/src/main/java/com/leetcode/stacks/ExclusiveTimeOfFunctions.java b/src/main/java/com/leetcode/stacks/ExclusiveTimeOfFunctions.java deleted file mode 100644 index 63c61dc2..00000000 --- a/src/main/java/com/leetcode/stacks/ExclusiveTimeOfFunctions.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.leetcode.stacks; - -import javafx.util.Pair; - -import java.util.Arrays; -import java.util.List; -import java.util.Stack; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Level: Medium - * Link: https://leetcode.com/problems/exclusive-time-of-functions/ - * Description: - * On a single threaded CPU, we execute some functions. Each function has a unique id between 0 and N-1. - * - * We store logs in timestamp order that describe when a function is entered or exited. - * - * Each log is a string with this format: "{function_id}:{"start" | "end"}:{timestamp}". For example, "0:start:3" - * means the function with id 0 started at the beginning of timestamp 3. "1:end:2" means the function with id 1 ended - * at the end of timestamp 2. - * - * A function's exclusive time is the number of units of time spent in this function. Note that this does not include - * any recursive calls to child functions. - * - * The CPU is single threaded which means that only one function is being executed at a given time unit. - * - * Return the exclusive time of each function, sorted by their function id. - * - * Input: - * n = 2 - * logs = ["0:start:0","1:start:2","1:end:5","0:end:6"] - * Output: [3, 4] - * Explanation: - * Function 0 starts at the beginning of time 0, then it executes 2 units of time and reaches the end of time 1. - * Now function 1 starts at the beginning of time 2, executes 4 units of time and ends at time 5. - * Function 0 is running again at the beginning of time 6, and also ends at the end of time 6, thus executing for 1 unit of time. - * So function 0 spends 2 + 1 = 3 units of total time executing, and function 1 spends 4 units of total time executing. - * - * - * Note: - * -> 1 <= n <= 100 - * -> Two functions won't start or end at the same time. - * -> Functions will always log when they exit. - * - * @author rampatra - * @since 2019-08-17 - */ -public class ExclusiveTimeOfFunctions { - - /** - * Runtime: 18 ms. - * - * @param n - * @param logs - * @return - */ - public static int[] exclusiveTime(int n, List logs) { - int[] times = new int[n]; - Stack> stack = new Stack<>(); - - for (String log : logs) { - String[] l = log.split(":"); - int id = Integer.parseInt(l[0]); - String operation = l[1]; - int timestamp = Integer.parseInt(l[2]); - - if (operation.equals("start")) { - if (!stack.empty()) { // if there are other processes started before, calculate their time until now - times[stack.peek().getKey()] += (timestamp - stack.peek().getValue() - 1); - } - stack.push(new Pair<>(id, timestamp)); - } else { - times[id] += timestamp - stack.pop().getValue() + 1; - if (!stack.isEmpty()) { // if there are other processes, make their start time to now - stack.push(new Pair<>(stack.pop().getKey(), timestamp)); - } - } - } - - return times; - } - - public static void main(String[] args) { - assertEquals("[4]", Arrays.toString(exclusiveTime(1, Arrays.asList("0:start:0", "0:start:1", "0:end:2", "0:end:3")))); - assertEquals("[6]", Arrays.toString(exclusiveTime(1, Arrays.asList("0:start:0", "0:start:1", "0:start:2", "0:end:3", "0:end:4", "0:end:5")))); - assertEquals("[3, 4]", Arrays.toString(exclusiveTime(2, Arrays.asList("0:start:0", "1:start:2", "1:end:5", "0:end:6")))); - } -} \ No newline at end of file diff --git a/src/main/java/com/rampatra/arrays/MaxSpan.java b/src/main/java/com/rampatra/arrays/MaxSpan.java deleted file mode 100644 index 7db17c18..00000000 --- a/src/main/java/com/rampatra/arrays/MaxSpan.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.rampatra.arrays; - -import com.sun.tools.javac.util.Assert; - -/** - * Consider the leftmost and rightmost appearances of some value in an array. We'll say that the "span" is the - * number of elements between the two inclusive. A single value has a span of 1. Returns the largest span found - * in the given array. - *

- * Examples: - * maxSpan([1, 2, 1, 1, 3]) → 4 - * maxSpan([1, 4, 2, 1, 4, 1, 4]) → 6 - * maxSpan([1, 4, 2, 1, 4, 4, 4]) → 6 - *

- * Level: Easy - * - * @author rampatra - * @link https://codingbat.com/prob/p189576 - * @since 2019-01-23 - */ -public class MaxSpan { - - public static int maxSpan(int[] nums) { - if (nums.length == 0) return 0; - int largestSpan = 1; - for (int i = 0; i < nums.length; i++) { - for (int j = nums.length - 1; j > i; j--) { - if (nums[i] == nums[j]) { - if (j - i + 1 > largestSpan) { - largestSpan = j - i + 1; - } - } - } - } - return largestSpan; - } - - public static void main(String[] args) { - Assert.check(maxSpan(new int[]{1, 2, 1, 1, 3}) == 4); - Assert.check(maxSpan(new int[]{1, 4, 2, 1, 4, 1, 4}) == 6); - Assert.check(maxSpan(new int[]{1, 4, 2, 1, 4, 4, 4}) == 6); - Assert.check(maxSpan(new int[]{1}) == 1); - Assert.check(maxSpan(new int[]{}) == 0); - } -} diff --git a/src/main/java/com/rampatra/strings/WithoutString.java b/src/main/java/com/rampatra/strings/WithoutString.java deleted file mode 100644 index 859b6a76..00000000 --- a/src/main/java/com/rampatra/strings/WithoutString.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.rampatra.strings; - -import com.sun.tools.javac.util.Assert; - -/** - * Given two strings, base and remove, return a version of the base string where all instances - * of the remove string have been removed (not case sensitive). You may assume that the remove - * string is length 1 or more. Remove only non-overlapping instances, so with "xxx" removing - * "xx" leaves "x". - * - * @author rampatra - * @since 2019-01-23 - */ -public class WithoutString { - - private static String withoutString(String base, String remove) { - String original = base; - base = base.toLowerCase(); - remove = remove.toLowerCase(); - int baseLen = base.length(); - int removeLen = remove.length(); - StringBuilder sb = new StringBuilder(); - - for (int i = 0; i < baseLen; ) { - int j = 0; - // when we see a match, advance the pointer - while (j < removeLen && i + j < baseLen && base.charAt(i + j) == remove.charAt(j)) { - j++; - } - if (j == removeLen) { // an entire match was found, move ahead and skip these chars - i += removeLen; - } else { - sb.append(original.charAt(i)); // entire match was not found so append the char to StringBuilder - i++; - } - } - return sb.toString(); - } - - public static void main(String[] args) { - Assert.check(withoutString("Hello there", "llo").equals("He there")); - Assert.check(withoutString("THIS is a FISH", "is").equals("TH a FH")); - Assert.check(withoutString("xxx", "x").equals("")); - } -} diff --git a/src/main/test/SortStackTest.java b/src/main/test/SortStackTest.java new file mode 100644 index 00000000..520c8a07 --- /dev/null +++ b/src/main/test/SortStackTest.java @@ -0,0 +1,67 @@ +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.*; + +import java.util.Stack; + +import org.junit.jupiter.api.Test; + +import com.ctci.stacksandqueues.SortStack; + +class SortStackTest { + +/** + * note + */ + @Test + public void testStackNull() { + Stack unsortedStack = new Stack(); + unsortedStack.push(2); + unsortedStack.push(5); + unsortedStack.push(1); + unsortedStack.push(3); + boolean empty = unsortedStack.empty(); + assertTrue("Array empty",empty); + + } + + @Test + public void testStackHaveOnevalue() { + Stack unsortedStack = new Stack(); + unsortedStack.push(2); + + if(unsortedStack.size() == 1) { + SortStack.printStack(unsortedStack); + + assertTrue("array has only 1 value!", true); + }else { + SortStack.printStack(unsortedStack); + } + + + } + + @Test + public void testCheckArraySort() { + Stack unsortedStack = new Stack(); + + unsortedStack.push(1); + unsortedStack.push(30); + unsortedStack.push(9); + unsortedStack.push(13); + + for(int i = 0; i <= unsortedStack.size(); i++) { + for(int j = i + 1; j < unsortedStack.size(); j++) { + if(unsortedStack.get(i) > unsortedStack.get(j)) { + assertFalse("Unsorted array!", false); + SortStack.sortStack(unsortedStack); + }else { + assertTrue("Sorted array", true); + } + } + } + + SortStack.printStack(unsortedStack); + } + +}