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> | |
#include <stdlib.h> | |
#include <pthread.h> | |
#include <unistd.h> | |
#include <semaphore.h> | |
sem_t semaphore; | |
void threadfunc() { |
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 static Boolean powerCheck(int a) { | |
return a!=0 && (a & a-1) == 0; | |
} | |
public static Boolean recursivePowerCheck(int a){ | |
if (a == 1) return true; | |
if (a == 0 || a % 2 != 0) return false; | |
return recursivePowerCheck(a/2); | |
} |
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
function[r,l] = kmyself(dataSet, k) | |
% Determine the size of dataSet | |
[nRow, nCol] = size(dataSet); | |
% Empty array for cluster assesment | |
clusterAssment = zeros(nRow,2); | |
% Setup centroid and choose on to start of with | |
centroids = zeros(k,nCol); |
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
function main() | |
% LOAD IRIS | |
% dataset was modified by changing the class name from string to a | |
% number | |
iris = load('iris.csv', ','); | |
% LOAD SONAR | |
sonar = load('sonar.csv', ','); |
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
function sort(array) { | |
var len = array.length; | |
if (len <= 1) { | |
return array; | |
} | |
var middle = Math.floor(len*0.5); | |
var left = array.slice(0,middle); | |
var right = array.slice(middle, len); |
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
function sort(array) { | |
var len = array.length; | |
var middle = Math.floor(len*0.5); | |
var left = array.slice(0,middle); | |
var right = array.slice(middle, len); | |
if (len == 1) { | |
return array; | |
} else { | |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
function quickSort(array, start, end) { |
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.*; | |
import java.util.*; | |
public class Main { | |
private static Stack[] Blocks; | |
private static PrintWriter out; | |
public static void main(String[] args) throws Exception { |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<div id="ex"></div> | |
<script id="jsbin-javascript"> | |
function qsort(ls){ |
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.*; | |
import java.util.*; | |
public class Main { | |
private static Stack[] Blocks; | |
private static PrintWriter out; | |
public static void main(String[] args) throws Exception { |
NewerOlder