
小姿势
一只小陀螺
这个作者很懒,什么都没留下…
展开
-
【小姿势】实现简单的share_ptr
实现: template <typename T> class Shared_ptr { public: Shared_ptr() :_count(nullptr), _ptr(nullptr) {} Shared_ptr(T* ptr) :_count(new int(1)), _ptr(ptr) {} Shared_ptr(Shared_ptr<T>& sptr) : _count(&(++* sptr._count)), _ptr(spt原创 2021-02-08 15:27:36 · 271 阅读 · 0 评论 -
【小姿势】序列自动机
#include <bits/stdc++.h> using namespace std; struct SUBM { void init(string& str, int _az, char _base) { az = _az, base = _base; nxt.resize(str.length() + 2, vector<int>(az, -1)); for (int i = str.length() + 1原创 2020-07-28 00:24:03 · 151 阅读 · 0 评论 -
【小姿势】简单的布隆过滤器(C++实现)
#include <iostream> #include <bitset> #include <vector> typedef unsigned long long ull; using namespace std; const int MAX_SIZE = 500000; const vector<int> seeds = { 11, 23, 37, 233 }; ull ha(const string &str, const int &原创 2020-07-10 10:52:05 · 502 阅读 · 0 评论