ICode9

精准搜索请尝试: 精确搜索
  • Colorful Tree2022-06-30 23:32:26

    Colorful Tree 题目大意 给我们一棵树,每个节点有一个颜色。 需要完成两个操作。 求某一种颜色的最小生成树的边数 将某一个节点的颜色改为另一种颜色 思路 不得不提到一个名词,虚树。虚树的概念大就是说我们不用真的把每一次改变后的树都重新建出来,我们只需要维护某些性质即可。

  • 《简单DP》2022-06-30 22:36:49

    简单DP 「JOISC 2020 Day4」治疗计划 首先考虑问题的维度\([治疗状态],[时间],[花费]\) 治疗状态肯定无法省去 时间其实可以忽略,因为最终的答案的可行性与时间无关,但可能会加大转移的难度 事实上时间是可以不入状态的 考虑用01串表示治疗状态,但其实可以直接用前缀治疗状态 设\(dp[

  • 线段树2022-06-30 19:31:28

       大体长这个样子 特点: 任意两个节点,要么是包含关系,要么没有公共部分,不存在重叠或相交。 给定一个叶子节点p,从该节点到根节点的所有节点所代表的区间都包含p。 存储方式:静态数组存储,左孩子*2,右孩子*2+1本人不会指针,写不出指针写法 操作: update: 利用子节点信息更新父节点信息

  • Lecture 10 Index and Hashing (including B+ Tree)2022-06-30 00:32:47

    Basic Concepts: Search Key - attribute to set of attributes used to look up records in a file. An index file consists of records (called index entries) of the form search-key pointer Index files are typically much smaller t

  • LeetCode 590. N-ary Tree Postorder Traversal2022-06-27 06:00:15

    原题链接在这里:https://leetcode.com/problems/n-ary-tree-postorder-traversal/ 题目: Given the root of an n-ary tree, return the postorder traversal of its nodes' values. Nary-Tree input serialization is represented in their level order traversal. Each group o

  • LeetCode 589. N-ary Tree Preorder Traversal2022-06-27 05:31:06

    原题链接在这里:https://leetcode.com/problems/n-ary-tree-preorder-traversal/ 题目: Given the root of an n-ary tree, return the preorder traversal of its nodes' values. Nary-Tree input serialization is represented in their level order traversal. Each group of

  • CF1696F Tree Recovery2022-06-26 23:03:46

    题面传送门 非常离谱,比赛的时候睡着了!然后错失大好上分机会。 考虑如果我们钦定一个点为根,那么每个点会被分到一个组中,这个点到根的距离和其它点都相同。 如果我们知道了一个点和根是相邻的,那么我们将根换到这个点上来,原来的根对应的组都是和当前的根相邻的,继续换下去就可以构造出

  • MySQL索引已经数据结构相关2022-06-26 21:32:33

    为什么要使用索引 如果不使用索引的话,检索数据得逐行进行匹配,匹配成功才进行返回,而使用索引的话,可以将每行的地址进行保存,并将它们以某种数据结构的方式进行保存,可以极大的优化了检索数据,比如有800条数据,如下表所示。 如果想要对用户名为h的数据进行查询,不使用索引的情况下逐行匹

  • 二叉树的创建和文本显示2022-06-25 00:03:42

    题目描述 编一个程序,读入先序遍历字符串,根据此字符串建立一棵二叉树(以指针方式存储)。 例如如下的先序遍历字符串: A ST C # # D 10 # G # # F # # # 各结点数据(长度不超过3),用空格分开,其中“#”代表空树。 建立起此二叉树以后,再按要求输出二叉树。 输入 输入由多组测试数据组成。 每

  • MySQL 查询优化(三) 索引的重要性12022-06-24 08:32:47

      索引(index)是帮助MySQL高效获取数据的数据结构(有序)。在数据之外,数据库系统还维护着满足特定查找算法的数据结构,这些数据结构以某种方式引用(指向)数据,这样就可以在这些数据结构上实现高级查找算法,这种数据结构就是索引。   索引的优点: 1.提高数据检索的效率,降低数据库的IO成本 2

  • Difference between MST and DIJKSTRA2022-06-22 00:04:58

    MST -- Minumum Spinning Tree https://www.geeksforgeeks.org/kruskals-minimum-spanning-tree-algorithm-greedy-algo-2/?ref=leftbar-rightbar 简化一个图, 在保证所有节点连接的前提下,最小化连接代价。 What is a Spanning Tree? A Spanning tree is a subset to a connected

  • CF1695D2. Tree Queries (Hard Version) (树形DP, 思维)2022-06-21 22:34:03

    https://codeforces.com/contest/1695/problem/D2 题意: 思路: 找任意度数大于3的点u做根,u有c个子树,则c-1个子树都需要有询问点 这是因为,度数大于3的点至少有两棵子树有询问点,这样对于一个子树,子树外有询问点,只需关注子树内 树上问题以一个子树为一个阶段进行分析 #include<bits/

  • cf1695 D2. Tree Queries (Hard Version)2022-06-21 01:33:21

    题意: 给定一棵边权为1的树,树中有一个特殊节点但不告诉你是哪个。你可以询问一个节点集 \(S\),然后知道特殊点到 \(S\) 中每个点的距离。输出能确定特殊点的 \(|S|\) 的最小值 \(n\le 2e5\) 思路: 题目转化为:对任意点 \(u\),怎样区分特殊点与 \(u\)? 再转化为:要能区分任意两点。即对任

  • LLVM基础学习:使用VSCode+GDB 调试 out-of-tree 的 LLVM Pass 的配置2022-06-20 20:32:56

      使用VSCode+GDB 调试 out-of-tree 的 LLVM Pass 的配置   时间:20220620,版本:V0.1 作者:robotech_erx   使用GDB调试文件比较多的项目还是很累的。 尝试了GDBGui等前端,还是感觉VScode,Eclipse这些成熟的IDE作为前端更好。   VScode调试 LLVM Pass 的配置:   1.设置llvm的包含路

  • 三种方式查询三级分类Tree2022-06-20 00:04:40

    话不多说,直接上代码 方式一:for循环嵌套一下 /** * 查询三级分类 * * @return */ @Override public List<GoodsType> findNodes() { // 方式一:查询三级分类 // 查询一级分类 Long parentId = 0L; List<GoodsType> le

  • 树状数组2022-06-19 16:03:58

    #include <bits/stdc++.h> #include <unordered_map> //数状数组; using namespace std; class Solution { private: int lowbit(int x) { return x & -x; } vector<int> arr; vector<int> tree; public: Solution(

  • POJ2486 Apple Tree(树形背包)2022-06-18 12:00:28

    从每个节点u出发后有两种情况:回到u和不回到u。 dp数组设为三维,第一维是节点编号,第二维是从该节点开始走的步数,第三维1/0 表示是否回到该节点。 可以回到时:dp[u][j][1]=max(dp[u][j][1],dp[u][j-t][1]+dp[v][t-2][1]); 不能回到时,分为两种情况:1.最终停在v子树上 2.最终停在其他子树

  • 【Python爬虫(一)】XPath2022-06-14 20:03:34

    解析方式:XPath XPath的基本使用 1 安装lxml库 conda install lxml 下载慢的话可以试一下热点或切换下载源 2 导入etree from lxml import etree 3 XPath解析文件 ①本地html文件 html_tree = etree.parse('xx.html') ②服务器文件 html_tree = etree.HTML(response.read().de

  • leetcode 226 Invert Binary Tree2022-06-14 13:31:58

    Given the root of a binary tree, invert the tree, and return its root. Example 1: Input: root = [4,2,7,1,3,6,9] Output: [4,7,2,9,6,3,1] Example 2: Input: root = [2,1,3] Output: [2,3,1] Example 3: Input: root = [] Output: [] Constraints: The number of nod

  • leetcode 104 maximum-depth-of-binary-tree2022-06-14 13:07:00

    https://leetcode.cn/problems/maximum-depth-of-binary-tree/submissions/ https://www.bilibili.com/video/BV11Y4y1q7YA?p=27 Given the root of a binary tree, return its maximum depth. A binary tree's maximum depth is the number of nodes along the longest

  • cf383 C. Propagating tree2022-06-14 01:01:28

    题意: 给定一棵树,带点权。两种询问: 1 x val:节点 x 加上 val,x 的所有儿子减去 val,x 的所有孙子加上 val,以此类推直到叶子 2 x:输出 x 节点的点权 思路: 维护子树的点权:dfs序把树映射为数组 一层加、一层减:开两个树状数组,\(tr[0]\) 维护在原树中的深度为偶的点,其中深度为奇的无意义;\(tr

  • 使用GDB调试一个out-of-tree的 LLVM Pass2022-06-12 15:03:00

      使用GDB调试一个out-of-tree的 LLVM Pass   时间:20220611,版本:V0.1 作者:robotech_erx 1.Introduction 环境: Ubuntu 20.04 桌面版 LLVM 13.0.1 github下载的pre-build版本。Release配置的,没有调试符号。 GDB  9.2  (Ubuntu 9.2-0ubuntu1~20.04.1,系统自带的版本)   LLVM里编

  • Infected Tree2022-06-12 00:31:06

    题目: Byteland is a beautiful land known because of its beautiful trees. Misha has found a binary tree with nn vertices, numbered from 11 to nn. A binary tree is an acyclic connected bidirectional graph containing nn vertices and n−1n−1 edges. Each

  • el-tree节点模拟双击事件2022-06-10 19:03:57

    需求描述 el-tree组件节点默认展开,单击节点不会触发伸缩,双击节点获取当前节点的数据。 问题解决 el-tree 默认展开并设置阻止单击节点自动展开或收缩 <el-tree default-expand-all :expand-on-click-node="false" @node-click="handleNode"> 添加双击事件 const n = { count

  • Mysql索引2022-06-10 09:03:34

    Mysql索引 索引的本质 MySQL官方对索引的定义为:索引(Index)是帮助MySQL高效获取数据的数据结构。提取句子主干,就可以得到索引的本质:索引是数据结构。 我们知道,数据库查询是数据库的最主要功能之一。我们都希望查询数据的速度能尽可能的快,因此数据库系统的设计者会从查询算法的角度进

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有