自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(14)
  • 收藏
  • 关注

原创 求最大子数组

求一组数列的最大字数组,并求出位置,遍历一遍即可。 #include #include #include using namespace std; const int numCount=20; int numArray[numCount]={11,3,-3,2,45,-6,5,-75,75,-1,-21,-77,-8,-2,-72,-14345,-3245,-55,-28,1111

2015-06-30 17:49:47 361

原创 升级用户聊天室

新增:用户注册,用户发言表情和字体颜色,在线用户统计,注销用户。 主要有4个界面,代码如下: 登陆界面: uesr login function nameGetFocus(){ // alert("please input your password"); document.frmLogin.user_name.focus(); } function CheckValid(

2015-06-30 16:00:04 274

原创 简单的网络聊天室

分为三块: 登陆界面,主界面,刷新界面,发送界面。 (1)登陆界面 uesr login welcom to chatting room input your nickname (2)主界面 <?php session_start(); // $user_name= $_SESSION["user_name"]=$_POST[

2015-06-29 21:14:55 398

原创 (leetcode)Longest Substring Without Repeating Characters

Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3. Fo

2015-06-29 21:12:18 281

原创 分治法进行排序

#include #include using namespace std; std::vector v1; std::vector v2; int numArray[5]={8,21,66,158,15}; void merge(int * num,int begin,int mid,int end){// 对两个分治的数组进行何合并 int temp1=begin;

2015-06-22 22:04:13 311

原创 求1-n中数字出现的次数

求1~n 中数字出现的次数,如1-852  中1出现的次数,符合条件的有,1,,1,1,12,13,14,。。。。。。参考《编程之美》,略有修改,扩展到可以求任意数字出现的次数,也可以求出现0的次数。 直接上代码:#include   using namespace std;  const int needCountNum=9; int countNum1(int num){ int

2015-06-22 19:15:13 489

原创 leetcode(2)add two numbers

You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a link

2015-06-22 00:32:34 240

原创 重载全局new/delete具体实现内存检测

按照上面转载的文章的思路,只是小小的实现了一下。还有很多不足,等到有想法的时候再修改。#include #include using namespace std; template class smartPtr { public: smartPtr(T *ptr):_ptr(ptr),useCountPtr(new int(1)){ } smartPtr(const sm

2015-06-21 23:13:48 291

转载 重载全局new/delete实现内存检测

原文地址:http://blog.csdn.net/hzyong_c/article/details/5949314 下面介绍用重载new/delete运算符的方式来实现一个简单的内存泄露检测工具,基本思想是重载全局new/delete运算符,被检测代码调用new和delete运算符时就会调用重载过的operator new和operator delete,在重载的operator ne

2015-06-21 23:11:59 392 1

原创 智能指针的简单实现

智能指针:它的一种通用实现方法是采用引用计数的方法。智能指针将一个计数器与类指向的对象相关联,引用计数跟踪共有多少个类对象共享同一指针。有两种实现方法,本例简单的实现了智能指针。#include #include using namespace std; template class smartPtr { public: smartPtr(T *ptr):_ptr(ptr),useCoun

2015-06-21 14:59:31 258

原创 插入排序

使用for循环,写的 #include using namespace std; const int arrayNum=10; int myNums[arrayNum]={3,24,4,1,4,5,667,3,3,9}; void insertSort(int *nums){ for (int i = 1; i < arrayNum; ++i) { int tempNum=nums[i]

2015-06-20 23:32:49 299

原创 全排列实现

实现任意数组的全排列,可重复。#include #include using namespace std; int numArray[4]={1,1,0,1}; void permutation(int *nums,int start,int end){ if (start==end) { /* code */ for (int i = 0; i < 4; ++i

2015-06-19 22:54:12 235

原创 leecode(1)Two Sum

Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two numbers such that they add up to the target, whe

2015-06-19 18:27:57 275

原创 遍历网格

1,11,22,1 2,23,13,3 从(1,1)到达(3,3),下面为解决方法,使用了递归的方法,也可以使用栈的方法。类似,只不过需要掌握好进出栈就可以了。 #include #include using namespace std; const int rowCount=3;//行数和列数 const int colomCount=1; int stepCount=-1;//路径数目

2015-06-19 18:22:16 2070

空空如也

空空如也

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

TA关注的人

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