自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(23)
  • 资源 (2)
  • 收藏
  • 关注

原创 数据结构之大O、大Ω和大Θ

一、大O记号(big-O notation) T(n) = O( f(n) ) if ∃c > 0,当 n >>2后,有T(n) < c*f(n). 1.常数(constant function) 2 = 2013 = 2013*2013 = 2013^2013 = O(1).像这类的算法效率最高 2.对数O(logn) 常底数无所谓,常数次幂无所谓,这类算法也非常有效,复杂的无限接近

2016-01-12 22:02:34 6041 1

原创 C++Primer之友元

要想令某个成员函数作为友元,例如,在Wondow_mgr中的成员函数clear需要调用Screen类中的私有成员,则必须按照如下方式设计程序: 1.首先定义Window_mgr类,其中声明clear函数,但是不能定义它,在clear使用Screen的成员之前必须先声明Screen; 2.接下来定义Screen,包括对clear的友元声明; 3.最后定义clear,此时它才可以使用Screen的

2016-01-11 11:18:03 486

原创 C++Primer之字符串

1.字符串在相加时,必须确保每个加法运算符(+)的两侧的运算对象至少有一个是string: string s1 = “Hello”; string s2 = “World”; string s4 = s1 + “, “;//right string s5 = “Hello” + “, “;//error string s6 = s1 + “, ” + “World”;//right st

2015-11-10 22:08:07 286

原创 C++Primer之复合类型

1.引用 为对象起的另外一个名字,本身不是对象,在定义时必须初始化。例如: int iVal = 1; int &refVal = iVal;//refVal指向iVal,是iVal的另一个名字 int &refVal2;//报错,引用必需初始化 除个别外,引用的类型必须和与之绑定的对象严格匹配,且引用只能绑定在对象上,不能与字面值或某个表示式的计算结果绑定在一起。例如:

2015-11-04 20:19:43 525

原创 操作系统之死锁

死锁是指两个或两个以上的进程在执行过程中,因争夺资源而造成的一种相互等待的现象若无外力作用,他们都将无法推进下去。此时系统处于死锁状态或系统产生了死锁。 产生死锁的四个必要条件: (1)互斥条件:一个资源每次只能被一个进程使用; (2)请求与保持条件:一个进程因请求资源而阻塞时,对已获得的资源保持不放; (3)不剥夺条件:进程已获得的资源,在未使用完之前,不能强行剥夺

2015-10-13 21:08:09 270

原创 内存考点

1.经常需要操作的内存类别 (1)栈区(stack):由编译器自动分配和释放,存放函数的参数值、局部变量等,其操作方式类似于数据结构中的栈。 (2)堆区(heap):一般由程序员分配和释放,若程序员不释放,程序结束时可能由操作系统收回。它与数据结构中的堆是两回事,分配方式类似于链表。 (3)全局区(静态区)(static):全局变量和静态变量的存储是放在一块的,初始化的全局变量和静态变量在一块

2015-09-14 22:07:29 266

原创 数据结构之队列 C++实现

队列很重要的一点就是入队在队尾进行,出队在队首进行,所以又把队列称为先进先出表。功能实现 1.入队功能 使用链表实现#include"iostream"using namespace std;typedef struct student{ int data; student* next;}Node;typedef struct linkQueue{ Node *firs

2015-09-14 21:36:07 425

原创 栈考点

1.函数调用时的参数传递和栈帧结构 调用函数时首先进行参数入栈,一般情况下压栈顺序为从右到左,例如: int i = 0x22222222; char szTest[] = “aaaa”;//a的ASCII码为0x61 func(i , szTest); 调用上面函数时,先压szTest,再压i,最后压函数地址,但是压szTest的时候不是直接压0x61616161

2015-09-14 21:12:30 412

原创 【LeetCode】之Evaluate Reverse Polish Notation

Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another expression.Some examples:[“2”, “1”, “+”, “3”, ““] ->

2015-09-14 18:25:46 193

原创 数据结构之栈 C++实现

栈的最重要的一点就是栈的插入和删除运算仅在栈顶一端进行,后进栈的元素必定先出栈,所以又把栈称为后进先出表。功能实现 1.实现入栈功能 使用链表实现栈。#include "iostream"using namespace std;typedef struct student{ int data; student *next; student(int x) :dat

2015-09-07 11:15:11 255

原创 【LeetCode】之Valid Parentheses

Given a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[’ and ‘]’, determine if the input string is valid.The brackets must close in the correct order, “()” and “()[]{}” are all valid but “

2015-09-07 09:09:12 232

原创 【LeetCode】之Valid Palindrome

Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example, “A man, a plan, a canal: Panama” is a palindrome. “race a car” is not a palin

2015-09-05 21:25:16 268

原创 数据结构之单链表 C++实现

1.实现一个单链表的定义,生成,长度计算和元素的显示。#include"iostream"using namespace std;typedef struct student{ int data; student *next; student(int x) :data(x), next(NULL){}}ListNode;/*生成一个单链表*/ListNode* cre

2015-09-04 17:07:47 474

原创 【LeetCode】之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 linke

2015-09-03 09:44:35 275

原创 【LeetCode】之Remove Duplicates from Sorted Array II

Follow up for “Remove Duplicates”: What if duplicates are allowed at most twice?For example, Given sorted array nums = [1,1,1,2,2,3],Your function should return length = 5, with the first five elemen

2015-09-02 20:30:40 214

原创 【LeetCode】之Remove Duplicates from Sorted Array

Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this in place with cons

2015-09-02 18:39:05 221

原创 【LeetCode】之Remove Duplicates from Sorted List

Given a sorted linked list, delete all duplicates such that each element appear only once.For example, Given 1->1->2, return 1->2. Given 1->1->2->3->3, return 1->2->3. 此题目的在于将一个已排好序的链表中重复的节点删除,只保留一个。

2015-09-02 11:10:36 340

原创 【LeetCode】之Linked List Cycle

Given a linked list, determine if it has a cycle in it.此题目的在于判断一个链表是否是一个循环链表。思路: 1.先定义两个节点指针first和second; 2.first每次走一步,second每次走两步; 3.若second && second->next为NULL,则返回false,此判断是因为如果second为NULL,则 sec

2015-08-31 20:32:35 219

原创 【LeetCode】之Swap Nodes in Pairs

Swap Nodes in PairsGiven a linked list, swap every two adjacent nodes and return its head.For example, Given 1->2->3->4, you should return the list as 2->1->4->3.Your algorithm should use only

2015-08-26 22:22:11 200

原创 【LeetCode】之Remove Nth Node From End of List

Remove Nth Node From End of ListGiven a linked list, remove the nth node from the end of list and return its head.For example,Given linked list: 1->2->3->4->5, and n = 2.After removing the second node

2015-08-26 21:38:22 237

原创 【设计模式】学习笔记之简单工厂模式

一、简单工厂模式属于类的创建型模式,又叫静态工厂方法模式,通过专门定义一个类来负责创建其他类的实例,被创建的实例通常都具有共同的父类。 二、模式中包含的角色及其职责: 1.工厂(Creator)角色 简单工厂模式的核心,它负责实现创建所有实例的内部逻辑。工厂类可以被外界直接调用,创建所需的产品对象。 2.抽象(Product)角色 简单工厂模式所创建的所有对象的父类,它负责描述所有实例所共

2015-07-16 17:03:52 276

原创 【设计模式】学习笔记之设计原则

设计模式学习笔记之设计原则这好像是我第一次开始写博客,还是有点激动的,俗话说的好,好记性不如烂笔头,更何况我的记性还不好,所以我决定在学习设计模式的同时,将其中自己认为重要的知识点记录下来,让以后自己回头查找知识点的时候能更快一些。设计原则详解 设计模式存在的根本原则是为了代码的复用,增加可维护性。有如下原则: 1. 开闭原则:对扩展开放,对修改关闭。 2. 里氏转换原则:子类继承父类,单

2015-07-06 15:34:18 237

原创 cocos2dx项目打包APK环境安装

1.搭建Android环境所需安装包 (1)Eclipse (2)JDK (3)Android SDK (4)Android NDK (5)Ant 2.环境配置 2.1 jdk环境配置 (1)安装jdk (2)点击jdk-7u51-windows-x64.exe进行安装即可。 (3)新建环境变量:JAVA_HOME 值为:D:\Program Files\Java\jdk1

2015-06-22 16:53:30 961

leetcode题解

leetcode在线题库上的题目,文档里面列出了151道题的解法,代码使用C++语言编写的,有的题目给出了几种解法,并且文档已经把这些题目进行了归类,很适合学习。

2015-09-15

数据挖掘概念与技术 第三版(中文版+英文版PDF)

数据挖掘概念与技术,学数据挖掘必备的书籍,有英文和中文的PDF,内容很清晰,值得一看

2014-12-14

空空如也

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

TA关注的人

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