自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 java基础

1、string,stringbuffer,stringbuilder运行速度,或者说是执行速度,在这方面运行速度快慢为:StringBuilder > StringBuffer > String 在线程安全上,StringBuilder是线程不安全的,而StringBuffer是线程安全的2、堆(大根堆、小根堆)Min-heap: 父节点的值小于或等于子节点的值;...

2019-02-19 23:05:28 77

原创 Collections类

分析

2019-01-23 19:44:00 224

原创 奇偶调整

一串长数字,把奇数放在前半部分偶数放在后半部分定义两个指针,一个指向开头,一个指向结尾,指针移动,若前部指针指向出现偶数  后半部分出现奇数,互换数字,直到两个指针相等;...

2018-03-21 23:30:44 253

原创 高质量C++/C编程指南--类的继承与组合

1、面向对象热点COM和CORBA;2、不相干的比继承,逻辑相关则继承;3、若在逻辑A是B的一部分,不允许B从A派生,用A和其它组合出B;

2017-03-29 16:27:25 182

原创 高质量c++/c编程指南--其它编程经验

1、指针或者引用传递用作输出,不能用const修饰,或者失去输出功能;2、参数是指针,用const修饰,防止修改;值传递没有必要,因其使用的是其对应的副本;3、对于非内部数据类型,例如类,使用引用,不需要产生副本调用构造函数与析构函数,可以使用const修饰,对于正常类型按值传递,不需要使用引用,因效率差不多;4、const修饰函数返回,必须使用const变量接收;对于按值返回,加上c

2017-03-29 16:21:04 157

转载 jsp三种提示对话框

对话框有三种1:只是提醒,不能对脚本产生任何改变;2:一般用于确认,返回 true 或者 false ,所以可以轻松用于 if...else...判断3: 一个带输入的对话框,可以返回用户填入的字符串,常见于某些留言本或者论坛输入内容那里的 插入UBB格式图片下面我们分别演示:@LANGUAGE="JAVASCRIPT" CODEPAGE="936"%>

2016-01-13 15:26:23 1307

原创 游戏服务器组成

服务器构造如下:

2015-09-06 22:16:53 400

原创 cmake编译文件生成android工程

问题提出:1.在生成android或者ios工程时,因代码使用vs编写,最终生成android和ios工程时完全不一样的,现在需要生成过程能够跨平台;2.cmake是一个跨平台编译工具,只需选择不同平台的工具链即可生成相应平台的工程;3.此过程与cocos2d生成的工程类似,直接跨平台;具体步骤与注意事项:使用工具android、ios工具链文件,android游戏开发ndk,

2015-08-21 17:36:38 3800

原创 二元树的深度

#include using namespace std;//创建树节点结构体typedef struct TreeNode{ int data_in; TreeNode *m_left; TreeNode *m_right;}*BitTree,bitTree;//树高度int TreeHight(BitTree &bittree);//创建树节点void Creat

2014-09-05 17:31:38 438

原创 和为n连续正数序列

#include using namespace std;int CountN(int number);int main(){ int m=5; int count_n=CountN(m); system("pause"); return 0;}int CountN(int number){ int number1=1; int number2=2; int c

2014-09-05 16:56:22 303

原创 栈的push、pop序列

#include #include using namespace std;bool StackPop(int *p1,int *p2,int length);int main(){ int p1[]={1,2,3,4,5}; int p2[]={4,5,3,3,1}; bool xx=StackPop(p1,p2,5); system("pause"); return

2014-09-05 16:19:25 414

原创 整数二进制表示中1的个数

#include using namespace std;int BitOneNumbers(int i);int main(){ int i; cin>>i; int numbers=BitOneNumbers(i); system("pause"); return 0;}int BitOneNumbers(int i){ int counts=0; wh

2014-09-05 15:40:08 292

原创 反转链表[数据结构]

#include using namespace std;struct NodeLink{ int data_in; NodeLink *next;};NodeLink *Rever(NodeLink *node);int main(){ NodeLink *head,*Node,*temp; int data_in; cin>>data_in; Node=new No

2014-09-03 13:48:55 333

原创 用两个栈实现队列[数据结构]

#include #include using namespace std;void StackToQueue(void);int main(){ StackToQueue(); system("pause"); return 0;}//实现stack to queuevoid StackToQueue(){ stack temp1; stack temp2; i

2014-09-03 13:02:36 290

翻译 把字符串转换成整数[算法]

#include #include using namespace std;long long CharToInt(char *str);int g_valid;enum Valid_str{ Valid=0, Invalid};int main(){ char *ch="-1232324324324"; long long num=CharToInt(ch); s

2014-09-03 12:37:58 405

翻译 O(logn)求Fibonacci数列[算法]

#include #include using namespace std;//定义2*2矩阵struct Mxtri2{ Mxtri2(long long m00=0,long long m01=0,long long m10=0,long long m11=0) { m_00=m00; m_01=m01; m_10=m10; m_11=m11; } long

2014-09-03 10:35:58 403

原创 Add Two Numbers

/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: ListNode *addTw

2014-09-02 22:54:45 558

原创 Longest Substring Without Repeating Characters

#include #include using namespace std;class Solution {public: int lengthOfLongestSubstring(string s) { int length_substr=0; int temp=0; int hashTable[256]; int i=0; while (i!=256) {

2014-09-02 22:51:56 288

翻译 圆圈中最后剩下的数字

#include using namespace std;typedef struct LinkNode{ int data_in; LinkNode *next;};LinkNode* LasterNum(LinkNode *node,int m);int main(){ LinkNode *node,*head; node=new LinkNode; head=n

2014-09-02 19:31:49 274

翻译 第一个只出现一次的字符

#include #include using namespace std;char OutOnceTimes(string str);int main(){ string str; cin>>str; char OnceTime=OutOnceTimes(str); system("pause"); return 0;}char OutOnceTimes(stri

2014-09-02 16:21:39 298

翻译 从上往下遍历二元树

#include #include #include using namespace std;//创建树结构typedef struct node{ int data; struct node *ltree,*rtree;}*BitTree,bitTree;//创建树函数void creat_tree(BitTree &tree);void PrintFromTopToB

2014-09-02 15:26:42 440

翻译 求二元查找树的镜像

#include #include using namespace std;//创建树结构typedef struct node{ int data; struct node *ltree,*rtree;}*BitTree,bitTree;//创建树函数void creat_tree(BitTree &tree);void MirrorRecursively(BitTree

2014-09-02 15:14:11 270

翻译 求二元查找树的镜像

#include using namespace std;//创建树结构typedef struct node{ int data; struct node *ltree,*rtree;}*BitTree,bitTree;//创建树函数void creat_tree(BitTree &tree);void MirrorRecursively(BitTree &pNode);

2014-09-02 15:13:30 300

原创 排序数组中和为给定值的两个数字

#include #include #include using namespace std;class Solution {public: vector twoSum(vector &numbers, int target) { vector > temp; for( unsigned int i=0; i<numbers.size(); ++i ) { pai

2014-09-02 12:41:01 285

翻译 链表中倒数第k个结点

#include using namespace std;typedef struct NodeLink{ int data_in; NodeLink *next;};NodeLink* EndK(NodeLink *Node,int k);int main(){ NodeLink *node=NULL,*head,*temp; int data_in; node=

2014-09-02 12:35:49 305

翻译 翻转句子中单词的顺序

#include #include using namespace std;void ReverseStr(char* str_in,char* str_out);void Reverse(char *pBegin,char *pEnd);int main(){ char* str_resever="I am a student"; char* str_return="";

2014-09-01 20:04:18 282

翻译 二元查找树的后序遍历结果

#include using namespace std;bool Veri_BST(int data_in[],int length);int main(){ int n; cin>>n; int *data_in=new int[n]; //输入数组 for (int i=0;i>data_in[i]; } bool ver=Veri_BST(data_in,n);

2014-09-01 11:15:41 314

翻译 查找最小的k个元素

#include#include #include #include#includeusing namespace std;typedef multiset> HeapMax;//获取k个最小的数void Min_Num(unsigned int k,HeapMax& Heap_Max,vector &Data_vector);int main(){ std::vector

2014-09-01 10:38:18 282

翻译 二元树中和为某一值的所有路径

#include #include using namespace std;typedef struct BitTree{ int data; struct BitTree *m_pLeft,*m_pRight;}*NodeTree,nodetree;void Creat_Tree(NodeTree &tree);void FinfPath(NodeTree &path

2014-09-01 09:41:55 292

原创 子数组的最大和[算法]

#include#define LENG 10using namespace std;int Max_num(int max_num[],int leng);int main(){ int data_in[LENG]; int max_data=0; for (int i=0;i>data_in[i]; } max_data=Max_num(data_in,LENG);

2014-08-28 21:53:13 291

原创 设计包含min函数的栈[数据结构]

#include #include #include using namespace std;template class CStackWithMin{public: CStackWithMin(){}; virtual ~CStackWithMin(){}; T& top(void); const T& top(void) const; void push(const T

2014-08-28 20:53:23 319

原创 把二元查找树转变成排序的双向链表

#include using namespace std;//创建树结构typedef struct node{ int data; struct node *ltree,*rtree;}*BitTree,bitTree;//创建树函数void creat_tree(BitTree &tree);void mid_travel(BitTree tree,BitTree &bs

2014-08-25 23:04:01 249

原创 二叉树创建与访问

#include using namespace std;//创建数结构typedef struct node{ int data; struct node *ltree; struct node *rtree;}*BitTree,bitTree;void creat_tree(BitTree &tree);void pre_travel(BitTree &tree);v

2014-08-22 23:04:31 391

翻译 C++面试

题目(一):我们可以用static修饰一个类的成员函数,也可以用const修饰类的成员函数(写在函数的最后表示不能修改成员变量,不是指写在前面表示返回值为常量)。请问:能不能同时用static和const修饰类的成员函数?分析:答案是不可以。C++编译器在实现const的成员函数的时候为了确保该函数不能修改类的实例的状态,会在函数中添加一个隐式的参数const this*。但当一个成员

2014-08-22 19:21:55 242

翻译 复杂链表的复制

1、先建立单链表;从开始判断指向的dia

2014-08-21 20:42:34 299

翻译 数组中出现次数超过一半的数字

1、先排序,再查看个数;2、hashtable,jiez

2014-08-21 19:54:56 279

翻译 对称子字符串的最大长度

1、例如判断aAa,如果A是,那么aAa是;2、首先从中心

2014-08-21 19:38:23 323

翻译 n个骰子的点数

把骰子分成两堆1和n-1,再把n-1分成1和n-2,递归,

2014-08-21 19:16:18 278

原创 旋转数组的最小元素

{3, 4, 5, 1, 2}为{1, 2, 3, 4, 5}的旋转1、dingyi

2014-08-21 19:09:59 240

翻译 把数组排成最小的数

// Maxinum int number has 10 digits in decimal systemconst int g_MaxNumberLength = 10; // String buffers to combine two numberschar* g_StrCombine1 = new char[g_MaxNumberLength * 2 +

2014-08-21 19:02:55 310

空空如也

空空如也

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

TA关注的人

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