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
import random | |
matrix = [[0 for x in xrange(5)] for x in xrange(5)] | |
visited = [[0 for x in xrange(5)] for x in xrange(5)] | |
def printMatrix(toPrint): | |
for x in range (0, 5): | |
for y in range (0, 5): | |
print toPrint[x][y], | |
def RecursiveLoop(a, b): | |
coorD = 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
def cartesianProduct(setA, setB): | |
if len(setA) == 0: | |
return None | |
if len(setB) == 0: | |
return None | |
product = [] | |
for elementA in setA: |
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
def main(): | |
count = int(raw_input("How many numbers do you want to print?")) | |
if count == 0: | |
print "No Numbers Printed" | |
else: | |
a = 0 | |
b = 1 | |
print a, | |
if count > 1: | |
print b, |
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 Main { | |
/* Static variable which acts as the pointer for the postOrder list */ | |
static int preIndex = 5; | |
public static void main(String[] args) { | |
/* InOrder Array */ | |
char[] inOrder = { 'D', 'B', 'E', 'A', 'F', 'C' }; | |
/* PostOrder Array */ |
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 SelectionSort { | |
public static final int max = 10; | |
public static void main(String[] args){ | |
int[] toSortArray = new int[max]; | |
int min=999; | |
int minIndex = 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 Queue { | |
//initialize | |
//enqueue | |
//dequeue | |
//empty | |
//adjustQueue | |
static final int max = 10; |
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
import random | |
#the sort function | |
def sort(array): | |
#the length of the array | |
length = len(array) | |
#for loop which ranges from | |
#1 to the length of the array | |
#this loop is to cover each and | |
#every number and ensure its |
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
/*Import house keeping stuff that we need to connect with the Database*/ | |
import java.sql.*; | |
/*Import Scanner Class so as to take input from the user*/ | |
import java.util.Scanner; | |
public class Main { | |
static Connection connection; | |
static Scanner scan; | |
static Statement statement; |
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 Main { | |
/*Static variable which acts as the pointer for the preorder list*/ | |
static int preIndex = 0; | |
public static void main(String[] args) { | |
/*Inorder Array*/ | |
char[] inOrder = { 'D', 'B', 'E', 'A', 'F', 'C' }; | |
/*Preorder Array*/ |