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
class Lobe {} | |
class Temporal implements Lobe {} | |
class Frontal implements Lobe { | |
MemoryProcessor processor; | |
Object process(Effortful memory){ | |
return processor.process(memory); | |
} |
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 'dart:math'; | |
class ClosestPair { | |
// O(n^2) | |
static double bruteForce2D(List<Point> list) { | |
double closest = double.infinity; | |
for(var i = 0; i < list.length - 1; i++){ | |
for(var j = i + 1; j < list.length; j++){ | |
closest = min(closest, list[i].distanceTo(list[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
class Strassen { | |
m1_of(List[][] a, List[][] b) {} | |
m2_of() {} | |
m3_of() {} | |
m4_of() {} | |
m5_of() {} |
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
// Advanced Algorithms: Dynamic Programming | |
// GitHub: https://gist.github.com/Esgrima/4a744b79077da2e43ba00935dca89313 | |
// DartDevPad: https://dartpad.dev/4a744b79077da2e43ba00935dca89313 | |
import 'dart:math' as math; | |
class CoinRow { | |
// Coin-row problem: There is a row of n coins whose values are some | |
// positive integers c1, c2, . . . , cn, not necessarily distinct. The goal is to pick up the |
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 'dart:math' as math; | |
int karatsubaProductOf(int x, int y) { | |
print("x is $x"); | |
print("y is $y"); | |
int N = math.max(x.bitLength, y.bitLength); | |
if (N <= 10) { | |
return 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
// Advanced Algorithms: Decrease and Conquer | |
// https://gist.github.com/Esgrima/7d49182a728fe0a96d32c23da21919c2 | |
// View and Run at this link: | |
// https://dartpad.dev/7d49182a728fe0a96d32c23da21919c2 | |
// Utility class of Partitioning algorithms | |
class Partition { | |
static int lomuto(List list){ |
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 getRussianPeasantProduct(int n, int m, int extra){ | |
int next_n; | |
int next_m; | |
int next_extra; | |
if (n == 1){ | |
return m + extra; | |
} else if (n % 2 == 0) { | |
next_n = n / 2 as int; |
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
// https://gist.github.com/Esgrima/c0d4bff4b0d3909daf8994410cd659ce | |
// https://dartpad.dev/c0d4bff4b0d3909daf8994410cd659ce | |
import 'package:flutter/material.dart'; | |
import 'package:flutter_test/flutter_test.dart'; | |
import 'package:boolean_selector/boolean_selector.dart'; | |
// (TODO: Tip # 1) Consider making frequently used variables/values constants | |
const _fooConst1 = ''; | |
const _fooConst2 = ''; |