This file contains hidden or 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 <vector> | |
| #include <string> | |
| #include <cmath> | |
| #include <cassert> | |
| #include <random> | |
| #include <chrono> | |
| auto NaiveMatch(const std::string &pattern, const std::string &text) -> int { | |
| auto pattern_length = pattern.size(); |
This file contains hidden or 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 <vector> | |
| #include <string> | |
| #include <random> | |
| #include <chrono> | |
| using hash_t = std::size_t; | |
| using TagType = uint16_t; | |
| size_t UpperPower2(size_t x) { |
This file contains hidden or 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 <vector> | |
| #include <string> | |
| #include <cmath> | |
| using hash_t = std::size_t; | |
| template <typename T> | |
| class HyperLogLog { | |
| public: |
This file contains hidden or 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 "count_min_sketch.h" | |
| #include <algorithm> | |
| #include <atomic> | |
| #include <stdexcept> | |
| #include <string> | |
| /** | |
| * Constructor for the count-min sketch. | |
| * |
This file contains hidden or 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 <vector> | |
| #include <string> | |
| #include <type_traits> | |
| using hash_t = std::size_t; | |
| inline auto HashBytes(const char *bytes, size_t length, hash_t seed = 0) -> hash_t { | |
| hash_t hash = length + seed; | |
| for (size_t i = 0; i < length; ++i) { |
This file contains hidden or 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 <vector> | |
| #include <algorithm> | |
| #include <unordered_set> | |
| #include "btree.h" | |
| auto Node::FindExactKeyIdx(KeyType key, int *idx) -> bool { | |
| int i = 0; | |
| while (i < num_keys_) { |
This file contains hidden or 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 matplotlib.pyplot as plt | |
| import numpy as np | |
| from mpl_toolkits.mplot3d import Axes3D | |
| # 准备数据 | |
| data = [ | |
| # N, M, Speedup | |
| [25, 10, 3.45], [25, 100, 1.38], [25, 1000, 0.98], [25, 100000, 2.11], [25, 1000000, 2.09], [25, 10000000, 2.14], | |
| [50, 10, 4.71], [50, 100, 1.36], [50, 1000, 2.25], [50, 100000, 2.30], [50, 1000000, 2.30], [50, 10000000, 1.97], | |
| [100, 10, 4.62], [100, 100, 1.22], [100, 1000, 2.05], [100, 100000, 2.59], [100, 1000000, 2.96], [100, 10000000, 2.72], |
This file contains hidden or 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
| bomb: 文件格式 elf64-x86-64 | |
| Disassembly of section .init: | |
| 0000000000400ac0 <_init>: | |
| 400ac0: 48 83 ec 08 sub $0x8,%rsp | |
| 400ac4: e8 f3 01 00 00 call 400cbc <call_gmon_start> | |
| 400ac9: 48 83 c4 08 add $0x8,%rsp |
This file contains hidden or 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 random | |
| class DAT: | |
| default_size: int = 4096 | |
| data_set_size = 126 | |
| base: list[int] | |
| check: list[int] | |
| def __init__(self): | |
| self.base = [0] * self.default_size |
This file contains hidden or 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
| from enum import Enum | |
| import random | |
| class Color(Enum): | |
| RED = "red" | |
| BLACK = "black" | |
| class RBNode: |
NewerOlder