- 博客(176)
- 资源 (1)
- 收藏
- 关注

原创 c++ python @cache 的模仿
那么c++ 可不可以相对方便的像 python那样 稍微加亿点点代码实现 从暴力搜索到 记忆化搜索的 华丽的转身了,那就有了下面这个拙劣的模仿。在B站讲题, 当时的反应就是一脸震惊, 看着我c++ dfs 没有记忆化的代码陷入了沉思。第一次看到python @cache 魔法的时候是在看。3、修改 , 我们会发现, 代码基本上一样的。1、将上面的代码拷贝到代码文件。2、写出暴力dfs的代码。
2024-04-26 13:07:13
544

原创 关于double精度的问题的思考
在算法题中, 万恶的double精度经常让我们痛苦不堪, 下面对算法中double的进度问题进行一些思考。本文会围绕两个问题进行思考2、double 比较。
2024-04-22 12:49:26
613

原创 c 运算符优先级顺序速记
在掌握C语言中的运算符及其优先级时,有一套简洁而高效的速记口诀可以帮助我们迅速记住它们的顺序和用法。这些口诀不仅便于记忆,而且能够在编程实践中快速定位和解决问题。下面是这套速记口诀的详细解读和一些额外的说明,旨在帮助读者更好地理解和应用。
2024-02-21 11:35:13
722

原创 c++ STL less 的视角
c++ less 函数在不同的地方感觉所起的作用是不一样的, 这中间原因是 less 的视角不一样, 下面尝试给出解释下, 方便记忆。
2024-02-02 14:55:27
473

原创 c++ 关于那些莫名其妙 “不 coredump” 的思考
很多人都听过, 在某个地方删除一个 printf 的时候, 代码居然 coredump 了,本文尝试对这些问题做一点思考。
2024-01-20 16:48:26
419

原创 c++二叉树遍历-从递归法到迭代法的前世今生
;};};publicreturn;}//当前frame还未添加到datadata.push_back(currentFrame->val);//0//currentFrame入栈位置,这里的栈值的系统栈,我们自己用栈模拟的时候需要用栈实际操作preorderTraversal_recursion_helper(currentFrame->left,data);............
2022-08-01 17:13:16
246

原创 c++-二叉树遍历for loop统一迭代法
PRE先序遍历IN中序遍历POST后序遍历。c+±二叉树遍历forloop统一迭代法。c+±二叉树遍历forloop统一迭代法。c+±二叉树遍历forloop统一迭代法。c+±二叉树遍历forloop统一迭代法。c+±二叉树遍历forloop统一迭代法。c+±二叉树遍历forloop统一迭代法。c+±二叉树遍历forloop统一迭代法。c+±二叉树遍历forloop统一迭代法。c+±二叉树遍历forloop统一迭代法。c+±二叉树遍历forloop统一迭代法。......
2022-07-25 13:10:26
766

原创 leetcode-代码测试模板
代码提交前的测试模板#include <iostream>#include <utility>#include <string>#include <cstring>#include <vector>#include <map>#include <set>#include <stack>#include <queue>#include <unordered_map>#i
2021-06-23 11:43:19
897
1

原创 c++从堆到哈希堆
#include <iostream>#include <utility>#include <string>#include <cstring>#include <vector>#include <map>#include <set>#include <stack>#include <queue>#include <unordered_map>#include <
2021-06-16 20:21:46
261

原创 c++codeforce 代码测试模板
准备工作:创建 input.txt 放测试数据创建 expect.txt 放预期结果编译命令g++ main.cpp -std=c++17 -Wall -DTEST#include <iostream>#include <utility>#include <string>#include <cstring>#include <vector>#include <map>#include <set>
2021-06-10 11:36:06
882
1

原创 c++ 函数式编程-管道流水线
#include <iostream>#include <utility>#include <vector>#include <algorithm>using namespace std;// 重载 operator// 注意operator| 重载时两个参数至少一个必须为类类型或者class枚举类型template<typename T, class F>auto operator|(T &¶m, F.
2021-05-25 19:30:59
650
1

原创 c++ pipeline设计模式的实现
pipeline 设计模式的实现, 有几个小问题暂时还懒得解决getDownStream 每次都重新生成新的对象,可以优化下pipeline 模式的核心是 downstream 可以方便提供, 目前写死了。#include <string.h>#include <algorithm>#include <iostream>#include <map>#include <numeric>#include <queue>
2021-05-11 15:00:36
3979
2

原创 n皇后 最快算法
1、 求 n 皇后总数class Solution {public: int upperlimit = 0; int sum = 0; /* 从第一行开始能放的位置, 并置为 1 now 记录了当前哪些列放了皇后 ld 记录了 45 度方向放皇后的列 rd 记录了 135 度方向放皇后的列 */ void test(int now, int left, int right) { if (now == upperlimit) {
2021-04-01 11:12:47
214
原创 c++平衡树- 红黑树
#include <cstdio>#include <cctype>#include <cassert>using namespace std;//#define __REDBLACK_DEBUG#define bro(x) (((x)->ftr->lc == (x)) ? ((x)->ftr->rc) : ((x)->ftr->lc))#define islc(x) ((x) != NULL && (x
2024-10-17 00:22:52
258
原创 c++ 后缀数组模版
#include <bits/stdc++.h>using namespace std;template<typename T = unsigned int>class SuffixArray {public: using size_type = T; using pointer = size_type*; using const_pointer = const size_type*; static_assert(std::is_integ
2024-10-11 18:01:41
338
原创 c++ 区间相关算法合集
sparseTable树状数组zkw 线段树1、不修改, 最大 最小, 区间和线段树2、单点修改,最大、最小、区间和线段树3、区间修改, 最大、最小、区间和线段树
2024-05-29 14:18:38
135
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人