题目: 输入一棵二叉搜索树,将该二叉搜索树转换成一个排序的双向链表。要求不能创建任何新的结点,只能调整树中结点指针的指向。 代码: 1 /* 2 struct TreeNode { 3 int val; 4 struct TreeNode *left; 5 struct TreeNode *righ ...
分类:
其他好文 时间:
2020-05-30 01:14:49
阅读次数:
57
#include <bits/stdc++.h> using namespace std; char cnt = 0; struct A { A() { *reinterpret_cast<char*>(this) = ++cnt; cout << "construct: " << this << ...
分类:
其他好文 时间:
2020-05-29 23:40:29
阅读次数:
109
如果将类模板的声明和实现写在两个独立的文件中,在构建时会出现“error LNK2019: 无法解析的外部符号 ”的错误。 实例: MyClass.h: #ifndef _CLASS_TEMPLATE_H_ #define _CLASS_TEMPLATE_H_ template<typename T ...
分类:
其他好文 时间:
2020-05-29 23:32:04
阅读次数:
95
#include <bits/stdc++.h> using namespace std; char cnt = 0; struct A { A() { *reinterpret_cast<char*>(this) = ++cnt; cout << "construct: " << this << ...
分类:
其他好文 时间:
2020-05-29 23:23:00
阅读次数:
71
一、技术总结 这题考查内容为并查集,核心是用一个数组存储当前结点的父节点编号,操作有初始化、查找、合并。 题意首先理解一下,题目意思是给出N行,然后每行中首先给出自己的ID号、然后是父亲ID、再是母亲ID,如果父亲跟母亲已经去世,该ID好给出为-1,然后再给数字num,代表给人的孩子数,后面跟上nu ...
分类:
其他好文 时间:
2020-05-29 21:30:19
阅读次数:
48
includes\database\prefetch.inc line 425 $this->defaultFetchStyle: fetch_object int 5protected $defaultFetchOptions = array( 'class' => 'stdClass', 'co ...
分类:
其他好文 时间:
2020-05-29 17:57:48
阅读次数:
60
1.<context:annotation-config/> 》可能大家没见过这个标签,但是它提供的注解的使用你一定用过,比如@Autowired,@Resource,@PostConstruct等,至于你为什么没用到这个标签,还能正常使用且由效果呢,请继续往下看 1..如果你想使用@Autowir ...
分类:
Web程序 时间:
2020-05-29 17:42:04
阅读次数:
68
#include<cstdio> #include<queue> using namespace std; struct TNode{ int value=-1; TNode *left=NULL; TNode *right=NULL; }; void preOrder(TNode *root){ ...
分类:
其他好文 时间:
2020-05-29 13:54:22
阅读次数:
47
本题的关键是从可选择方法中选择哪一类最优化 答案是结束时间最早的一类 源代码 #include<iostream>#include<algorithm>#include<cstdio>#define maxn 100100using namespace std;struct w{ int endd, ...
分类:
其他好文 时间:
2020-05-29 13:27:58
阅读次数:
55
题目描述 leetcode - 2:https://leetcode-cn.com/problems/add-two-numbers/ 解题关键 C++ 链表 数据结构的定义和遍历 代码 /** * Definition for singly-linked list. * struct ListNo ...
分类:
其他好文 时间:
2020-05-29 09:15:52
阅读次数:
73