This file contains 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
public class Stack { | |
static final int max = 5; | |
int[] stack = new int[max]; | |
int top; | |
Stack(){ | |
top = 0; | |
This file contains 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
public class QuickSortTest { | |
public static final int max = 10; | |
public static void main(String[] args){ | |
int[] toSortArray = new int[max]; | |
for(int i = 0; i < max; i++){ | |
This file contains 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
public class bubbleSort { | |
private static final int max = 10; | |
public static void main(String[] args){ | |
int[] array = new int[max]; | |
System.out.println("The array to be sorted is"); | |
for(int i = 0; i < max; i++){ | |
This file contains 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
#include <iostream> | |
#include <cmath> | |
using namespace std; | |
int z = 0; | |
int interpolation(int arr[], int left, int right, int key){ | |
int low = left; | |
int high = right - 1; |
This file contains 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
''' | |
Rotating the Linked List | |
1. Convert the Linked List into a Circular Linked List | |
by joining the last node with the root. | |
2. Move the root the amount of positions needed to be | |
changed | |
3. Disconnect the last element counting the length from | |
the new root. | |
''' |
This file contains 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
#include <iostream> | |
#include <cstring> | |
using namespace std; | |
// brute force the entire thing. | |
char* getSubstring(char c[], int starting, int ending){ | |
int length = ending - starting + 1; | |
int temp = length; |
This file contains 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
#include <iostream> | |
using namespace std; | |
int getPosition(int key, int searchSpace[], int length){ | |
for(int i = 0; i < length; i++){ | |
if(searchSpace[i] == key){ | |
return i; |
This file contains 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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
// arguments int limit, int windowShift | |
int getRandomNumber(int limit, int windowShifter){ | |
return ( rand() % limit ) + windowShifter; | |
} | |
// Should be done in parallel. |
This file contains 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
class Node{ | |
int data; | |
Node right; | |
Node left; | |
static int noOfNodes = 0; | |
Node(int data){ | |
this.data = data; |
This file contains 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
#include <iostream> | |
#include <cmath> | |
using namespace std; | |
int BinarySearch(int L[], int left, int right, int key){ | |
if(right - left > 0){ | |
int mid = (left + right) / 2; |