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> | |
#include <stdint.h> | |
#ifdef _MSC_VER | |
#include <intrin.h> | |
#pragma optimize("gt",on) | |
#else | |
#include <x86intrin.h> | |
#endif | |
/* for rdtscp and clflush */ |
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 math | |
from labs.lab2 import runge | |
def f(x, y): | |
# return y * math.log(y) / x | |
return (y * y + x * y) / (x * x) | |
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 com.skhokhlov; | |
public class Main { | |
public static void main(String[] args) { | |
double[][] matrix = { | |
{15, 3, -5, -5, 36}, | |
{7, -15, -6, 1, -112}, | |
{-4, 7, 19, 6, 19}, | |
{3, 0, -5, 8, -23} |
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
'use strict'; | |
const X = [0.1, 0.5, 0.9, 1.3, 1.7]; | |
const Y = [-2.3026, -0.69315, -0.10536, 0.26236, 0.53063]; | |
const x = 0.8; | |
// const n = 3; | |
// var splines = new Array(X.length).fill({a:null,b:null,c:null,d:null,x:null}); | |
var splines = []; | |
for (let i =0; i < X.length; i++){ | |
splines.push({a:null,b:null,c:null,d:null,x: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
int main() { | |
const int lens = 11; | |
char source[lens] = {'e', 'e', 's', 't', ' ', 't', 't', 'l', 'i', 'n', 'g'}; | |
const int lenp = 2; | |
char p[lenp] = {'t', 't'}; | |
int i, j; | |
int d[lenp]; | |
int res[lenp]; | |
int resi = 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
object FordFulkerson { | |
val capacity = Array( | |
Array(0, 1, 0), | |
Array(0, 0, 2), | |
Array(0, 0, 0) | |
) | |
def main(args: Array[String]): Unit = { | |
println(maxFlow(0, 2)) | |
println(capacity.deep.mkString("\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
import java.util.Arrays; | |
class MaxFlowFordFulkerson { | |
static int[][] capacity = { { 0, 3, 2 }, { 0, 0, 2 }, { 0, 0, 0 } }; | |
public static int maxFlow(int s, int t) { | |
for (int flow = 0;;) { | |
int df = findPath(new boolean[capacity.length], s, t, Integer.MAX_VALUE); | |
if (df == 0) { | |
return flow; |
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
'use strict'; | |
var fs = require('fs'); | |
function Ford(m, s, f) { | |
let mf = new Array(m.length).fill(new Array(m.length).fill(0)); | |
let link = new Array(m.length).fill(0); | |
let flow = new Array(m.length).fill(0); | |
function findPath(s, f) { |
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
'use strict' | |
var fs = require('fs'); | |
/** | |
* Breadth-first search | |
* @param m {Array} | |
* @param s {Number} | |
*/ | |
function BFS(m, s) { |
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
'use strict'; | |
(function Kuhn(k, n, g) { | |
var m = new Array(k), | |
used = new Array(n); | |
function pair(v) { | |
// used[v] = true; | |
// for (let i = 0; i < n; i++) { | |
// let to = g[v][i]; | |
// if (m[to] == null || Kuhn(m[to])) { |
NewerOlder