1. 导入头文件 编写代码过程中,涉及动态内存分配等常用的函数,需要引入如下头文件 #include<stdio.h> #include<stdlib.h> 2. 结构体定义 len 表示初始化时的数组长度,队列的最大容量为len-1 typedef struct Queue { int * pDa ...
分类:
编程语言 时间:
2020-06-20 00:38:57
阅读次数:
65
问题 有二进制文件中保存了 20 亿个 2 Bytes 的数,需将其读出,每 20000 个数作图,拟合后输出结果。 解决 1 # -*- coding: utf-8 -*- 2 """ 3 @author: kurrrr 4 """ 5 6 import struct 7 8 def main() ...
分类:
编程语言 时间:
2020-06-19 22:37:46
阅读次数:
65
#include<stdio.h> #include<malloc.h> typedef char ElemType; typedef struct DNode { ElemType data; struct DNode *prior; struct DNode *next; }DNode,*DLi ...
分类:
其他好文 时间:
2020-06-19 21:12:34
阅读次数:
57
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int SIZE = 1e5 + 5; class Treap { struct Node { int l, r; int val, dat; //节点 ...
分类:
其他好文 时间:
2020-06-19 13:40:37
阅读次数:
40
题目描述 leetcode - 102:https://leetcode-cn.com/problems/binary-tree-level-order-traversal/ 解题关键 队列 BFS 结构体 碎碎念 这道题可以不用结构体,在while循环里面加一个for循环来遍历某一层的节点。但是很 ...
分类:
其他好文 时间:
2020-06-19 01:10:53
阅读次数:
67
一、技术总结 二、参考代码 #include<iostream> #include<vector> #include<algorithm> #include<set> #include<map> using namespace std; struct node_i{ string name; dou ...
分类:
其他好文 时间:
2020-06-19 00:49:08
阅读次数:
43
1 问题的由来 环境:在LeetCode中,使用C++编程。 在创建链表时,使用malloc为节点分配内存,可最后报错,如下图所示。 错误原因:分配内存和释放内存不匹配。 2 解决方法 使用new来为节点分配内存。 new的使用方法如下所示: struct ListNode* p_head; p_h ...
分类:
其他好文 时间:
2020-06-18 21:12:27
阅读次数:
56
C语言允许为一个数据类型起一个新的别名,就像给人起“绰号”一样。 起别名的目的不是为了提高程序运行效率,而是为了编码方便。例如有一个结构体的名字是 stu,要想定义一个结构体变量就得这样写: struct stu stu1; struct 看起来就是多余的,但不写又会报错。如果为 struct st ...
分类:
其他好文 时间:
2020-06-18 13:27:11
阅读次数:
54
首先我们需要到官网下载 http://ueditor.baidu.com/website/download.html#ueditor 最新版本的编辑器 将下载的压缩包打包后 把文件名改成 UEditor; 然后放在项目根目录的public文件夹下 然后在 public文件的index.html文件引 ...
分类:
其他好文 时间:
2020-06-18 11:15:34
阅读次数:
113
redis的字典使用哈希表作为底层实现,一个哈希表里面可以有多个哈希表,而每个哈希表节点就保存了字典中的一个键值对。 1.哈希表 typedef struct dictht { //哈希表 dictEntry **table; //存放一个数组的地址,数组存放着哈希表节点dictEntry的地址 u ...
分类:
其他好文 时间:
2020-06-18 01:55:42
阅读次数:
53