Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 1.0 #31

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
12 changes: 12 additions & 0 deletions Alternatives.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/CodingNinjas/src/practice/Alternatives.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_EXCLUDE_TEST_CODE" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="practice.Alternatives"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="CodingNinjas"/>
</launchConfiguration>
12 changes: 12 additions & 0 deletions Anagram.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/CodingNinjas/src/practice/Anagram.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_EXCLUDE_TEST_CODE" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="practice.Anagram"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="CodingNinjas"/>
</launchConfiguration>
12 changes: 12 additions & 0 deletions Duplicate_number.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/CodingNinjas/src/practice/Duplicate_number.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_EXCLUDE_TEST_CODE" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="practice.Duplicate_number"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="CodingNinjas"/>
</launchConfiguration>
12 changes: 12 additions & 0 deletions Implementation.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/dataStructures/src/Implementation/Implementation.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_EXCLUDE_TEST_CODE" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="Implementation.Implementation"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="dataStructures"/>
</launchConfiguration>
12 changes: 12 additions & 0 deletions Implementations.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/dataStructures/src/Implementation/Implementations.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_EXCLUDE_TEST_CODE" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="Implementation.Implementations"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="dataStructures"/>
</launchConfiguration>
12 changes: 12 additions & 0 deletions Lists.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/First/src/dataStructures/Lists.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_EXCLUDE_TEST_CODE" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="dataStructures.Lists"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="First"/>
</launchConfiguration>
16 changes: 16 additions & 0 deletions New_configuration.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.ant.AntLaunchConfigurationType">
<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="true"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk-11.0.5"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.ant.internal.launching.remote.InternalAntRunner"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value=""/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="D:\DS-Algo-master\queue\MainClass.java"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="&quot;Run this file&quot;"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="D:\DS-Algo-master\queue"/>
<stringAttribute key="process_factory_id" value="org.eclipse.ant.ui.remoteAntProcessFactory"/>
</launchConfiguration>
12 changes: 12 additions & 0 deletions Practice.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/First/src/dataStructures/Practice.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_EXCLUDE_TEST_CODE" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="dataStructures.Practice"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="First"/>
</launchConfiguration>
12 changes: 12 additions & 0 deletions Problem1.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/CodingNinjas/src/practice/Problem1.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_EXCLUDE_TEST_CODE" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="practice.Problem1"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="CodingNinjas"/>
</launchConfiguration>
12 changes: 12 additions & 0 deletions Problem_stock_are_profitable.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/CodingNinjas/src/practice/Problem_stock_are_profitable.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_EXCLUDE_TEST_CODE" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="practice.Problem_stock_are_profitable"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="CodingNinjas"/>
</launchConfiguration>
12 changes: 12 additions & 0 deletions Question.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/CodingNinjas/src/practice/Question.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_EXCLUDE_TEST_CODE" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="practice.Question"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="CodingNinjas"/>
</launchConfiguration>
12 changes: 12 additions & 0 deletions Question1.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/CodingNinjas/src/codeKaze/Question1.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_EXCLUDE_TEST_CODE" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="codeKaze.Question1"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="CodingNinjas"/>
</launchConfiguration>
12 changes: 12 additions & 0 deletions StackPractice.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/CodingNinjas/src/practice/StackPractice.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_EXCLUDE_TEST_CODE" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="practice.StackPractice"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="CodingNinjas"/>
</launchConfiguration>
12 changes: 12 additions & 0 deletions Test (1).launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/CodingNinjas/src/practice/Test.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_EXCLUDE_TEST_CODE" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="practice.Test"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="CodingNinjas"/>
</launchConfiguration>
12 changes: 12 additions & 0 deletions Test.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/First/src/justForTesting/Test.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_EXCLUDE_TEST_CODE" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="justForTesting.Test"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="First"/>
</launchConfiguration>
54 changes: 54 additions & 0 deletions comparatorsAndComparables/MainClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
public class MainClass {

public static void main(String[] args) {
<<<<<<< HEAD

List<Student> students = new ArrayList<>();

Expand Down Expand Up @@ -80,10 +81,49 @@ public int compare(Student o1, Student o2) {
// IF WE WANT TO REVERSE THE DEFINED SORTING ORDER WE CAN USE "reversed"
// function
Collections.sort(students, Comparator.comparing(Student::getName).thenComparing(Student::getMarks).reversed());
=======

List<Student> students = new ArrayList<>();

students.add(new Student(23, "Ram"));
students.add(new Student(35, "Shyam"));
students.add(new Student(83, "Aman"));
students.add(new Student(13, "Ram"));
students.add(new Student(13, "Anuj"));

// Collections.sort(students, new Comparator<Student>() {
//
// @Override
// public int compare(Student o1, Student o2) {
// if(o1.name.equals(o2.name)) {
// return o1.marks - o2.marks;
// } else {
// return o1.name.compareTo(o2.name);
// }
// }
//
// });
//
// Collections.sort(students, (o1, o2) -> {
// if(o1.name.equals(o2.name)) {
// return o1.marks - o2.marks;
// } else {
// return o1.name.compareTo(o2.name);
// }
// });

// Collections.sort(students, (o1, o2) -> o1.name.compareTo(o2.name));

Collections.sort(students, Comparator.comparing(Student::getName)
.thenComparing(Student::getMarks).reversed());

students.forEach(System.out::println);
>>>>>>> 24de017... Initial commit
}

}

<<<<<<< HEAD
// COMPARATORS CLASS
class SortByNameThenMarks implements Comparator<Student> {

Expand All @@ -98,3 +138,17 @@ public int compare(Student o1, Student o2) {
}

}
=======
//class SortByNameThenMarks implements Comparator<Student>{
//
// @Override
// public int compare(Student o1, Student o2) {
// if(o1.name.equals(o2.name)) {
// return o1.marks - o2.marks;
// } else {
// return o1.name.compareTo(o2.name);
// }
// }
//
//}
>>>>>>> 24de017... Initial commit
11 changes: 11 additions & 0 deletions comparatorsAndComparables/Student.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
package comparatorsAndComparables;

public class Student {
<<<<<<< HEAD

int marks;
String name;

=======

int marks;
String name;

>>>>>>> 24de017... Initial commit
public Student(int marks, String name) {
super();
this.marks = marks;
Expand Down Expand Up @@ -32,6 +39,10 @@ public void setName(String name) {
this.name = name;
}

<<<<<<< HEAD
=======

>>>>>>> 24de017... Initial commit
public int compareTo(Student obj) {
return this.marks - obj.marks;
}
Expand Down
13 changes: 13 additions & 0 deletions deque/MainClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
public class MainClass {

public static void main(String[] args) {
<<<<<<< HEAD

ArrayDeque<Integer> ad = new ArrayDeque<>();

Expand All @@ -15,6 +16,18 @@ public static void main(String[] args) {
System.out.println(ad.pop());
System.out.println(ad.pop());

=======

ArrayDeque<Integer> ad = new ArrayDeque<>();

ad.push(12);
ad.push(23);
ad.push(34);

System.out.println(ad.pop());
System.out.println(ad.pop());

>>>>>>> 24de017... Initial commit
}

}
36 changes: 36 additions & 0 deletions deque/MyDeque.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package deque;

public class MyDeque<E> {
<<<<<<< HEAD

Node<E> head, tail;

Expand All @@ -21,21 +22,56 @@ public E removeLast() {
}
Node<E> toRemove = tail;
if (tail.next == null) {
=======

Node<E> head, tail;

public void addToHead(E data) {
Node<E> toAdd = new Node<>(data);
if(head == null) {
head = tail = toAdd;
}
else {
head.next = toAdd;
toAdd.prev = head;
head = head.next;
}
}

public E removeLast() {
if(head == null) {
return null;
}
Node<E> toRemove = tail;
if(tail.next == null) {
>>>>>>> 24de017... Initial commit
tail = head = null;
return toRemove.data;
}
tail = tail.next;
tail.prev = null;
<<<<<<< HEAD
if (tail == null) {
=======
if(tail == null) {
>>>>>>> 24de017... Initial commit
head = null;
}
return toRemove.data;
}
<<<<<<< HEAD

public static class Node<E> {
E data;
Node<E> next, prev;

=======

public static class Node<E> {
E data;
Node<E> next, prev;

>>>>>>> 24de017... Initial commit
public Node(E data) {
this.data = data;
this.next = this.prev = null;
Expand Down
Loading