
c
Victor.Chang
留下思索,分享感悟
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
对指针数组 数组指针 函数指针 函数指针数组 指向函数指针数组的指针的理解
指针数组 int a=10,b=20; int *arr[2]={&a,&b}; //指针数组,数组 printf("%p %p\n\n",arr[0],&a); // 000000000062FE3C 000000000062FE3C 打印结果为两个一样的地址 数组指针 int (*parr)[2]; parr=&arr; //数组指针,指针 prin原创 2017-11-18 12:59:09 · 1779 阅读 · 0 评论 -
搜索二叉树的应用
1. 判断一个单词是否拼写正确 2. 请模拟实现一个简单的中英互译的字典 3. log文件中有许多异常重复的IP地址,请统计出每个异常IP出现了多少次? 利用上篇搜索二叉树的结构稍作修改 typedef char* KeyType; typedef char* ValueType; typedef struct BSTreeNode { struct BSTreeNode* _left...原创 2018-02-28 15:08:20 · 2313 阅读 · 0 评论 -
C实现Hash表,开放定址法
typedef int KeyType; typedef int ValueType; //用枚举来表示当前节点的状态 typedef enum Status { EMPTY, //空 EXITS, //存在 DELET, //删除 }Status; typedef struct HashNode { KeyType _key; ValueType _value; ...原创 2018-02-28 17:44:55 · 2233 阅读 · 0 评论 -
C实现Hash表,链式结构
typedef int KeyType; typedef int ValueType; typedef struct HashNode { KeyType _key; ValueType _value; struct HashNode* _next; }HashNode; typedef struct HashTable { HashNode** _tables; s...原创 2018-02-28 21:07:48 · 2271 阅读 · 0 评论 -
哈希变形---位图
1.给定100亿个整数,设计算法找到只出现一次的整数 2.给两个文件,分别有100亿个整数,我们只有1G内存,如何找到两个文件交集 3.1个文件有100亿个int,1G内存,设计算法找到出现次数不超过2次的所有整数 typedef struct BitMap { size_t* _bits; size_t _range; }BitMap; void BitMapInit(Bi...原创 2018-03-01 17:20:17 · 1976 阅读 · 0 评论 -
C语言常见的排序
#include<stdio.h> #include<windows.h> #include<assert.h> #include"Stack.h" typedef int DataType; void SortPrint(DataType*a,size_t n){ size_t i; for(i=0;i<n;i++) printf("%d ...原创 2018-03-15 20:44:18 · 1776 阅读 · 0 评论 -
C语言布隆过滤器BloomFilter
在实现BloomFilter,首先实现一个位图;BitMap在位图中,每个元素为“0”或“1”,表示其对应的元素不存在或者存在。typedef struct BitMap { size_t* _bits; size_t _range; }BitMap; void BitMapInit(BitMap* bm, size_t range) ; void BitMapSet(BitMap...原创 2018-03-02 14:46:21 · 3062 阅读 · 0 评论 -
海量数据处理问题
1.给一个超过100G大小的log file, log中存着IP地址, 设计算法找到出现次数最多的IP地址?将100G的log file分成1000份相同的Ip必定会在同一个小文件里在每个文件里找出出现次数最多的ip将找出来的1000个最多ip进行比较,找出最多的一个2.给定100亿个整数,设计算法找到只出现一次的整数 给两个文件,分别有100亿个整数,我们只有1G内存,如何找到两个文件交集 个文...原创 2018-03-02 16:27:11 · 2044 阅读 · 0 评论 -
栈,迷宫问题
#include"Stack.h" #define N 6 int maze[N][N] = { {0,0,0,0,0,0}, {0,0,1,1,1,0}, {0,0,1,0,1,0}, {0,0,1,1,1,0}, {0,0,1,0,1,1}, {0,0,1,0,0,0}, }; void MazePrint(); int MazeCheckIsAccess(P...原创 2018-03-04 15:30:49 · 1784 阅读 · 0 评论 -
链表面试题(下)
// 链表带环问题; 是环,返回相遇点 SListNode* SListIsCycle(SListNode* list){ SListNode* fast,*slow ; assert(list); fast = list->_next; slow = list->_next; while(fast&&fast->_next){ slow=slow-...原创 2018-02-25 14:38:06 · 1711 阅读 · 0 评论 -
二叉树的基础操作
BinTree.h#ifndef _BINTREE_H_ #pragma once #include<stdio.h> #include<assert.h> #include<malloc.h> #include<windows.h> typedef int BTDataType; //typedef struct TreeNode //...原创 2018-02-25 17:25:10 · 1712 阅读 · 0 评论 -
二叉树的线索化
#include<stdio.h> #include<assert.h> #include<stdlib.h> typedef int DataType; typedef enum PtrTag{ THREAD, // 线索化 LINK, // 链接左右孩纸 }PtrTag; typedef struct BinaryTreeNodeThd ...原创 2018-02-27 17:39:51 · 1710 阅读 · 0 评论 -
搜索结构搜索二叉树
#include<stdio.h> #include<malloc.h> #include<windows.h> #include<assert.h> typedef int DataType; typedef struct BSTreeNode{ struct BSTreeNode* _left; struct BSTreeNode* _r...原创 2018-02-27 09:19:43 · 1711 阅读 · 0 评论 -
堆与最优级队列
heap.h#include<stdio.h> #include<time.h> #include<stdlib.h> #include<windows.h> typedef int DataType; void AdjustDown(DataType* a, size_t n, int root){ int child; while(ro...原创 2018-02-26 16:14:25 · 1749 阅读 · 0 评论 -
C语言自定义类型与内存对齐
>结构体类型创建 第一种方法: struct A{ int a; char b; } 第二种方法: typedef struct B{ int a; char b; }B 结构体的自引用: typedef struct B{ int a; char b; sutuct B *b;//指针的大小是原创 2017-11-28 22:18:24 · 1846 阅读 · 0 评论 -
二分查找算法,斐波那契数列的递归及非递归。(分析时间复杂度及空间复杂度)
//二分查找的非递归与递归实现: #include int binarry_Search(int arr[], int len, int value){ //采用左闭右闭区间方式 int left=0,right=len-1; int mid; while(left<=right){ mid=left+((right-left)>>1); //(left+right)/2; if原创 2017-12-08 14:53:28 · 3000 阅读 · 1 评论 -
C语言小程序,三子棋
#include #include void printPan(char arr[][3]){ int i=0; printf(" ——————\n"); printf("| %c | %c | %c |\n",arr[0][0],arr[0][1],arr[0][2]); printf(" —————\n"); printf("| %c | %c | %c |\n",arr[1][原创 2017-12-08 15:49:30 · 1796 阅读 · 0 评论 -
C语言实现扫雷程序
Mine_Clear.h #ifndef _MINE_CLEAR_H_ #include #include #include #include #define _MINE_CLEAR_H_ #define ROW 9 int get_num(char mines[][ROW], int x, int y); void expend(int x,int y,char mines[][ROW],c原创 2017-12-08 20:59:45 · 2081 阅读 · 1 评论 -
【数据结构】动态顺序表
SeqList.h #ifndef _SEQLISTH_H_ #define _SEQLISTH_H_ #include #include #include typedef int Datatype; typedef struct SeqList { Datatype* _a; size_t _size; // 有效数据个数 size_t _capacity; // 容量原创 2017-12-13 16:07:38 · 1776 阅读 · 0 评论 -
C到CPP的注释转换
connver_comment.h#ifndef _CONNVER_COMMENT_H_ #define _CONNVER_COMMENT_H_ #define INPUTFILE "input.txt" #define OUTPUTFILE "output.txt" enum{ CSTATUS,CPPSTATUS,NULLSTATUS,EOFSTATUS }; void connver_m原创 2017-12-07 17:33:56 · 1787 阅读 · 0 评论 -
C语言单链表的实现
SListNode.h #ifndef _SLISTNODE_H_ #define _SLISTNODE_H_ #include #include #include #include #include typedef int DataType; typedef struct SListNode { struct SListNode* _next; DataType _data;原创 2018-01-01 17:00:48 · 1799 阅读 · 0 评论 -
C语言栈和队列的实现
Stack.h #ifndef _STACK_H_ #define _STACK_H_ #include #include #include #include #include typedef int DataType; typedef struct Stack{ DataType *_arr; size_t top; size_t end; }Stack; void StackIn原创 2018-01-03 14:18:25 · 2075 阅读 · 0 评论 -
C语言链表实现贪吃蛇小游戏
Snake.h #ifndef _SNAKE_H_ #include #include #include #include #include #define _SNAKE_H_ #define FOOD "■" #define INIT_X 24 #define INIT_Y 5 //蛇的节点 typedef struct node{ int _x; int _y; struct no原创 2018-01-09 17:27:28 · 3243 阅读 · 0 评论 -
链表面试题(上)
SListNode.h #ifndef _SLISTNODE_H_ #define _SLISTNODE_H_ #include<stdio.h> #include<assert.h> #include<string.h> #include<malloc.h> #include<windows.h> typedef int D...原创 2018-01-29 14:42:56 · 1724 阅读 · 0 评论 -
C++ 学生信息管理系统(文件存储)
整合后的部分源码: #include <iostream> #include <list> #include <string.h> #include <string> #include <fstream> using namespace std; class Course{ public: Course(size_t i...原创 2019-01-13 15:07:06 · 5635 阅读 · 1 评论