自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(29)
  • 资源 (3)
  • 收藏
  • 关注

原创 admin

跨平台交易– 对冲 策略+技术–量化交易 http://www.laiteb.com/ http://8btc.com/thread-29381-1-1.html http://www.360doc.com/content/15/0629/19/175820_481533801.shtml https://zhidao.baidu.com/question/16896962697794475

2017-04-11 14:54:09 422

原创 ubuntu 更新源

更新目录/ect/apt/sources.list所用源: https://segmentfault.com/a/1190000003970895?_ea=500425

2017-01-12 17:11:47 272

原创 fork()

#include <unistd.h> #include <stdio.h>#include<stdlib.h>int main(){ int x =1; if(fork()==0) { printf("printf1 x=%d \n",++x); exit(0); } printf("printf2 x=%d

2016-08-04 17:17:11 298

转载 虚析构函数

http://www.cnblogs.com/lixiaohui-ambition/archive/2012/07/13/2589716.html

2016-08-01 20:08:19 228

原创 sizeof()

#include <iostream>#include <string>using namespace std;int main(){ char* str = "Hello"; char str1[] = "hello"; int data[] = {1,2}; cout << sizeof(str)<<endl; cout << sizeof(str1)<<e

2016-07-29 22:24:23 219

原创 字符数字相减 (在求后缀表达式用到的)

#include <iostream>using namespace std;int main(){ char c = '6'; int x = c - '0'; char y = c - '0'; int z = (int) c; cout << " int '6' - '0' = " << x << endl; cout <<"char '6'

2016-06-23 20:23:12 400

原创 字符串哈希表

从第一个字符串中删除在第二个字符串中出现的所有字符 “We are students” “aeiou” “W r studnts” 我们可以设置两个指针pfast和pslow,初始化时两个都指向字符串中的第一个字符,pfast碰到一个需要删除的字符直接跳过;pfast如果碰到不需要删除的字符,就把该字符复制给pslow,同时pfast后移(继续需找),pslow(指向下一个位置)。这样整个算

2016-05-11 10:45:27 2295

转载 从1到n整数中1出现的次数

#include<stdio.h>long long int Count(long long int n){ //1的个数 long long int count = 0; //当前位 long long int Factor = 1; //低位数字 long long int LowerNum = 0; //当前位数字 long lo

2016-05-09 20:36:05 310

原创 2016/5/3

栈的压入、弹出序列int *a; int *b; a=b; a++; printf("a=%p , b=%p ,a=%d ,b=%d, a-b= %d",a,b,a,b,a-b);

2016-05-03 21:34:22 235

原创 c++ 副作用和顺序点

#include <iostream>#include <cmath>using namespace std;int main(int argc, char* argv[]){ int a=0,b=0; while (a < 10) { cout <<' '<<a; a++; } cout << endl;

2016-04-25 17:30:59 537

原创 两个队列模拟栈

http://www.cnblogs.com/kaituorensheng/archive/2013/03/02/2939690.html

2016-04-24 20:35:26 240

原创 两个栈模拟一个队列

两个栈模拟一个队列,1号栈为入队,栈顶表示队尾;2号栈为出队,栈顶表示队首。入队,直接进1号栈; 出队,先判断2号栈是否有元素,有元素就直接弹出栈顶即队首,如果2号栈没有元素,则将1号栈的元素顺序弹出并进2号栈真正性能较高的,其实是另一个变种。即: 入队时,将元素压入s1。 出队时,判断s2是否为空,如不为空,则直接弹出顶元素;如为空,则将s1的元素逐个“倒入”s2,把最后一个元素弹出并出队。

2016-04-20 13:54:47 398

原创 中缀表达式变后缀:栈实现

#include <iostream>#include <vector>#include <stack>#include <string>#include <cstdlib>#include <cctype>#include <cstring>using namespace std;vector<string> preParse(char *str) //对中缀表达式进行预处理,

2016-04-19 23:40:47 300

原创 栈:中缀表达式转后缀表达式求值(不大于10)

#include <iostream>#include <vector>#include <stack>#include <string>#include <cstdlib>#include <cctype>#include <cstring>using namespace std;#include <stdio.h>bool IsOperator(char ch){ ch

2016-04-19 20:52:28 477

转载 堆栈实现

http://blog.csdn.net/jjzhoujun2010/article/details/6856164

2016-04-17 16:06:51 316

原创 字符串全排列

1、 例子:‘1234’ 1-234 2-134 3-214 4-231保证不重复,再后面全排列完成后,交换,保持原来的‘1234’ 全排列就是从第一个数字起每个数分别与它后面的数字交换。#include<iostream>using namespace std;#include<assert.h>void Swap(char *a , char *b){ char t;

2016-04-12 19:29:30 348

原创 atoi实现

1、 表示字符常量,使用时,是转变换成字符对应的ASCII值. 如下, ‘0’对应的ASCII值: 48 ‘1’——————–49 ‘2’——————–50 . ‘9’——————–57‘a’——————97 ‘A’——————65 printf(“%d\n”,‘9’-‘3’);2、 int 取值范围(4字节) 0x80000000 ~ 0x7fffffff(-21474836

2016-04-11 16:09:09 260

转载 程序设计中利用“按位异或”运算交换两个变量的值原理

http://blog.sina.com.cn/s/blog_6299458c0101a7qt.html

2016-04-10 21:29:19 457

原创 在O(n)的时间复杂度内找出数组中出现次数超过了一半的数

题目来自程序员面试笔试宝典:P303 采用阵地攻守的思想: 第一个数字作为第一个士兵,守阵地;count = 1; 遇到相同元素,count++; 遇到不相同元素,即为敌人,同归于尽,count–;当遇到count为0的情况,又以新的i值作为守阵地的士兵,继续下去,到最后还留在阵地上的士兵,有可能是主元素。 再加一次循环,记录这个士兵的个数看是否大于数组一般即可。 本题O(n)的思想是,定义两个

2016-04-08 21:28:46 405

原创 冒泡、插入、希尔排序

#include <stdio.h>#include <stdlib.h>#include <stdbool.h>#define true 1#define false 0inline void Swap(int *a, int *b){ int c; c=*a; *a = *b; *b = c;}void Bubblesort(int a[],int

2016-04-08 16:04:35 262

原创 分治法求数组最大最小值

常规的做法是遍历一次,分别求出最大值和最小值,但我这里要说的是分治法(Divide and couquer),将数组分成左右两部分,先求出左半部份的最大值和最小值,再求出右半部份的最大值和最小值,然后综合起来求总体的最大值及最小值。这是个递归过程,对于划分后的左右两部分,同样重复这个过程,直到划分区间内只剩一个元素或者两个元素。#include <stdio.h>#include <stdlib.

2016-04-08 09:09:26 3249

原创 快速排序

#include <stdio.h>#include <stdlib.h>void quicksort(int a[],int left,int right){ int i,j,t,temp; if(left>right) return; temp=a[left]; i=left; j=right; while(i!=j) {

2016-04-07 14:16:42 260

原创 归并排序

#include <stdio.h>#include <stdlib.h>//将有二个有序数列a[first...mid]和a[mid...last]合并。void mergeArray(int a[], int c[],int left,int mid,int right){ int i, j; j=mid+1; i=left; int m=mid;

2016-04-07 10:25:09 233

原创 希尔排序

#include <stdio.h>void swap(int *x,int *y){ int tmp; tmp=*x; *x=*y; *y=tmp;}void Shellsort(int a[],int n){ int gap; int tmp; int i,j; for(gap=n/2; gap>0; gap/=2)

2016-04-06 16:21:52 231

原创 插入排序

#include <iostream>#include <stdlib.h>#include <time.h>#include <stdio.h>using namespace std;void Insertsort(int a[], int n){ int i, j; int tmp; for (i = 1; i < n; i++) { t

2016-04-05 15:35:29 280

原创 二叉搜索树转换为双向链表

#include <iostream>#include <stdlib.h>#include <time.h>#include <stdio.h>using namespace std;typedef struct BinaryTreeNode{ int m_nValue; BinaryTreeNode* m_pLeft; BinaryTreeNode* m_pR

2016-03-30 15:50:10 279

原创 根据遍历结果,构造二叉树

根据前序遍历和中序遍历构造二叉树/*函数1:函数返回构造的二叉树,同时输出后序遍历结果。*/TNode* BinaryTreeFromOrderings(int* inorder, int* preorder, int length){ TNode* node ; if(length == 0) { return NULL; } // TNode* n

2016-03-29 14:45:59 313

原创 ADT(Abstract data type)

电影接口(链表实现)#define TSIZE 45struct film{ char title[TSIZE]; int rating;};typedef struct film Item;//用typedef工具将Item定义为所需类型//可以再其余的定义中使用Item类型。如果以后需要其他形式数据的列表,可以//从新定义Item,而其余接口保持不变。typedef

2016-03-23 14:59:26 334

原创 头文件中ifndef define...endif

在一个大的软件工程里面,可能会有多个文件同时包含一个头文件,当这些文件编译链接成一个可执行文件时,就会出现大量重定义的错误。在头文件中实用#ifndef #define #endif能避免头文件的重定义。 方法:例如要编写头文件test.h 在头文件开头写上两行:ifndef _TEST_Hdefine _TEST_H//一般是文件名的大写头文件结尾写上一行:#endif这样一个工程文件里同时包

2016-03-22 16:15:04 743

51单片机双机通信与锯齿波输出proteus仿真(汇编)

51单片机双机通信与锯齿波输出proteus仿真(汇编)

2013-07-04

高二物理传感器

高二物理传感器高二物理传感器高二物理传感器高二物理传感器高二物理传感器高二物理传感器

2012-10-29

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除