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.applet.Applet; | |
import java.awt.*; | |
import java.awt.event.*; | |
public class PongGame extends Applet implements Runnable { | |
Thread th; | |
boolean rbup = false; | |
boolean rbdown = false; | |
boolean lbup = 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
import java.awt.*; | |
import java.applet.*; | |
import java.awt.image.*; | |
public class PixeloMatic extends Applet implements Runnable { | |
int pixl2[] = new int[256]; | |
Thread t = null; | |
final int width=500, height=500; | |
Image buffer = null; |
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<string.h> | |
int max(int a, int b) { | |
return a > b ? a : b; | |
}//end max() | |
int main() { | |
char a[] = "train"; | |
char b[] = "rain"; |
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> | |
int max(int a, int b) | |
{ | |
return (a > b)? a : b; | |
} | |
/* Returns length of LCS for X[0..m-1], Y[0..n-1] */ | |
int lcs( char *X, char *Y, int m, int n ) | |
{ |
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> | |
char a[10][10]; | |
int n = 4; | |
void printmatrix() { | |
int i, j; | |
printf("\n"); | |
for (i = 0; i < n; i++) { | |
for (j = 0; j < n; 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 <stdio.h> | |
#include <stdlib.h> | |
int w[10], p[10], v[10][10], n, i, j, capacity, x[10] = {0}; | |
int max(int i, int j) { | |
return ((i > j) ? i : j); | |
} | |
int KnapSack(int i, int 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
import java.util.Scanner; | |
public class SelectionSort { | |
private static void swap(Comparable[] a, int i, int j) { | |
Comparable t = a[i]; | |
a[i] = a[j]; | |
a[j] = t; | |
} |
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.util.Scanner; | |
public class BubbleSort { | |
private static void swap(Comparable[] a, int i, int j) { | |
Comparable t = a[i]; | |
a[i] = a[j]; | |
a[j] = t; | |
} |
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.util.Scanner; | |
public class InsertionSort { | |
private static void swap(Comparable[] a, int i, int j) { | |
Comparable t = a[i]; | |
a[i] = a[j]; | |
a[j] = t; | |
} |
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
package Sorts; | |
public class GnomeSort { | |
private static void gnomeSort(int[] ar) { | |
int i = 1; | |
int n = ar.length; | |
while (i < n) { | |
if (i == 0 || ar[i - 1] <= ar[i]) { | |
i++; |
OlderNewer