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 numpy as np | |
import scipy.io | |
import matplotlib.pyplot as pl | |
class Classifier ( object ): | |
def __init__ ( self ): | |
self.params = [ 'logpi', 'logtheta' ] | |
def fit (self , X, y): |
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 sudoku; | |
import java.util.ArrayList ; | |
import java.util.HashSet ; | |
import java.util.Iterator; | |
import java.util.LinkedList; | |
import java.util.Random ; | |
/** | |
* Place for your code. | |
*/ | |
public class RobustSudokuSolver { |
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 "topK.hpp" | |
using namespace std; | |
int main(){ | |
int xx[] ={124,34,324,54,6,645,33,43}; | |
vector<int> x(begin(xx), end(xx)); | |
int k = 5; | |
heapK<int> hpk(k); |
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> | |
#include <thread> | |
#include <string> | |
#include <vector> | |
using namespace std; | |
// This KMP algorithm is described, explained and written out at | |
// http://www.inf.fh-flensburg.de/lang/algorithmen/pattern/kmpen.htm | |
void preprocess( string pattern, vector<int> &b ){ | |
int m = pattern.length(); |
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 <vector> | |
#include <iostream> | |
using namespace std; | |
int get_parent(int i){ | |
if( i < 1 ) return 0; | |
return ( (i-1) / 2); | |
} | |
int get_left(int parent){ |
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 prob8(){ | |
for( int c = 1; c <= 1000; c++ ){ | |
for( int b = 1; b < c; b++){ | |
for( int a = 1; a < b; a++){ | |
if ( (a + b + c == 1000 ) && | |
(pow(a,2) + pow(b,2) == pow(c,2))) | |
std::cout << a << " " << b << " " << c << " " << a*b*c << std::endl; | |
} | |
} | |
} |
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 <vector> | |
#include <stdint.h> | |
#include <iostream> | |
template <typename Iterator> | |
inline bool next_combination(const Iterator first, Iterator k, const Iterator last) | |
{ | |
/* Credits: Thomas Draper */ | |
if ((first == last) || (first == k) || (last == k)) | |
return 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
void main(){ | |
// 5-choose-3 | |
std::size_t n =184; | |
std::size_t k = 3; | |
std::string s = "hello"; | |
std::string s2 = "llo"; | |
std::vector<std::vector<int>> lcs(s.length()+1, std::vector<int>(s2.length()+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
#include <vector> | |
#include <iostream> | |
using namespace std; | |
void main(){ | |
int x[] = { 1, -4 ,4 ,3 , -2 ,-3, 2 ,1 }; | |
vector<int> s(begin(x), end(x)); | |
int max_so_far = 0, begin_so_far =0, max = 0, begin = 0, end =0; | |
int temp; | |
for(int i = 0; i < s.size(); ++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 <vector> | |
#include <iostream> | |
#include <random> | |
#include <time.h> | |
#include <queue> | |
using namespace std; | |
class Node{ | |
public: | |
Node():data(0),left(nullptr),right(nullptr),parent(nullptr) {} |
OlderNewer