happy happy

happy happy

    • 首页
    • 关于
    • 简历
    • 博客

二叉树的深度

//查找二叉树的深度,也就是从根节点到叶子节点所有路径中,最长路径的节点数目 #include <iostream> using namespace std; struct BinaryTreeNode{ int m_nValue; BinaryTr

2016-05-08

指定数字在排序数组中出现的次数

//得到已经排序的数组中指定数字k出现的次数//已经排好序,所以想到用二分查找算法;//重复次数=最后一次出现的位置-第一次出现的位置 #include <iostream> using namespace std; int GetFirstK(int *data,

2016-05-08

两个链表的第一个公共节点

//得到两个链表第一个公共节点并返回 #include <iostream> #include<stdio.h> using namespace std; typedef struct ListNode{ int m_nValue; Lis

2016-05-08

逆序对

//一个数组中的元素构成的逆序对数目//分治法,递归,类似于堆排序 #include <iostream> using namespace std; int InversePairsCore(int* data, int* cpy,int start, int en

2016-05-07

第一个只出现一次的字符

//考察哈希表;字符串//第一个只出现一次 #include <iostream> using namespace std; char FirstNotReaptingChar(char* pString){ if(!pString) ret

2016-05-07

数组排成最小的数

//把数组中数字拼接起来,并打印最小的和 #include <iostream> #include<stdio.h> #include<string.h> #include<algorithm> using namespace st

2016-05-06

找到第n个ugly number

//因子只包含2,3,5的数叫做丑数,//找到第n个丑数,1是第一个 #include <iostream> using namespace std; //***********************第一种方法*********************** //b

2016-05-06

从1到N整数中1出现的次数

//给定数字N,计算从1~N中各个数字位上包含1的个位 #include <iostream> #include<stdio.h> #include<string.h> #include<cstring> #include<a

2016-05-03

子数组最大和

//数组的最大子数组的和并返回//动态规划分f(i)=pData[i] i=0 or f(i-1)<=0;//f(i)=f(i-1)+pData[i] i!=0 and f(i-)>0; #include <iostream> using namesp

2016-05-02

最小的K个数

#include <iostream> #include<algorithm> #include<set> #include<vector> using namespace std; //0(n)时间找到最小的K个数,而且这K个数

2016-05-02
Prev1234567Next

友情链接

  • My Github
  • Wxj's Blog
RSS 订阅

新浪微博

Hello ,I'm Wang xiaojing in Tianjin University.
This is my blog, welcome!

Powered by hexo and Theme by Jacman © 2016 王晓静