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 java.io.File; | |
import java.io.FileNotFoundException; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.Scanner; | |
import java.util.Vector; | |
public class Main { | |
public static Vector<String> f1 = new Vector<>(); |
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
<?xml version="1.0" encoding="UTF-8" ?> | |
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo"> | |
<Properties> | |
<Property name="defaultCloseOperation" type="int" value="3"/> | |
<Property name="title" type="java.lang.String" value="Discreet"/> | |
</Properties> | |
<SyntheticProperties> | |
<SyntheticProperty name="formSizePolicy" type="int" value="1"/> | |
<SyntheticProperty name="generateCenter" type="boolean" value="false"/> |
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 { | |
public static void main(String[] args) { | |
String[][] transitions = {{"qs", "1", "qs", "1", "r"},{"qs", "_", "q0", "_", "l"},{"qs", "0", "qa", "0", "r"}}; | |
String tape = "111111100000000011", startState = "qs"; | |
for (int headPosition = 0; !(startState.equals(("qa"))) && !(startState.equals("qr")); ) { | |
String[] tmpTransition = null; | |
for (int i = 0; i < transitions.length; i++) | |
if (transitions[i][1].contains("" + tape.charAt(headPosition))) | |
if (transitions[i][0].contains(startState)) | |
tmpTransition = transitions[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> | |
using namespace std; | |
void selectionSort() { | |
int arr[] = {1,5,9,8,9,4,7,5,6,3,1,7}; | |
int size=12; | |
int i, j, min; | |
for (i = 0; i < size-1; i++) { | |
min = i; | |
for (j = i + 1; j < size; j++) |
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; | |
void merge(int arr[], int l, int m, int r) | |
{ | |
int i, j, k; | |
int n1 = m - l + 1; | |
int n2 = r - m; | |
int L[n1], R[n2]; |
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; | |
void insertionSort() { | |
int arr[] = {1,5,9,8,9,4,7,5,6,3,1,7}; | |
int size=12; | |
int i,j; | |
for (i = 1; i < size; i++) | |
{ | |
for (j = i; j >= 1; j--) |
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; | |
void binarysearch(int target) | |
{ | |
int arr[] = {1 ,1 ,3 ,4 ,5 ,5 ,6 ,7 ,7 ,8 ,9 ,9}; | |
int size=12; | |
int f,l,mid,c; | |
f=0,l=size-1; | |
while(f<=l) |
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; | |
void linearSearch(int target){ | |
int arr[] = {1,5,9,8,9,4,7,5,6,3,1,7}; | |
int size=12; | |
for (int i = 0; i < size; i++) { | |
if(target == arr[i]){ | |
cout<<endl<<"found at :"<<i; | |
return; |
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; | |
// Complexity is O(r*c) r : row : column | |
int main() { | |
int j,i,r,c; | |
r=3;c=3; | |
int mat[r][c] = {{1,2,3}, | |
{4,5,6}, | |
{7,8,9}}; | |
for(i=0;i<r;i++){ // r+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
import java.io.File; | |
import java.io.FileNotFoundException; | |
import java.util.Scanner; | |
public class Main { | |
public static boolean ReadFromFile = true; // do you wanna read from file | |
public static boolean displaced = true; // displaced or manhattan | |
public static int dimensions; | |
static int start[][], goal[][]; |
OlderNewer