- 博客(91)
- 收藏
- 关注
原创 Linux的基本知识(1)
1、各寄存器的简介AX:累加器 BX:基址寄存器(存放存储器地址) CX:计数器 DX:数据寄存器(存放数据) SI:源变址寄存器(常保存存储单元地址) DI:目的变址寄存器(常保存存储单元地址) BP:基址指针寄存器(Base Pointer),表示堆栈区域中的基地址 SP:堆栈指针寄存器(Stack Pointer),指示堆栈区域的栈顶地址 IP:指令指针寄存器(Instr
2016-06-03 11:18:07
2812
原创 图的广度优先搜索(采用邻接表存储方式)
#include <stdio.h>#include <stdlib.h>#define MAXSIZE 20int visited[MAXSIZE];typedef struct node{ int adjvex; struct node * next;}Node;typedef struct{ int vertex; Node * first;}VNode
2016-06-01 20:10:47
1053
转载 CPU核心温度获取
转自:http://blog.csdn.net/xiaibiancheng/article/details/8979011要获取cpu的温度可以通过汇编指令来读取,这里以intel cpu为例,用rdmsr指令读取 IA32_THERM_STATUS_MSR(0x019C)的值,然后用TjunctionMax 减去这个值就是当前cpu的温度,对于一般的intel cpu 的Tj
2016-06-01 16:37:16
17842
3
原创 图的深度优先搜索(采用邻接表存储方式)
#include <stdio.h>#include <stdlib.h>#define MAXSIZE 20int visited[MAXSIZE];typedef struct node{ int adjvex; struct node * next;}Node;typedef struct{ int vertex; Node * first;}VNode
2016-05-31 11:01:56
1432
原创 无向图的邻接矩阵
1、图是一种复杂的数据结构,表现在不仅各顶点的度可以不同,而且顶点之间的关系也错综复杂。从图的定义可知一个图的信息包括两个部分:图中顶点的信息和描述顶点之间关系——边或弧的信息。因此无论采取什么方法来建立图的存储结构,都要完整、准确地反映这两部分的信息。 2、用邻接矩阵存储图,很容易确定图中任意两个顶点之间是否相连。但是,要确定图中具体有多少条边,则必须按行、按列对每个元素进行查找后方能确定,因此
2016-05-30 11:28:30
4122
原创 C++的一些简单示例(4)
5、结构体(1)结构体类型是程序员自定义的构造数据类型,结构体类型由不同类型的成员构成。根据结构体类型定义结构体变量,通过成员运算符“.”对结构体变量的成员进行引用。 (2)定义结构体类型的数组,可同时对多个相同结构体类型的变量进行操作。 (3)typedef可为已有的数据类型定义别名,增强程序的可读性。例一:利用结构体指针变量实现:输入学生数据,然后输出平均成绩。#include <iostr
2016-05-27 15:26:49
337
转载 找一个温暖的爱人有多重要
20岁的时候,大部分女生都会勇敢追求自己喜欢的那个人,不求轰轰烈烈,但求青春无悔,所以明知道会受伤也要学一次飞蛾扑火。 但少女心可以不死,爱的方式却不会一成不变。 经历过一次奋不顾身的爱情以后,姑娘们完成了一次蜕变,也终于明白好的爱情不是用眼泪和心酸来换取,而是欢笑与陪伴。 年轻时候的爱情大多不够成熟,无论是心智还是形式。就像一个男人在最穷困的时
2016-05-26 21:31:51
585
原创 C++的一些简单示例(3)
3、字符串(1)字符串常量与字符常量除了所使用的引号不同以外,最重要的区别是存储形式不同。系统会在字符串的末尾自动添加1个空字符’\0’作为字符串的结束符,所以每个字符串的存储长度总是比其实际长度多1。 例一:从键盘输入三个字符串,找出最长的字符串,将其内容输出。#include <iostream>using namespace std;int main(){ char array[3
2016-05-26 20:53:30
466
原创 C++的一些简单示例(2)
1、数组(1)数组是由若干同一类型的数据元素构成的有序集合。 (2)计算机在编译程序时确定数组长度,而变量在运行时才会有值,因此,定义数组的时候必须使用常量表达式指定数组在各维度上的下标,而不能使用变量。 (3)数组的初始化顺序为从左到右,不能跳过某个元素而初始化后面的元素。 (4)带初始化的二维数组定义可以省略行长,但不能省略列长。Eg: int array[][4] = {{1,2},{2
2016-05-26 20:31:47
293
原创 C++的一些简单示例
1、使用选择排序法对一组数据进行排序#include <iostream>using namespace std;int main(){ int array[4]; int min; int swap; int i = 0; cout<<"please input the values!"<<endl;//使用for循环输入数据到数组中/* for(in
2016-05-26 12:05:06
528
转载 23种设计模式
一、设计模式的分类总体来说设计模式分为三大类:创建型模式,共五种:工厂方法模式、抽象工厂模式、单例模式、建造者模式、原型模式。结构型模式,共七种:适配器模式、装饰器模式、代理模式、外观模式、桥接模式、组合模式、享元模式。行为型模式,共十一种:策略模式、模板方法模式、观察者模式、迭代子模式、责任链模式、命令模式、备忘录模式、状态模式、访问者模式、中介者模式、解释器模式
2016-05-26 10:20:15
969
原创 使用责任链模式过滤字符串
Main这个类将字符串交给MessageProcessor类来处理public class Main { public static void main(String[] args) { String message = "hello world :) <script> 敏感字眼"; String result = null; MessageP
2016-05-26 10:02:02
297
原创 求两个集合的交集、差集和并集
#include <stdio.h>#include <stdlib.h>typedef struct node{ char data; struct node * next;}Linklist;//尾插入法Linklist * createLinklist2(){ char x; Linklist * head,* p,* q; head = (Lin
2016-05-25 16:05:29
5951
1
原创 哈夫曼编码
#include <stdio.h>#define MAXSIZE 30#define MAXBIT 10typedef struct{ int weight; int lchild; int rchild; int parent;}HNode;typedef struct{ int weight; //保存每个叶子节点的权重
2016-05-23 17:05:39
381
原创 线索二叉树
#include <stdio.h>#include <stdlib.h>typedef struct node{ char data; struct node * lchild; struct node * rchild; int ltag; int rtag;}TBTree;TBTree * pre;//创建一颗二叉树TBTree * create(
2016-05-23 11:12:48
330
原创 使用ESESC对功耗和温度进行仿真
ESESC仿真器的安装在这篇文章中我介绍了一下旧版本的ESESC仿真器的安装,接下来我们使用它来进行实验。在实验中主要是修改ESESC的顶层配置文件esesc.conf。1、功耗1、使用下面的命令在终端打开esesc.conf文件。vim esesc.conf2、修改该文件的相关参数。 (1)选择合适的benchmark,例如:benchName = "launcher -- stdin craf
2016-05-20 10:21:54
952
原创 ESESC仿真器的安装(2)
1、ESESC(MIPS)错误当我安装完ESESC仿真器,以为可以使用它进行功耗、温度等实验的时候,却遗憾的发现修改完配置文件,却报出以下这样的错误:因为这个错误我查找了很多资料,也看了ESESC仿真器的源代码,但是纠结很长时间后发现依然解决不了这个问题。后来在逛ESESC论坛的时候,惊喜的发现终于有人解释了这个问题。他是这样说的:“The power doesn’t work in newest
2016-05-20 10:00:44
770
原创 二叉树遍历的应用
#include <stdio.h>#include <stdlib.h>#define MAXSIZE 20typedef struct node{ char data; node * lchild; node * rchild;}BTree;typedef struct{ BTree * data[MAXSIZE]; int top;}SeqSta
2016-05-17 17:37:11
394
原创 由二叉树的遍历序列恢复二叉树
#include <stdio.h>#include <stdlib.h>#define MAXSIZE 30typedef struct node{ char data; node * lchild; node * rchild;}BTree;char pred[MAXSIZE],ind[MAXSIZE];int i=0,j=0;BTree * create(BTr
2016-05-16 16:49:29
1024
原创 二叉树的基本操作(非递归)(修改)
#include <stdio.h>#include <stdlib.h>#define MAXSIZE 20typedef struct node{ char data; node * lchild; node * rchild;}BTree;typedef struct{ BTree * data[MAXSIZE]; int top;}SeqSta
2016-05-16 10:45:27
452
原创 MySQL(1)
1、数据库存储引擎 数据库存储引擎是数据库底层软件组件,数据库管理系统使用数据引擎进行创建、查询、更新和删除数据操作。MySQL的核心就是存储引擎。在MySQL中,不需要在整个服务器中使用同一种存储引擎,针对具体地要求,可以对每一个表使用不同的存储引擎。 InnoDB存储引擎事务型数据库的首选引擎。InnDB给MySQL提供了具有提交、回滚和崩溃恢复能力的事务安全存储引擎。InnoDB是
2016-05-13 21:36:14
284
原创 用两个栈实现一个队列的功能
#include <stdio.h>#include <stdlib.h>#define MAXSIZE 20struct SeqStack{ char data[MAXSIZE]; int top;};SeqStack * initSeqStack(){ SeqStack * s; s = (SeqStack *)malloc(sizeof(SeqStack)
2016-05-13 09:51:53
407
原创 随笔(1)
当初一踏上太原的那片土地,唯一的感觉就是害怕,前所未有的害怕。我想逃,想永远的留在爸妈的身边,永远的窝在小县城里,即使前面只有一方天地,我相信自己也会乐在其中。但我知道许多事情我都无能为力,我没有办法去改变,不是没有魄力而是不忍心伤害。所以我没得选择,所以我只能留下来,所以我只有借眼泪来发泄内心的恐惧。时光匆匆,真的有种“流光容易把人抛,红了樱桃,绿了芭蕉。”的感觉,快六年了,我就这样跌跌撞撞的一
2016-05-12 22:11:14
327
原创 殇
有这样一个女孩,在她上大学后,一直都不知道自己的目标是什么,不知道自己到底想干什么。直到有一天,那天,天气很好,她的舍友叫她一起去看篮球赛,她本不想去,但是又觉得待在宿舍里实在无聊,于是就跟着舍友去了。这一去,就开始了她痛苦的大学生活,因为她喜欢上他,但他却不知道她的存在。她不知道自己为什么会那么喜欢他,或许是他长得帅,或许是他打篮球打的很棒、充满了活力,又或许是他笑的很温暖,不管什么都好,因为她
2016-05-12 21:49:02
423
原创 递归
1、楼梯有n阶台阶,上楼可以一步上1阶,也可以一步上2阶,共有多少种不同的走法?分析:设n阶台阶的走法数为f(n)。 如果有1个台阶,走法有1种,即f(1)=1; 如果有2个台阶,走法有2种(一种是上1阶,再上1阶,另一种是一步上2阶),即f(2)=2; 当n>3时:最后是一步上1个台阶的话,之前上了n-1个台阶,走法为f(n-1)种,而最后是一步上2个台阶的话,之前上了n-2个台阶,走法为f
2016-05-11 16:29:58
266
原创 判断给定的字符串是否是回文数(用栈实现)
#include <stdio.h>#include <stdlib.h>#include <string.h>#define MAXSIZE 20struct SeqStack{ char data[MAXSIZE]; int top;};SeqStack * initSeqStack(){ SeqStack * s; s = (SeqStack *)mal
2016-05-11 15:45:56
2938
原创 检查一个算术表达式中的括号是否匹配
#include <stdio.h>#include <stdlib.h>#include <string.h>#define MAXSIZE 20typedef struct{ char data[MAXSIZE]; int top;}SeqStack;SeqStack * initSeqStack(){ SeqStack * s = (SeqStack *)mal
2016-05-10 15:05:17
3372
原创 将非递减的A表和B表合并为C表,且C表也是非递减的
第一种:顺序表#include <stdio.h>#include <stdlib.h>#define MAXSIZE 20typedef struct{ int data[MAXSIZE]; int len;}SqList;SqList * initSqList(){ SqList * L; L = (SqList *)malloc(sizeof(SqList
2016-05-09 10:50:48
900
原创 Java的一些简单示例(2)
1、乘法口诀表(1)public class Test { public static void main(String[] args) { int array[][] = new int[10][10]; for(int i=0;i<10;i++){ array[0][i] = i; array[i][0] = i;
2016-05-03 23:04:30
372
原创 Java的一些简单示例(1)
1、求两个正整数的最大公约数和最小公倍数import java.util.Scanner;public class Test { public static void main(String[] args) { Scanner s = new Scanner(System.in); System.out.println("please input an integ
2016-04-27 21:12:01
302
原创 按层次遍历二叉树
#include <stdio.h>#include <stdlib.h>#define MAXSIZE 20typedef struct node{ char data; struct node * lchild; struct node * rchild;}BTree;typedef struct{ BTree * data[MAXSIZE]; in
2016-04-27 11:33:58
366
原创 二叉树的基本操作(非递归)
#include <stdio.h>#include <stdlib.h>#define MAXSIZE 20typedef struct node{ char data; node * lchild; node * rchild;}BTree;typedef struct{ BTree * data[MAXSIZE]; int top;}SeqSta
2016-04-26 15:18:18
397
原创 二叉树的基本操作(递归)
#include <stdio.h>#include <stdlib.h>typedef struct node{ char data; node * lchild; node * rchild;}BTree;BTree * create(BTree * p){ char ch; scanf("%c",&ch); if(ch != ' '){
2016-04-26 09:16:18
327
原创 链队列的基本操作
#include <stdio.h>#include <stdlib.h>typedef struct node{ char data; struct node * next;}Qnode;typedef struct{ Qnode * front; Qnode * rear;}LinkQueue;LinkQueue * init(){ LinkQueu
2016-04-24 22:10:10
334
原创 循环队列的基本操作
#include <stdio.h>#include <stdlib.h>#define MAXSIZE 20typedef struct{ char data[MAXSIZE]; int rear; int front;}SeqQueue;SeqQueue * init(){ SeqQueue * sq; sq = (SeqQueue *)malloc
2016-04-24 22:09:08
462
原创 链栈的基本操作
#include <stdio.h>#include <stdlib.h>typedef struct node{ char data; node * next;}LStack;LStack * init(){ LStack * ls; ls = (LStack *)malloc(sizeof(LStack)); ls->next = NULL;
2016-04-24 22:07:47
302
原创 顺序栈的基本操作
#include <stdio.h>#include <stdlib.h>#define MAXSIZE 20struct SeqStack{ char data[MAXSIZE]; int top;};SeqStack * initSeqStack(){ SeqStack * s; s = (SeqStack *)malloc(sizeof(SeqStack)
2016-03-31 22:23:11
312
原创 去除单链表中的重复元素
#include <stdio.h>#include <stdlib.h>struct Linklist{ char data; struct Linklist * next;};Linklist * createLinklist(){ Linklist * head,* p,* q; char x; head = (Linklist *)malloc(s
2016-03-29 15:34:22
379
原创 约瑟夫问题
题目:n个人(编号1~n),从k开始报数,报到m的退出,剩下的人继续从1开始报数。 代码如下:#include <stdio.h>#include <stdlib.h>typedef struct node{ int data; struct node *next;}Linklist;void Josephus(int n,int m,int k){ Linklist
2016-03-29 14:50:54
285
原创 双向链表的基本操作
#include <stdio.h>#include <stdlib.h>struct DLinklist{ char data; struct DLinklist *prior,*next;};DLinklist * createDL(){ DLinklist * head,*p; char x; head = (DLinklist *)malloc(s
2016-03-29 10:56:49
232
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅