数据结构
jesson3264
毕业于深圳大学,现在在深圳一家网络安全公司工作。
个人github: https://github.com/jesson3264
展开
-
C语言提取字符串中的内容
int main(){ char *src = "1998-08-09"; char year[10]; char month[10]; char day[10]; sscanf(src, "%[^-]-%[^-]-%s", year, month, day); printf("%s-%s-%s\n", year, month, day); return 0;}原创 2020-04-15 22:30:17 · 2777 阅读 · 0 评论 -
scl cmap 的实现
数组bucket_array挂链表的形式,数组的每个下标当着一个hash 值。一个键hash 完之后,与 数组大小进行取余,得到的数字就是数组的小标,新的节点就往下挂载节点。#ifndef __CMAP_H__#define __CMAP_H__#include "dscommon.h"#ifdef __cplusplusextern "C" {#endifint key_cmp_int(void* key1, void* key2);int value_cmp_int(void* k原创 2020-05-17 21:58:44 · 324 阅读 · 0 评论 -
通用单向链表和双向链表
单链表/***module: singly linked list*/#ifndef __SLIST_H__#define __SLIST_H__typedef struct s_entry_s{ struct s_entry_s *flink;}s_entry_t;//单链表typedef struct slist_entry_s{ s_entry_t* hea...原创 2020-03-21 11:18:42 · 902 阅读 · 0 评论 -
【数据结构】如何写好面试中的链表【上】
相信很多刚找工作时的同学,都遇到过面试时被问链表的情景,有些面试官还喜欢直接要你在纸上写。原创 2020-03-04 09:19:49 · 358 阅读 · 0 评论 -
Huffman编码
Huffman算法描述如下:(1)根据给定的n个权值{w1,w2,...,wn}构成n棵二叉树的集合F={T1,T2,...,Tn},其中每棵二叉树Ti中只有一个带权为wi的根节点,其中左右子树为空。(2)在F中选取两棵根节点的权值最小的树作为左右子树构造一棵新的二叉树,且置新的二叉树的根节点的权值为其左右子树节点权值之和。(3)在F中删除这两棵树,同时将新得到的二叉树加入F中.(原创 2012-10-22 16:00:46 · 466 阅读 · 0 评论 -
数据结构链表的一些操作!
复试上上机前的一些练手 #include #include typedef struct node{ int data; struct node *next;}ListNode;typedef ListNode *LinkList;LinkList CreateLinkList(){ int n,i; int inputdata; LinkList原创 2012-11-02 20:51:05 · 381 阅读 · 0 评论 -
开门与关门人HDOJ
题目链接http://acm.hdu.edu.cn/game/entry/problem/show.php?chapterid=1§ionid=3&problemid=7#include using namespace std;struct Info{ char name[17]; int totals;//开始时间,时分秒 int totale;}原创 2012-12-28 17:04:42 · 443 阅读 · 0 评论