Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork312
Junit for sort stack#31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Open
nguyenvanhau27 wants to merge2 commits intorampatra:masterChoose a base branch fromnguyenvanhau27:master
base:master
Could not load branches
Branch not found:{{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
Uh oh!
There was an error while loading.Please reload this page.
Open
Changes fromall commits
Commits
Show all changes
2 commits Select commitHold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
12 changes: 12 additions & 0 deletions.classpath
This file contains hidden or 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 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" path="src/main/java"/> | ||
<classpathentry kind="src" path="src/main/test"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"> | ||
<attributes> | ||
<attribute name="owner.project.facets" value="java"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
29 changes: 29 additions & 0 deletions.project
This file contains hidden or 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,29 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>Algorithms-and-Data-Structures-in-Java</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.wst.common.project.facet.core.builder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.m2e.core.maven2Builder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.m2e.core.maven2Nature</nature> | ||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
2 changes: 2 additions & 0 deletions.settings/org.eclipse.core.resources.prefs
This file contains hidden or 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,2 @@ | ||
eclipse.preferences.version=1 | ||
encoding/<project>=UTF-8 |
10 changes: 10 additions & 0 deletions.settings/org.eclipse.jdt.core.prefs
This file contains hidden or 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,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 |
4 changes: 4 additions & 0 deletions.settings/org.eclipse.wst.common.project.facet.core.xml
This file contains hidden or 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 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<faceted-project> | ||
<installed facet="java" version="1.8"/> | ||
</faceted-project> |
122 changes: 122 additions & 0 deletionsbin/com/rampatra/bits/README.md
This file contains hidden or 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,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 | ||
``` |
76 changes: 76 additions & 0 deletionsbin/com/rampatra/database/README.md
This file contains hidden or 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,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). | ||
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.