- 博客(13)
- 收藏
- 关注
原创 关于JDK1.7与1.8的HashMap源码解读的一些总结
HashMap源码的学习笔记分享,关于JDK1.7与1.8的HashMap源码笔记和个人理解总结。
2022-03-05 15:44:34
759
原创 关于Seletor中的Set<SelectionKey>需要remove的问题
java.lang.NullPointerException: Cannot invoke "java.nio.channels.SocketChannel.configureBlocking(boolean)" because "sc" is null
2022-02-28 19:07:18
392
原创 NIO基于通道的网络IO,服务端获得客户端数据
@Test public void serverdemo() throws IOException { ServerSocketChannel channel = ServerSocketChannel.open(); channel.socket().bind(new InetSocketAddress(8888)); SocketChannel c = null; while(c == null){ c = channel.accept();//服务端.
2022-02-27 22:25:15
327
原创 图的深度优先(递归、栈实现)&广度优先(队列)
数据结构: #define MaxVertexNum 100 typedef struct ArcNode{ int adjvex; ArcNode *next; }ArcNode; typedef struct VNode{ int data; ArcNode *first; }VNode,AdjList[MaxVertexNum]; typedef struct{ AdjList vertices; int vexnum,arcnum; }AL.
2021-08-07 21:33:06
976
原创 二叉树的深度与宽度C#实现
typedef struct node{ int data; node *left; node *right; }Node,*Tree; 求二叉树的宽度。宽度:有结点数最多的那一层的结点个数。 void order(Tree tree,int lay, int a[]){ //二叉树,层数,辅助数组 if(node->left!= nullptr){ order(node->left,lay+1,a); } i..
2021-08-05 18:04:15
326
原创 二叉树的层次构造&层次遍历(递归实现、队列实现)
typedef struct node{ int data; node *left; node *right; }Node,*Tree; 构造 Node *generateTree(int a[],int i,int len){ Node *node = (Node *)malloc(sizeof(Node)); node->data = a[i]; node->left = nullptr; node->right = .
2021-08-03 13:02:15
1377
原创 2017年408算法题——表达式二叉树
题目: typedef struct node{ char data; node *left; node *right; }BTree; void inorder(BTree tree,int storey){ //tree是结点,storey是当前层数,最高是0 BTree p = tree; if( p.left!= nullptr || p.right!= nullptr ){ //左右孩子不全为空
2021-08-01 21:14:06
582
原创 堆排序的C语言实现
最近发现个学习算法非常好用的网站:https://www.cs.usfca.edu/~galles/visualization/Algorithms.html 基本绝大部分的算法都用动画的效果展示出来,能够非常形象直观的介绍算法的思想。 于是我挑了个比较复杂,也个人认为感到惊艳的堆排序算法尝试进行实现。 学习网站里,堆排序长这样: 实现:上代码! typedef struct TNode{ int data; TNode *left; TNode *right; }.
2021-08-01 17:00:14
130
原创 函数的参数使用指针、地址、值的区别
一、目标 主要理清,在C语言中一个void方法里,当参数分别传入指针、地址、值三种选择时,我应该怎么选择传什么样的参数?哪种情况下结果会被带回?以及出现这种情况的原因。本篇文章我会用一个例子来说明。 例子:实现单链表的原地逆置 二、内容 变量定义 typedef struct LNode{ int data; LNode *next; }LNode,List; (1) 情形一 //单链表的原地逆置 void reverse(List list){ LNo
2021-07-30 00:58:49
1262
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅