diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 00000000..13566b81
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 00000000..bcb5da6c
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 00000000..1039bae9
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 00000000..35eb1ddf
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Exercise_1.java b/Exercise_1.java
index c3ff1141..23005e52 100644
--- a/Exercise_1.java
+++ b/Exercise_1.java
@@ -1,8 +1,29 @@
-class BinarySearch {
+// Time Complexity: O(log N)
+// Space Complexity: O(log N) -> due to using recursion
+
+class BinarySearch {
// Returns index of x if it is present in arr[l.. r], else return -1
int binarySearch(int arr[], int l, int r, int x)
- {
- //Write your code here
+ {
+ // only work if the arr is sorted
+ if (r >= l) {
+ //get the mid
+ int mid = l + (r -l)/2;
+
+ // if the value is in the middle return it
+ if (arr[mid] == x) {
+ return mid;
+ }
+
+ // if the value of the mid element is greater than the value x then only look at the left half
+ if (arr[mid] > x) {
+ return binarySearch(arr, l, mid - 1, x);
+ }
+
+ // the only remaining scenario where the value of x is greater than the mid element
+ return binarySearch(arr, mid+1, r, x);
+ }
+ return -1;
}
// Driver method to test above
diff --git a/Exercise_2.java b/Exercise_2.java
index d0b5fa5f..918d7e30 100644
--- a/Exercise_2.java
+++ b/Exercise_2.java
@@ -1,48 +1,65 @@
-class QuickSort
-{
- /* This function takes last element as pivot,
- places the pivot element at its correct
- position in sorted array, and places all
- smaller (smaller than pivot) to left of
- pivot and all greater elements to right
+// Time Complexity: O(N log N) -> Pivot splitting the array into halves
+// Space Complexity: O(log N)
+
+class QuickSort
+{
+ /* This function takes last element as pivot,
+ places the pivot element at its correct
+ position in sorted array, and places all
+ smaller (smaller than pivot) to left of
+ pivot and all greater elements to right
of pivot */
void swap(int arr[],int i,int j){
- //Your code here
+ int temp = arr[i];
+ arr[i] = arr[j];
+ arr[j] = temp;
}
-
- int partition(int arr[], int low, int high)
- {
- //Write code here for Partition and Swap
- }
- /* The main function that implements QuickSort()
- arr[] --> Array to be sorted,
- low --> Starting index,
+
+ int partition(int arr[], int low, int high)
+ {
+ int pivot = arr[high];
+ int index = low - 1;
+ for (int j = low; j <= high-1; j++){
+ if (arr[j] < pivot) {
+ index++;
+ swap(arr, index, j);
+ }
+ }
+ swap(arr, index + 1, high);
+ return index+1;
+ }
+ /* The main function that implements QuickSort()
+ arr[] --> Array to be sorted,
+ low --> Starting index,
high --> Ending index */
- void sort(int arr[], int low, int high)
- {
- // Recursively sort elements before
- // partition and after partition
- }
-
+ void sort(int arr[], int low, int high)
+ {
+ if (low < high) {
+ int pivotIndex = partition(arr, low, high);
+ sort(arr, low, pivotIndex - 1);
+ sort(arr, pivotIndex + 1, high);
+ }
+ }
+
/* A utility function to print array of size n */
- static void printArray(int arr[])
- {
- int n = arr.length;
- for (int i=0; i");
+ tnode = tnode.next;
+ }
+ System.out.println("NULL");
+ }
- public void printList()
- {
- Node tnode = head;
- while (tnode != null)
- {
- System.out.print(tnode.data+"->");
- tnode = tnode.next;
- }
- System.out.println("NULL");
- }
-
- public static void main(String [] args)
- {
- LinkedList llist = new LinkedList();
- for (int i=15; i>0; --i)
- {
- llist.push(i);
- llist.printList();
- llist.printMiddle();
- }
- }
-}
\ No newline at end of file
+ public static void main(String [] args)
+ {
+ LinkedList llist = new LinkedList();
+ for (int i=15; i>0; --i)
+ {
+ llist.push(i);
+ llist.printList();
+ llist.printMiddle();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Exercise_4.java b/Exercise_4.java
index 81afd3c2..0c14c36f 100644
--- a/Exercise_4.java
+++ b/Exercise_4.java
@@ -1,42 +1,72 @@
-class MergeSort
-{
- // Merges two subarrays of arr[].
- // First subarray is arr[l..m]
- // Second subarray is arr[m+1..r]
- void merge(int arr[], int l, int m, int r)
- {
- //Your code here
- }
-
- // Main function that sorts arr[l..r] using
- // merge()
- void sort(int arr[], int l, int r)
- {
- //Write your code here
- //Call mergeSort from here
- }
-
+//Time Complexity: O(NlogN) -> LogN comes from dividing the array into half and N from comparing at each level
+// Space Complexity: O(N) -> Due to storing the temp left and right arrays.
+
+import java.awt.image.renderable.RenderableImage;
+import java.lang.reflect.Array;
+import java.util.Arrays;
+
+class MergeSort
+{
+ // Merges two subarrays of arr[].
+ // First subarray is arr[l..m]
+ // Second subarray is arr[m+1..r]
+ void merge(int arr[], int l, int m, int r)
+ {
+ int[] leftArray = new int[m-l+1];
+ int[] rightArray = new int[r-m];
+ leftArray = Arrays.copyOfRange(arr, l, m+1);
+ rightArray = Arrays.copyOfRange(arr, m+1, r+1);
+
+ int index = l;
+ int i = 0, j = 0 ;
+ while (i < m-l+1 && j < r-m) {
+ if (leftArray[i] <= rightArray[j]) {
+ arr[index] = leftArray[i];
+ i++;
+ } else {
+ arr[index] = rightArray[j];
+ j++;
+ }
+ index++;
+ }
+
+ while (i < m-l+1) arr[index++] = leftArray[i++];
+ while (j < r-m) arr[index++] = rightArray[j++];
+ }
+
+ // Main function that sorts arr[l..r] using
+ // merge()
+ void sort(int arr[], int l, int r)
+ {
+ int middle = l + (r - l)/2;
+ if (l < r) {
+ sort(arr, l, middle);
+ sort(arr, middle + 1, r);
+ merge(arr, l, middle, r);
+ }
+ }
+
/* A utility function to print array of size n */
- static void printArray(int arr[])
- {
- int n = arr.length;
- for (int i=0; i s = new Stack();
+ s.push(l);
+ s.push(h);
+ while (!s.empty()) {
+ h = s.pop();
+ l = s.pop();
+ int pivotIndex = partition(arr, l, h);
+ if (pivotIndex - 1 > l) {
+ s.push(l);
+ s.push(pivotIndex - 1);
+ }
+ if (pivotIndex + 1 < h) {
+ s.push(pivotIndex + 1);
+ s.push(h);
+ }
+ }
+ }
+
+ // A utility function to print contents of arr
+ void printArr(int arr[], int n)
+ {
+ int i;
+ for (i = 0; i < n; ++i)
+ System.out.print(arr[i] + " ");
+ }
+
+ // Driver code to test above
+ public static void main(String args[])
+ {
+ IterativeQuickSort ob = new IterativeQuickSort();
+ int arr[] = { 4, 3, 5, 2, 1, 3, 2, 3 };
+ ob.QuickSort(arr, 0, arr.length - 1);
+ ob.printArr(arr, arr.length);
+ }
+}
\ No newline at end of file
diff --git a/PreCourse-2.iml b/PreCourse-2.iml
new file mode 100644
index 00000000..b107a2dd
--- /dev/null
+++ b/PreCourse-2.iml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/out/production/PreCourse-2/.idea/.gitignore b/out/production/PreCourse-2/.idea/.gitignore
new file mode 100644
index 00000000..13566b81
--- /dev/null
+++ b/out/production/PreCourse-2/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/out/production/PreCourse-2/.idea/misc.xml b/out/production/PreCourse-2/.idea/misc.xml
new file mode 100644
index 00000000..bcb5da6c
--- /dev/null
+++ b/out/production/PreCourse-2/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/out/production/PreCourse-2/.idea/modules.xml b/out/production/PreCourse-2/.idea/modules.xml
new file mode 100644
index 00000000..1039bae9
--- /dev/null
+++ b/out/production/PreCourse-2/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/out/production/PreCourse-2/.idea/vcs.xml b/out/production/PreCourse-2/.idea/vcs.xml
new file mode 100644
index 00000000..35eb1ddf
--- /dev/null
+++ b/out/production/PreCourse-2/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/out/production/PreCourse-2/BinarySearch.class b/out/production/PreCourse-2/BinarySearch.class
new file mode 100644
index 00000000..893ba352
Binary files /dev/null and b/out/production/PreCourse-2/BinarySearch.class differ
diff --git a/out/production/PreCourse-2/Exercise_1.cpp b/out/production/PreCourse-2/Exercise_1.cpp
new file mode 100644
index 00000000..a6dc14cc
--- /dev/null
+++ b/out/production/PreCourse-2/Exercise_1.cpp
@@ -0,0 +1,21 @@
+#include
+
+// A recursive binary search function. It returns
+// location of x in given array arr[l..r] is present,
+// otherwise -1
+int binarySearch(int arr[], int l, int r, int x)
+{
+ //Your Code here
+}
+
+int main(void)
+{
+ int arr[] = { 2, 3, 4, 10, 40 };
+ int n = sizeof(arr) / sizeof(arr[0]);
+ int x = 10;
+ int result = binarySearch(arr, 0, n - 1, x);
+ (result == -1) ? printf("Element is not present in array")
+ : printf("Element is present at index %d",
+ result);
+ return 0;
+}
\ No newline at end of file
diff --git a/out/production/PreCourse-2/Exercise_1.js b/out/production/PreCourse-2/Exercise_1.js
new file mode 100644
index 00000000..89d853ec
--- /dev/null
+++ b/out/production/PreCourse-2/Exercise_1.js
@@ -0,0 +1,16 @@
+class BinarySearch {
+ // Returns index of x if it is present in arr[l.. r], else return -1
+ function binarySearch(arr, l, r, x) {
+
+ }
+}
+// Driver method to test above
+const ob = new BinarySearch();
+const arr = [2, 3, 4, 10, 40];
+const n = arr.length;
+const x = 10;
+const result = ob.binarySearch(arr, 0, n - 1, x);
+if (result === -1)
+ console.log("Element not present");
+else
+ console.log("Element found at index " + result);
diff --git a/out/production/PreCourse-2/Exercise_1.py b/out/production/PreCourse-2/Exercise_1.py
new file mode 100644
index 00000000..3e6adcf4
--- /dev/null
+++ b/out/production/PreCourse-2/Exercise_1.py
@@ -0,0 +1,22 @@
+# Python code to implement iterative Binary
+# Search.
+
+# It returns location of x in given array arr
+# if present, else returns -1
+def binarySearch(arr, l, r, x):
+
+ #write your code here
+
+
+
+# Test array
+arr = [ 2, 3, 4, 10, 40 ]
+x = 10
+
+# Function call
+result = binarySearch(arr, 0, len(arr)-1, x)
+
+if result != -1:
+ print "Element is present at index % d" % result
+else:
+ print "Element is not present in array"
diff --git a/out/production/PreCourse-2/Exercise_2.cpp b/out/production/PreCourse-2/Exercise_2.cpp
new file mode 100644
index 00000000..c90e577e
--- /dev/null
+++ b/out/production/PreCourse-2/Exercise_2.cpp
@@ -0,0 +1,47 @@
+#include
+using namespace std;
+
+// A utility function to swap two elements
+void swap(int* a, int* b)
+{
+ //Your Code here
+}
+
+/* This function takes last element as pivot, places
+the pivot element at its correct position in sorted
+array, and places all smaller (smaller than pivot)
+to left of pivot and all greater elements to right
+of pivot */
+int partition (int arr[], int low, int high)
+{
+ //Your Code here
+}
+
+/* The main function that implements QuickSort
+arr[] --> Array to be sorted,
+low --> Starting index,
+high --> Ending index */
+void quickSort(int arr[], int low, int high)
+{
+ //Your Code here
+}
+
+/* Function to print an array */
+void printArray(int arr[], int size)
+{
+ int i;
+ for (i = 0; i < size; i++)
+ cout << arr[i] << " ";
+ cout << endl;
+}
+
+// Driver Code
+int main()
+{
+ int arr[] = {10, 7, 8, 9, 1, 5};
+ int n = sizeof(arr) / sizeof(arr[0]);
+ quickSort(arr, 0, n - 1);
+ cout << "Sorted array: \n";
+ printArray(arr, n);
+ return 0;
+}
\ No newline at end of file
diff --git a/out/production/PreCourse-2/Exercise_2.js b/out/production/PreCourse-2/Exercise_2.js
new file mode 100644
index 00000000..352e36cd
--- /dev/null
+++ b/out/production/PreCourse-2/Exercise_2.js
@@ -0,0 +1,41 @@
+class QuickSort {
+
+ /* This function takes last element as pivot,
+ places the pivot element at its correct
+ position in sorted array, and places all
+ smaller (smaller than pivot) to left of
+ pivot and all greater elements to right
+ of pivot */
+
+ function swap(arr, i, j) {
+ //Your code here
+ }
+
+ function partition(arr, low, high) {
+ //Write code here for Partition and Swap
+ }
+
+ /* The main function that implements QuickSort()
+ arr[] --> Array to be sorted,
+ low --> Starting index,
+ high --> Ending index */
+ function sort(arr, low, high) {
+ // Recursively sort elements before
+ // partition and after partition
+ }
+
+ /* A utility function to print array of size n */
+ function printArray(arr) {
+ let n = arr.length;
+ for (let i = 0; i < n; ++i)
+ console.log(arr[i] + " ");
+ console.log();
+ }
+}
+ // Driver program
+ let arr = [10, 7, 8, 9, 1, 5];
+ let n = arr.length;
+ let ob = new QuickSort();
+ ob.sort(arr, 0, n - 1);
+ console.log("sorted array");
+ ob.printArray(arr);
diff --git a/out/production/PreCourse-2/Exercise_2.py b/out/production/PreCourse-2/Exercise_2.py
new file mode 100644
index 00000000..35abf0dd
--- /dev/null
+++ b/out/production/PreCourse-2/Exercise_2.py
@@ -0,0 +1,23 @@
+# Python program for implementation of Quicksort Sort
+
+# give you explanation for the approach
+def partition(arr,low,high):
+
+
+ #write your code here
+
+
+# Function to do Quick sort
+def quickSort(arr,low,high):
+
+ #write your code here
+
+# Driver code to test above
+arr = [10, 7, 8, 9, 1, 5]
+n = len(arr)
+quickSort(arr,0,n-1)
+print ("Sorted array is:")
+for i in range(n):
+ print ("%d" %arr[i]),
+
+
diff --git a/out/production/PreCourse-2/Exercise_3.cpp b/out/production/PreCourse-2/Exercise_3.cpp
new file mode 100644
index 00000000..209ce0fe
--- /dev/null
+++ b/out/production/PreCourse-2/Exercise_3.cpp
@@ -0,0 +1,50 @@
+#include
+using namespace std;
+
+// Struct
+struct Node
+{
+ int data;
+ struct Node* next;
+};
+
+/* Function to get the middle of the linked list*/
+void printMiddle(struct Node *head)
+{
+ //YourCode here
+ //Use fast and slow pointer technique
+}
+
+// Function to add a new node
+void push(struct Node** head_ref, int new_data)
+{
+ struct Node* new_node = new Node;
+ new_node->data = new_data;
+ new_node->next = (*head_ref);
+ (*head_ref) = new_node;
+}
+
+// A utility function to print a given linked list
+void printList(struct Node *ptr)
+{
+ while (ptr != NULL)
+ {
+ printf("%d->", ptr->data);
+ ptr = ptr->next;
+ }
+ printf("NULL\n");
+}
+
+// Driver Code
+int main()
+{
+ struct Node* head = NULL;
+ for (int i=15; i>0; i--)
+ {
+ push(&head, i);
+ printList(head);
+ printMiddle(head);
+ }
+
+ return 0;
+}
\ No newline at end of file
diff --git a/out/production/PreCourse-2/Exercise_3.js b/out/production/PreCourse-2/Exercise_3.js
new file mode 100644
index 00000000..4c1eabdd
--- /dev/null
+++ b/out/production/PreCourse-2/Exercise_3.js
@@ -0,0 +1,43 @@
+class LinkedList {
+ constructor() {
+ this.head = null; // head of linked list
+ }
+
+ /* Linked list node */
+ static Node = class {
+ constructor(d) {
+ //Constructor here
+ this.data = d;
+ this.next = null;
+ }
+ }
+
+ /* Function to print middle of linked list */
+ //Complete this function
+ function printMiddle() {
+ //Write your code here
+ //Implement using Fast and slow pointers
+ }
+
+ function push(new_data) {
+ let new_node = new this.Node(new_data);
+ new_node.next = this.head;
+ this.head = new_node;
+ }
+
+ function printList() {
+ let tnode = this.head;
+ while (tnode != null) {
+ console.log(tnode.data + "->");
+ tnode = tnode.next;
+ }
+ console.log("NULL");
+ }
+}
+
+let llist = new LinkedList();
+for (let i = 15; i > 0; --i) {
+ llist.push(i);
+ llist.printList();
+ llist.printMiddle();
+}
diff --git a/out/production/PreCourse-2/Exercise_3.py b/out/production/PreCourse-2/Exercise_3.py
new file mode 100644
index 00000000..a26a69b8
--- /dev/null
+++ b/out/production/PreCourse-2/Exercise_3.py
@@ -0,0 +1,26 @@
+# Node class
+class Node:
+
+ # Function to initialise the node object
+ def __init__(self, data):
+
+class LinkedList:
+
+ def __init__(self):
+
+
+ def push(self, new_data):
+
+
+ # Function to get the middle of
+ # the linked list
+ def printMiddle(self):
+
+# Driver code
+list1 = LinkedList()
+list1.push(5)
+list1.push(4)
+list1.push(2)
+list1.push(3)
+list1.push(1)
+list1.printMiddle()
diff --git a/out/production/PreCourse-2/Exercise_4.cpp b/out/production/PreCourse-2/Exercise_4.cpp
new file mode 100644
index 00000000..1a528ee6
--- /dev/null
+++ b/out/production/PreCourse-2/Exercise_4.cpp
@@ -0,0 +1,43 @@
+#include
+#include
+
+// Merges two subarrays of arr[].
+// First subarray is arr[l..m]
+// Second subarray is arr[m+1..r]
+void merge(int arr[], int l, int m, int r)
+{
+ //Your code here
+}
+
+/* l is for left index and r is right index of the
+ sub-array of arr to be sorted */
+void mergeSort(int arr[], int l, int r)
+{
+ //Your code here
+}
+
+/* UTILITY FUNCTIONS */
+/* Function to print an array */
+void printArray(int A[], int size)
+{
+ int i;
+ for (i=0; i < size; i++)
+ printf("%d ", A[i]);
+ printf("\n");
+}
+
+/* Driver program to test above functions */
+int main()
+{
+ int arr[] = {12, 11, 13, 5, 6, 7};
+ int arr_size = sizeof(arr)/sizeof(arr[0]);
+
+ printf("Given array is \n");
+ printArray(arr, arr_size);
+
+ mergeSort(arr, 0, arr_size - 1);
+
+ printf("\nSorted array is \n");
+ printArray(arr, arr_size);
+ return 0;
+}
\ No newline at end of file
diff --git a/out/production/PreCourse-2/Exercise_4.js b/out/production/PreCourse-2/Exercise_4.js
new file mode 100644
index 00000000..58779757
--- /dev/null
+++ b/out/production/PreCourse-2/Exercise_4.js
@@ -0,0 +1,34 @@
+class MergeSort {
+ // Merges two subarrays of arr[].
+ // First subarray is arr[l..m]
+ // Second subarray is arr[m+1..r]
+ function merge(arr, l, m, r) {
+ //Your code here
+ }
+
+ // Main function that sorts arr[l..r] using
+ // merge()
+ function sort(arr, l, r) {
+ //Write your code here
+ //Call mergeSort from here
+ }
+
+ /* A utility function to print array of size n */
+ function printArray(arr) {
+ let n = arr.length;
+ for (let i = 0; i < n; ++i)
+ console.log(arr[i] + " ");
+ console.log();
+ }
+}
+ // Driver method
+ let arr = [12, 11, 13, 5, 6, 7];
+ console.log("Given Array");
+ let ob = new MergeSort();
+ ob.printArray(arr);
+ ob.sort(arr, 0, arr.length - 1);
+ console.log("\nSorted array");
+ ob.printArray(arr);
+
+
+
diff --git a/out/production/PreCourse-2/Exercise_4.py b/out/production/PreCourse-2/Exercise_4.py
new file mode 100644
index 00000000..9bc25d3d
--- /dev/null
+++ b/out/production/PreCourse-2/Exercise_4.py
@@ -0,0 +1,18 @@
+# Python program for implementation of MergeSort
+def mergeSort(arr):
+
+ #write your code here
+
+# Code to print the list
+def printList(arr):
+
+ #write your code here
+
+# driver code to test the above code
+if __name__ == '__main__':
+ arr = [12, 11, 13, 5, 6, 7]
+ print ("Given array is", end="\n")
+ printList(arr)
+ mergeSort(arr)
+ print("Sorted array is: ", end="\n")
+ printList(arr)
diff --git a/out/production/PreCourse-2/Exercise_5.cpp b/out/production/PreCourse-2/Exercise_5.cpp
new file mode 100644
index 00000000..a07c2bf6
--- /dev/null
+++ b/out/production/PreCourse-2/Exercise_5.cpp
@@ -0,0 +1,42 @@
+#include
+using namespace std;
+
+// A utility function to swap two elements
+void swap(int* a, int* b)
+{
+ int t = *a;
+ *a = *b;
+ *b = t;
+}
+
+/* This function is same in both iterative and recursive*/
+int partition(int arr[], int l, int h)
+{
+ //Do the comparison and swapping here
+}
+
+/* A[] --> Array to be sorted,
+l --> Starting index,
+h --> Ending index */
+void quickSortIterative(int arr[], int l, int h)
+{
+ //Try to think that how you can use stack here to remove recursion.
+}
+
+// A utility function to print contents of arr
+void printArr(int arr[], int n)
+{
+ int i;
+ for (i = 0; i < n; ++i)
+ cout << arr[i] << " ";
+}
+
+// Driver code
+int main()
+{
+ int arr[] = { 4, 3, 5, 2, 1, 3, 2, 3 };
+ int n = sizeof(arr) / sizeof(*arr);
+ quickSortIterative(arr, 0, n - 1);
+ printArr(arr, n);
+ return 0;
+}
\ No newline at end of file
diff --git a/out/production/PreCourse-2/Exercise_5.js b/out/production/PreCourse-2/Exercise_5.js
new file mode 100644
index 00000000..01fb9e63
--- /dev/null
+++ b/out/production/PreCourse-2/Exercise_5.js
@@ -0,0 +1,36 @@
+class IterativeQuickSort {
+
+ function swap(arr, i, j) {
+
+ //Try swapping without extra variable
+
+ }
+
+ /* This function is same in both iterative and
+ recursive*/
+ function partition(arr, l, h) {
+
+ //Compare elements and swap.
+
+ }
+
+ // Sorts arr[l..h] using iterative QuickSort
+ function QuickSort(arr, l, h) {
+
+ //Try using Stack Data Structure to remove recursion.
+
+ }
+
+ // A utility function to print contents of arr
+ function printArr(arr, n) {
+ let i;
+ for (i = 0; i < n; ++i)
+ console.log(arr[i] + " ");
+ }
+}
+
+ // Driver code to test above
+let ob = new IterativeQuickSort();
+let arr = [4, 3, 5, 2, 1, 3, 2, 3];
+ob.QuickSort(arr, 0, arr.length - 1);
+ob.printArr(arr, arr.length);
diff --git a/out/production/PreCourse-2/Exercise_5.py b/out/production/PreCourse-2/Exercise_5.py
new file mode 100644
index 00000000..1da24ffb
--- /dev/null
+++ b/out/production/PreCourse-2/Exercise_5.py
@@ -0,0 +1,10 @@
+# Python program for implementation of Quicksort
+
+# This function is same in both iterative and recursive
+def partition(arr, l, h):
+ #write your code here
+
+
+def quickSortIterative(arr, l, h):
+ #write your code here
+
diff --git a/out/production/PreCourse-2/IterativeQuickSort.class b/out/production/PreCourse-2/IterativeQuickSort.class
new file mode 100644
index 00000000..d3402114
Binary files /dev/null and b/out/production/PreCourse-2/IterativeQuickSort.class differ
diff --git a/out/production/PreCourse-2/LinkedList$Node.class b/out/production/PreCourse-2/LinkedList$Node.class
new file mode 100644
index 00000000..44b76e6e
Binary files /dev/null and b/out/production/PreCourse-2/LinkedList$Node.class differ
diff --git a/out/production/PreCourse-2/LinkedList.class b/out/production/PreCourse-2/LinkedList.class
new file mode 100644
index 00000000..81fcfde2
Binary files /dev/null and b/out/production/PreCourse-2/LinkedList.class differ
diff --git a/out/production/PreCourse-2/MergeSort.class b/out/production/PreCourse-2/MergeSort.class
new file mode 100644
index 00000000..4da26ee7
Binary files /dev/null and b/out/production/PreCourse-2/MergeSort.class differ
diff --git a/out/production/PreCourse-2/PreCourse-2.iml b/out/production/PreCourse-2/PreCourse-2.iml
new file mode 100644
index 00000000..b107a2dd
--- /dev/null
+++ b/out/production/PreCourse-2/PreCourse-2.iml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/out/production/PreCourse-2/QuickSort.class b/out/production/PreCourse-2/QuickSort.class
new file mode 100644
index 00000000..b1f207dc
Binary files /dev/null and b/out/production/PreCourse-2/QuickSort.class differ
diff --git a/out/production/PreCourse-2/README.md b/out/production/PreCourse-2/README.md
new file mode 100644
index 00000000..b9d9bee5
--- /dev/null
+++ b/out/production/PreCourse-2/README.md
@@ -0,0 +1,15 @@
+# PreCourse_2
+
+# All Instructions are already provided in the respective files.
+
+Exercise_1 : Binary Search.
+
+Exercise_2 : Quick sort.
+
+Exercise_3 : Find Mid Point of a Singly Linked List.
+
+Exercise_4 : Merge Sort.
+
+Exercise_5 : Iterative Quick Sort.
+
+*After completing the project kindly submit a pull request*