Skip to content

Commit cf9d56e

Browse files
committed
Initial Commit
0 parents  commit cf9d56e

File tree

64 files changed

+2594
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+2594
-0
lines changed

.classpath

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" output="target/classes" path="src/main/java">
4+
<attributes>
5+
<attribute name="optional" value="true"/>
6+
<attribute name="maven.pomderived" value="true"/>
7+
</attributes>
8+
</classpathentry>
9+
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
10+
<attributes>
11+
<attribute name="maven.pomderived" value="true"/>
12+
</attributes>
13+
</classpathentry>
14+
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
15+
<attributes>
16+
<attribute name="optional" value="true"/>
17+
<attribute name="maven.pomderived" value="true"/>
18+
</attributes>
19+
</classpathentry>
20+
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
21+
<attributes>
22+
<attribute name="maven.pomderived" value="true"/>
23+
</attributes>
24+
</classpathentry>
25+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
26+
<attributes>
27+
<attribute name="maven.pomderived" value="true"/>
28+
</attributes>
29+
</classpathentry>
30+
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
31+
<attributes>
32+
<attribute name="maven.pomderived" value="true"/>
33+
</attributes>
34+
</classpathentry>
35+
<classpathentry kind="output" path="target/classes"/>
36+
</classpath>

.project

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>Ajjarani_Codes_Algorithms_DataStructures</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.m2e.core.maven2Builder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
</buildSpec>
19+
<natures>
20+
<nature>org.eclipse.jdt.core.javanature</nature>
21+
<nature>org.eclipse.m2e.core.maven2Nature</nature>
22+
</natures>
23+
</projectDescription>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
3+
org.eclipse.jdt.core.compiler.compliance=1.5
4+
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
5+
org.eclipse.jdt.core.compiler.source=1.5
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
activeProfiles=
2+
eclipse.preferences.version=1
3+
resolveWorkspaceProjects=true
4+
version=1

README.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# AjjaraniCodes_DataStructure
2+
3+
Practice Implementation Project from Ajith Ajjarani for DataStructure & Algorithms, with Best Practices for Java Based Projects
4+
5+
Following, Sample Codes are available
6+
7+
8+
## 1. DATA
9+
1. 8 Primitive Types of Data :
10+
{ bool, int, float, long, double, char, short, Byte}
11+
12+
2. Extended Types of Data :
13+
{Integer, String, Abstract/Complex}
14+
15+
## 2. Data, is always stored in DataStructure
16+
Eg : DataStructure -
17+
1. Lists : Duplication of data allowed.
18+
- Static List : Arrays
19+
- Dynamic List : LinkedList (Single Linked & Double Linked)
20+
2. Set : Duplication of data NOT allowed
21+
- HashSet
22+
3. Stacks
23+
4. Queues
24+
5. Maps
25+
- Hash Maps : Key-Value pair
26+
6. Heaps
27+
7. Tables
28+
8. Matrix
29+
9. Trees
30+
10. Graphs
31+
11. Bags
32+
12. Buffers
33+
13. CSV File
34+
35+
36+
## 3. CRUD, operations are always done over data
37+
1. CREATE data in Datastructure
38+
2. READ data from Datastructure
39+
3. UPDATE data in Datastructure
40+
4. DELETE data in Datastructure
41+
42+
Above operations are achieved using PUSH & POP Operations
43+
44+
## 4. Once Data is stored in DataStructure or CRUD is done, Following operations are necessary to effectively utilize data
45+
46+
1. Sorting
47+
- Ascending
48+
- Descending
49+
- Increasing/Decreasing Order
50+
51+
2. Searching
52+
- Locating the data at certain position in DataStructure
53+
54+
## 5. Sorting Algorithms
55+
1. Bubble Sort
56+
2. Insertion Sort
57+
3. Merge Sort
58+
4. Quick Sort
59+
5. Selection Sort
60+
6. Bogo Sort
61+
7. CockTailShaker Sort
62+
8. gnome Sort
63+
9. Heap Sort
64+
10. Radix Sort
65+
11. Shell Sort
66+
12. Bucket Sort
67+
13.
68+
69+
## 6. Search Algorithms
70+
1. Binary Search
71+
2. Linear Search
72+
73+
## 7. Once, Data is Sorted & Searched - Any Use Case can be done on Data
74+
75+
## 8. Dynamic Algorithms
76+
1. Fibonacci Series
77+
78+
## 9. Data TypeCast/Conversion Algorithms
79+
1. Decimal To Binary
80+
2. Decimal To Octal
81+
82+
## 10. Encyrption/Decryption/Cipher Algorithms
83+
1.
84+
85+
86+
87+
88+
89+
90+
91+
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
*
3+
*/
4+
package data_structures.LinkedList.CircularLinkedList;
5+
6+
/**
7+
* @author A.Ajjarani
8+
*
9+
*/
10+
public class CircleLinkedList {
11+
12+
13+
14+
15+
16+
17+
18+
/**
19+
* @param args
20+
*/
21+
public static void main(String[] args) {
22+
// TODO Auto-generated method stub
23+
24+
}
25+
26+
}
Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
package data_structures.LinkedList.DoubleLinkedList;
2+
3+
/**
4+
*
5+
* Implementation Class : Double Linked List (SLL)
6+
*
7+
* NOTE : Bidirectional Traversal possible
8+
* ---- ---- ----
9+
* | |<---->| |<---->| |----
10+
* ---- ---- ----
11+
*
12+
* Important Properties :
13+
*
14+
* 1. Double Linked List is similar to Arrays, as it holds value/data
15+
* 2. Double Linked List is dynamic, extends/grows OR shrinks/decreases as data is added/deleted
16+
* 3. Addition/Deletion of data only from Head or Front of Single Linked List
17+
*
18+
*
19+
* @author A.Ajjarani
20+
*
21+
*/
22+
23+
/*
24+
25+
------------- ------------
26+
| Prev | | Prev |
27+
| | | |
28+
| | | |
29+
|----------- |-----------
30+
| Value |<-------> | Value |
31+
| | | |
32+
| | | |
33+
------------ ------------
34+
| Next | | Next |
35+
| | | |
36+
| | | |
37+
------------ ------------
38+
39+
40+
*/
41+
public class DoubleLinkedList {
42+
// Front Link of the DLL
43+
private Link Head;
44+
45+
// Tail Link of the DLL
46+
private Link Tail;
47+
48+
49+
/**
50+
* Constructor : Always/Only Executed, when Object for DoubleLinkedList is created
51+
* i.e : Head = null, this means Head Link is instantiated/created with NULL
52+
* Tail = null, this means Tail Link is instantiated/created with NULL
53+
*/
54+
public DoubleLinkedList() {
55+
this.Head = null;
56+
this.Tail = null;
57+
}
58+
59+
60+
61+
/*
62+
* Below following properties/characteristics of this Double Linked List are implemented
63+
* 1. Insert Head Link
64+
* 2. Insert Tail Link
65+
*
66+
* 5. Display DLL
67+
* 6. IsEmpty
68+
*
69+
* Need to Do:
70+
*
71+
* 6. Length
72+
*/
73+
74+
75+
/**
76+
* Method Name : InsertHeadLink : Add Values at the Front of DLL
77+
* 1. Create Link with Value
78+
* 2. If DLL is Empty - Add the new Link as Tail
79+
* 2.a If DLL is Not empty - access the Head & It's previous address & equate to newLink
80+
*
81+
*
82+
*
83+
* @param headValue
84+
*/
85+
public void insertHeadLink(int headValue) {
86+
87+
//1. Link is created with Value as "headValue",
88+
Link newLink = new Link(headValue);
89+
90+
//2. Setting the Link into DLL
91+
if(isDLLEmpty()) {
92+
this.Tail = newLink;
93+
} else {
94+
// 2.a When adding an Link to existing DLL, get the
95+
// Earlier Head of DLL & Traverse to it's Previous Link Value
96+
this.Head.previous = newLink;
97+
}
98+
99+
newLink.next = this.Head;
100+
this.Head = newLink;
101+
}
102+
103+
104+
105+
106+
/**
107+
* Method Name : InsertHeadLink : Add Values at the Tail of DLL
108+
* 1. Create a newLink with Value
109+
*
110+
* Set the Following to back this as Tail
111+
* 2. newLink/next -null
112+
* 3. Current Existing Tail/next = newLink
113+
* 4. newLink/previous = Current Existing Tail address
114+
*
115+
* 5. Lastly - make Tail = newLink *
116+
*
117+
* @param headValue
118+
*/
119+
public void insertTailLink(int tailValue) {
120+
121+
//1. Link is created with Value as "tailValue",
122+
Link newLink = new Link(tailValue);
123+
124+
// 2. As this is the Last Link, Therefore Next will be Null
125+
newLink.next = null;
126+
127+
//3. As The DLL is existing, get teh address of the newLink/Previous & make it Tail/next
128+
this.Tail.next = newLink;
129+
newLink.previous = this.Tail;
130+
this.Tail = newLink;
131+
132+
}
133+
134+
135+
136+
/**
137+
* MethodName : displayDLL :
138+
*
139+
* Prints the complete Values stored in the DLL
140+
*
141+
* 1. Starts Traversing from the head Link
142+
* 2. Access the value at each Link & prints
143+
* 3. until Exit Condition, End of DLL( i.e reference Link have == null)
144+
*
145+
*/
146+
public void displayDLL() {
147+
148+
// 1. Start Traversing from Head Link
149+
Link refLink = this.Head;
150+
151+
// 2. Loop through the complete DLL & access Link
152+
int i = 0;
153+
while(refLink != null) {
154+
System.out.println("The "+i +"th Position : "+refLink.value);
155+
refLink = refLink.next;
156+
i++;
157+
}
158+
}
159+
160+
161+
162+
163+
164+
165+
166+
167+
private boolean isDLLEmpty() {
168+
// TODO Auto-generated method stub
169+
return(Head == null);
170+
}
171+
172+
173+
174+
/**
175+
*
176+
* Static Main Method : Start of Thread:
177+
*
178+
* 1. For Testing purpose of above implemented DLL
179+
*
180+
* @param args
181+
*/
182+
public static void main(String args[]) {
183+
DoubleLinkedList DLL1 = new DoubleLinkedList();
184+
185+
186+
DLL1.insertHeadLink(15);
187+
DLL1.insertHeadLink(12);
188+
189+
DLL1.displayDLL();
190+
191+
DLL1.insertTailLink(30);
192+
DLL1.displayDLL();
193+
}
194+
}

0 commit comments

Comments
 (0)