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
boolean solve(configuration conf) { | |
if (no more choices) | |
return (conf is goal state); | |
for (all available choices) { | |
try one choice c; | |
ok = solve(conf with choice c made); | |
if (ok) | |
return true; | |
else | |
unmake choice c; |
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
private static void recPermute(String soFar, String rest) { | |
if (rest.equals( "" )) { | |
System.out.println( soFar ); | |
} else { | |
for (int i = 0; i < rest.length(); i++) { | |
String next = soFar + rest.charAt(i); | |
String remaining = rest.substring(0, i) + rest.substring(i+1); | |
recPermute(next, remaining); | |
} | |
} |
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
private static void recSubsets(String soFar, String rest) { | |
if (rest.equals("")) { | |
System.out.println(soFar); | |
} else { | |
recSubsets(soFar + rest.charAt(0), rest.substring(1)); | |
recSubsets(soFar, rest.substring(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
void MergeSort(Vector<int> &v){ | |
if (v.size() > 1) { | |
int n1 = v.size()/2; | |
int n2 = v.size() - n1; | |
Vector<int> left = Copy(v, 0, n1); Vector<int> right = Copy(v, n1, n2); MergeSort(left); | |
MergeSort(right); | |
Merge(v, left, right); | |
} | |
} |
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
void Quicksort(Vector<int> &v, int start, int stop) { | |
if(stop > start) { | |
int pivot = Partition(v, start, stop); | |
Quicksort(v, start, pivot-1); | |
Quicksort(v, pivot+1, stop); | |
} | |
} |
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
// init vector | |
vector <int> myVec(10); | |
//size of vector | |
int vSize = myVec.size(); | |
// access to element n | |
myVec[0] = 1; // no buffer checking | |
myVec.at(1) = 2; | |
// resize vector | |
myVec.push_back(11); // extends vector by 1 and give it value of parameter | |
myVec.resize(myVec.size()+1); // extends vector by 1 and initializes last element with 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
var gulp = require('gulp'), | |
gutil = require('gulp-util'), | |
sass = require('gulp-sass'), | |
concat = require('gulp-concat'), | |
connect = require('gulp-connect'); | |
gulp.task('sass', function () { | |
gulp.src('./scss/*.scss') | |
.pipe(sass({errLogToConsole: true})) | |
.pipe(gulp.dest('./css/tmp/')) |
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
xcode-select --install |
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
var serialport = require("serialport"); | |
var SerialPort = serialport.SerialPort; | |
var port = "/dev/tty.usbmodem1411"; | |
var sp = new SerialPort(port, { | |
parser: serialport.parsers.readline("\n") | |
}); | |
sp.on("data", function (data) { | |
console.log(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
defaults write com.apple.desktopservices DSDontWriteNetworkStores true |
OlderNewer