Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit adab967

Browse files
update junit test file
1 parent db15c1e commit adab967

20 files changed

+2259
-706
lines changed

.classpath

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" path="src/main/java"/>
4+
<classpathentry kind="src" path="src/main/test"/>
5+
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5"/>
6+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
7+
<attributes>
8+
<attribute name="owner.project.facets" value="java"/>
9+
</attributes>
10+
</classpathentry>
11+
<classpathentry kind="output" path="bin"/>
12+
</classpath>

.project

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>Algorithms-and-Data-Structures-in-Java</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.wst.common.project.facet.core.builder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
<buildCommand>
19+
<name>org.eclipse.m2e.core.maven2Builder</name>
20+
<arguments>
21+
</arguments>
22+
</buildCommand>
23+
</buildSpec>
24+
<natures>
25+
<nature>org.eclipse.m2e.core.maven2Nature</nature>
26+
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
27+
<nature>org.eclipse.jdt.core.javanature</nature>
28+
</natures>
29+
</projectDescription>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
eclipse.preferences.version=1
2+
encoding/<project>=UTF-8

.settings/org.eclipse.jdt.core.prefs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
4+
org.eclipse.jdt.core.compiler.compliance=1.8
5+
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
6+
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
7+
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
8+
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
9+
org.eclipse.jdt.core.compiler.release=enabled
10+
org.eclipse.jdt.core.compiler.source=1.8
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<faceted-project>
3+
<installed facet="java" version="1.8"/>
4+
</faceted-project>

bin/com/rampatra/bits/README.md

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# Bits
2+
3+
## Basic Operators
4+
5+
#### AND:
6+
7+
| x | y | x `&` y |
8+
----|---|:-------:|
9+
| 0 | 0 | 0 |
10+
| 0 | 1 | 0 |
11+
| 1 | 0 | 0 |
12+
| 1 | 1 | 1 |
13+
14+
#### OR:
15+
16+
| x | y | x `\|` y |
17+
|---|---|:--------:|
18+
| 0 | 0 | 0 |
19+
| 0 | 1 | 1 |
20+
| 1 | 0 | 1 |
21+
| 1 | 1 | 1 |
22+
23+
#### XOR:
24+
25+
| x | y | x `^` y |
26+
|---|---|:-------:|
27+
| 0 | 0 | 0 |
28+
| 0 | 1 | 1 |
29+
| 1 | 0 | 1 |
30+
| 1 | 1 | 0 |
31+
32+
33+
## Shifts
34+
35+
_Disclaimer: We are taking `byte` (8 bits) as our datatype to explain the
36+
concepts instead of the usual integer._
37+
38+
#### 1. Left Shift (<<):
39+
40+
1 << 3 = 8
41+
42+
> 00000001 << 3 = 00001000
43+
44+
#### 2. Right Shift:
45+
46+
**Two types:**
47+
48+
**a. Signed Right Shift (>>):**
49+
50+
64 >> 2 = 16
51+
52+
> 001000000 >> 2 = 00010000
53+
54+
-64 >> 2 = -16
55+
56+
> 111000000 >> 2 = 11110000
57+
58+
**b. Unsigned Right Shift (>>>):**
59+
60+
64 >>> 2 = 16
61+
62+
> 001000000 >>> 2 = 00010000
63+
64+
-64 >>> 2 = 56
65+
66+
> 111000000 >>> 2 = 00111000
67+
68+
## Helpful Masks
69+
70+
#### 1. Set the 4th bit from right:
71+
72+
```java
73+
byte mask = 1 << 3;
74+
```
75+
76+
Explanation,
77+
78+
```
79+
00000001 << 3 = 00001000
80+
```
81+
82+
#### 2. Set the first 3 bits from right:
83+
84+
```java
85+
byte mask = (1 << 3) - 1;
86+
```
87+
88+
Explanation,
89+
90+
```
91+
00000001 << 3 = 00001000
92+
93+
00001000 - 00000001 = 00000111
94+
```
95+
96+
#### 3. Mask with alternating 1010...10
97+
98+
```java
99+
byte mask = 0x55;
100+
```
101+
102+
#### 4. Mask with alternating 0101...01
103+
104+
```java
105+
byte mask = 0xaa;
106+
```
107+
108+
#### 5. Unset the 4th bit
109+
110+
```java
111+
byte mask = 1 << 3;
112+
113+
byte num = num & ~mask;
114+
```
115+
116+
Explanation,
117+
118+
```
119+
00000001 << 3 = 00001000
120+
121+
~(00001000) = 11110111
122+
```

bin/com/rampatra/database/README.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Relational Database (WIP)
2+
3+
A __relational database__ is a digital database based on
4+
the [relational model](https://en.wikipedia.org/wiki/Relational_model) of
5+
data. In simple words, it is a collection of data items with pre-defined
6+
relationships between them. These items are organized as a set of tables,
7+
with columns and rows. Each column stores some specific attribute of an object/entity and the
8+
row represents a specific object/entity.
9+
10+
A software system used to maintain relational databases is a __relational
11+
database management system (RDBMS)__, for e.g., MySQL, Oracle DB, PostgreSQL, etc.
12+
Virtually all relational database systems use __SQL (Structured Query Language)__
13+
for querying and maintaining the database.
14+
15+
## Basic Definitions
16+
17+
1. Primary Key
18+
19+
2. Candidate Key
20+
21+
3. Composite Key
22+
23+
4. Prime/Non-prime attribute
24+
25+
## Types of SQL commands
26+
27+
1. DDL
28+
2. DML
29+
3. DCL
30+
4. TCL
31+
32+
| Type | Command List |
33+
|-------|-------------------|
34+
| DDL | CREATE |
35+
| | DROP |
36+
| | ALTER |
37+
| | RENAME |
38+
| | TRUNCATE |
39+
| | |
40+
| DML | SELECT |
41+
| | INSERT |
42+
| | UPDATE |
43+
| | DELETE |
44+
| | |
45+
| DCL | GRANT |
46+
| | REVOKE |
47+
| | |
48+
| TCL | START TRANSACTION |
49+
| | COMMIT |
50+
| | ROLLBACK |
51+
52+
## Types of Joins
53+
54+
1. Inner Join
55+
2. Left Outer Join
56+
3. Right Outer Join
57+
4. Full Join
58+
5. Self Join
59+
60+
## Normalization Forms
61+
62+
1. 1NF
63+
2. 2NF
64+
3. 3NF
65+
4. BCNF
66+
5. 4NF
67+
6. 5NF
68+
69+
#### 1NF
70+
71+
Required conditions:
72+
73+
a. All values should be atomic (non-breakable).
74+
b. There should be a candidate key or a composite key (basically you should be able to uniquely identify all records in the table).
75+
76+

0 commit comments

Comments
 (0)