自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 Linux笔记

linux下载源的指定.目录为/etc/yum.repos.d/Centos-Base.repo 修改其中的url即可,最后执行,yum clean all;yum makecache;yum update;   ifconfig命令not found.一般是环境变量没有配置好 修改如下:export PATH=$PATH:/sbin   Centos安装命

2017-07-12 15:55:18 559

原创 二查平衡树的插入与删除(四种旋转)

// AVL.cpp : Defines the entry point for the console application. //#include "stdafx.h" #include <iostream> using namespace std; //最近需要面试,写以下二查平衡树的插入,删除代码。加深印象,其中的难点是旋转问题。 //有不正确的地方,恳请批评指正!typedef stru

2016-09-28 15:16:59 961

原创 二查排序树的基本操作(插入,删除,找前驱与后继)

// Binary-Search-Tree.cpp : Defines the entry point for the console application. //最近要面试,想自己写写这类算法的代码,加深印象 #include "stdafx.h" //参考算法导论的伪代码编写 //有错误的地方,恳请大家批评指正,thx; typedef struct Node { int val; N

2016-09-27 12:28:28 1216

原创 Windows程序设计基础(1)

窗口程序创建的过程 创建窗口类 WNDCLASS wndclass; 注册窗口类 RegisterClass(&wndclass); 创建窗口 hwnd = CreateWindow(...); 显示窗口 ShowWindow(hwnd,iCmdShow); 更新窗口 UpdateWindow(hwnd); //产生第一条WM_PATINT消息 消息循环 while(GetMessage(&msg

2016-04-10 12:32:53 963

原创 c++ 基础知识(1)

New和Delete 内置类型对象或未提供默认构造函数的类类型对象必须显示初始化 int* a = new int; //a未初始化 int* b = new int(); //b初始化为0 delete后,应该将指针赋值为NULL,否则该指针成为“悬垂指针”,悬垂指针是指向曾经存放对象的内存,但该对象已经不再存在了。 C++保证:删除0值的指针是安全的 显示类型转换 调用方式:

2016-03-31 14:21:27 637

转载 duilib各种布局的作用,相对布局与绝对布局的的意义与用法

duilib各种布局的作用,相对布局与绝对布局的的意义与用法 标签: duilibxml入门布局c++ 2014-08-13 11:46 8469人阅读 评论(14) 收藏 举报  分类: duilib(78) duilib 精品(33)  版权声明:本文为博主原创文章,未经博主允许不得转载。 转载请说明原出处,谢谢~~

2015-12-01 13:51:51 835

原创 PAT 1005. 继续(3n+1)猜想

卡拉兹(Callatz)猜想已经在1001中给出了描述。在这个题目里,情况稍微有些复杂。 当我们验证卡拉兹猜想的时候,为了避免重复计算,可以记录下递推过程中遇到的每一个数。例如对n=3进行验证的时候,我们需要计算3、5、8、4、2、1,则当我们对n=5、8、4、2进行验证的时候,就可以直接判定卡拉兹猜想的真伪,而不需要重复计算,因为这4个数已经在验证3的时候遇到过了,我们称5、8、4、2是被

2015-10-28 18:58:54 603

原创 PAT 1003. 我要通过!

“答案正确”是自动判题系统给出的最令人欢喜的回复。本题属于PAT的“答案正确”大派送 —— 只要读入的字符串满足下列条件,系统就输出“答案正确”,否则输出“答案错误”。 得到“答案正确”的条件是: 1. 字符串中必须仅有P, A, T这三种字符,不可以包含其它字符; 2. 任意形如 xPATx 的字符串都可以获得“答案正确”,其中 x 或者是空字符串,或者是仅由字母 A 组成的字符串

2015-10-28 18:45:00 587

原创 Socket编程(1)

1、Socket编程的主要步骤与重要函数 Socket编程在windows上首先需要这个头文件和“ws2_32.lib”这个lib库文件。 Soket编程一般分为UDP通信与TCP通信,那么简单的UDP通信与TCP通信前面的过程基本都是一样的,只有在收发数据的时候会有不同。 UDP通信的一般步骤: (1)、初始化 WSADATA wd; WSAStartup(0x0202,&w

2015-08-29 14:51:38 900

转载 Sublime Text 2 快捷键

文件 File 新建文件 Ctrl + N 打开文件 Ctrl + O 打开最近关闭的文件 Ctrl + Shift + T 保存 Ctrl + S 另存为… Ctrl + Shift + S 关闭文件 Ctrl + W 新建窗口 Ctrl + Shift + N 关闭窗口 Ct

2015-06-25 13:59:32 500

原创 LeetCode | Single Number II

Given an array of integers, every element appears three times except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it without u

2015-06-19 13:10:14 666 1

原创 LeetCode | Majority Element

Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the array is non-empty and the majority element

2015-06-18 20:02:10 576

转载 C++常成员函数 - const 关键字

C++常成员函数 - const 关键字 一、常成员函数详解 声明:函数名(参数表)const; 说明: (1)const是函数类型的一部分,在实现部分也要带该关键字。 (2)const关键字可以用于对重载函数的区分。 (3)常成员函数不能更新类的成员变量,也不能调用该类中没有用const修饰的成员函数,只能调用常成员函数。 A、通过例子来理解const是

2015-06-12 22:58:35 718 1

原创 C++中的explicit

C++中, 一个参数的构造函数(或者除了第一个参数外其余参数都有默认值的多参构造函数), 承担了两个角色。 1 是个构造器 ,2 是个默认且隐含的类型转换操作符。 所以, 有时候在我们写下如 AAA = XXX, 这样的代码, 且恰好XXX的类型正好是AAA单参数构造器的参数类型, 这时候编译器就自动调用这个构造器, 创建一个AAA的对象。 这样看起来好象很酷, 很方便。 但在某些

2015-06-12 20:56:18 738 1

原创 sublime 配置c++环境

1、下载sublime 地址 2、下载MinGW 地址 1、点击 安装,选择basic setup,选择下图绿色标记的四个选项,选择installation->apply changes->apply 即可。 这个工具是边下载边安装,lz自己安装时,网速很慢。因此,我将整个MinGW免安装包共享在百度网盘上,下载后只要解压到指定的目录即可。 2、配置环境变量

2015-05-08 19:34:45 2561

原创 原码,反码,补码,左移,右移

转载请注明出处 http://blog.csdn.net/dream_whui , 欢迎朋友们,做出批评指正,thanks~~ 1. 原码     原码就是符号位加上真值的绝对值, 即用第一位表示符号, 其余位表示值. 比如如果是8位二进制: [+1]原 = 0000 0001 [-1]原 = 1000 0001 第一位是符号位. 因为第一位是符

2015-05-02 14:41:07 15955 2

转载 栈,堆,全局,文字常量,代码区总结

栈,堆,全局,文字常量,代码区总结          林炳文Evankaka原创作品。转载请注明出处http://blog.csdn.net/evankaka         在C\C++中,通常可以把内存理解为4个分区:栈、堆、全局/静态存储区和常量存储区。下面我们分别简单地介绍一下各自的特点。 一.   区域划分 堆: 是大家共有的空间,分全局堆和局部堆。全

2015-05-01 18:56:14 578

原创 算法 | 最大连续子数组

最大连续字数组 给定一个数组A[0,1,…,n-1],求A的连续子数组,使得该子数组的和最大。   例如: 数组:1,-2,3,10,-4,7,2,-5 最大字数组:3,10,-4,7,2   此问题有以下四种方法 1、  暴力法 2、  分治法 3、  分析法 4、  动态规划法   暴力法 直接求解A[I,…j]的值,其中,0 //暴力法 int MaxS

2015-04-08 19:26:15 1034 1

原创 LeetCode | Construct Binary Tree from Preorder and Inorder Traversal

Given preorder and inorder traversal of a tree, construct the binary tree. Note: You may assume that duplicates do not exist in the tree. 思路:本题给出二叉树的先序遍历和中序遍历,然后构建出这颗二叉树。 分析:先序遍历的顺序是根结点、左子树、右子

2015-04-07 15:46:26 768

原创 LeetCode | Flatten Binary Tree to Linked List

Given a binary tree, flatten it to a linked list in-place. For example, Given 1 / \ 2 5 / \ \ 3 4 6 The flattened tree should look like: 1

2015-04-07 15:32:26 546

原创 LeetCode | Binary Search Tree Iterator

Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST. Calling next() will return the next smallest number in the BST. Note: next()

2015-04-06 16:36:13 552

原创 LeetCode | Binary Tree Right Side View

Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom. For example: Given the following binary tree, 1

2015-04-06 16:24:36 519

原创 LeetCode | Sum Root to Leaf Numbers

Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number. An example is the root-to-leaf path 1->2->3 which represents the number 123. Find the tota

2015-04-06 16:16:49 581 1

原创 LeetCode | Path Sum II

Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. For example: Given the below binary tree and sum = 22, 5 / \

2015-04-06 16:02:32 616

原创 LeetCode | Path Sum

Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. For example: Given the below binary tree and sum

2015-04-06 15:55:16 491

原创 LeetCode | Binary Tree Level Order Traversal II

Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root). For example: Given binary tree {3,9,20,#,#,15,7},

2015-04-06 15:50:57 553

原创 LeetCode | Binary Tree Level Order Traversal

Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). For example: Given binary tree {3,9,20,#,#,15,7}, 3 / \ 9 20

2015-04-06 15:01:06 565

原创 LeetCode | Minimum Depth of Binary Tree

Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node. 思路:如果根结点为空,则为0;如果根结点不为空,且左右子树都存在

2015-04-06 14:10:47 624

原创 LeetCode | Maximum Depth of Binary Tree

Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. 思路:如果根结点为空,那么深度为0,否则就计算其左子树和右子树的深度

2015-04-06 14:03:37 630

原创 LeetCode | Same Tree

Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally identical and the nodes have the same value. 思路:如果两颗二叉树

2015-04-06 13:44:30 584

原创 Leetcode | Symmetric Tree

Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree is symmetric: 1 / \ 2 2 / \ / \ 3 4 4 3 But the f

2015-04-06 13:28:01 651

原创 LeetCode | Balanced Binary Tree

Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never diffe

2015-04-06 13:13:27 619

原创 LeetCode | Binary Tree Preorder Traversal

Given a binary tree, return the preorder traversal of its nodes' values. For example: Given binary tree {1,#,2,3}, 1 \ 2 / 3 return [1,2,3]. 思路:本题为二叉树的先序遍历,有两种方法。1

2015-04-06 12:49:40 570

转载 二叉树的深度优先遍历和广度优先遍历

转自:http://www.blogjava.net/fancydeepin/archive/2013/02/03/395073.html 深度优先搜索算法(Depth First Search),是搜索算法的一种。是沿着树的深度遍历树的节点,尽可能深的搜索树的分支。 当节点v的所有边都己被探寻过,搜索将回溯到发现节点v的那条边的起始节点。这一过程一直进行到已发现从源节点可达的所有

2015-04-02 15:08:43 556

转载 C++标准转换运算符const_cast

C++标准转换运算符const_cast 前面讲了C++继承并扩展C语言的传统类型转换方式,最后留下了一些关于指针和引用上的转换问题,没有做详细地讲述。C++相比于C是一门面向对象的语言,面向对象最大的特点之一就是具有“多态性(Polymorphism)”。 要想很好的使用多态性,就免不了要使用指针和引用,也免不了会碰到转换的问题,所以在这一篇,就把导师讲的

2015-03-30 16:11:39 480

原创 B树 (插入操作)

B树 B树的特性 一颗m阶的B树满足一下特性 (一)  树中的每个结点至多有m颗子树,至少有颗子树。(除根结点和叶子结点外),其中表示m/2向上取整。() (二)  树中的每个结点至少有个关键字,至多m-1个关键字。 当结点的关键字个数满时,那么该结点就需要分裂,如何分裂? 假设*p结点已经有m-1个关键字,当再插入一个关键字后,其关键字个数为m,超标了!分裂开始,将*p结点分裂成两个

2015-03-22 22:28:00 4939

原创 Opencv--图像锐化处理

图像锐化处理(两种方法 1.过滤函数,自定义核 2. 直接处理当前像素点与邻近像素点关系) // Sharpen.cpp : Defines the entry point for the console application. /*-----CODE FOR FUN--------------- -------CREATED BY Dream_Whui------ -------2015-3

2015-03-09 22:43:06 7588

原创 Opencv2--颜色缩减(两种方法实现 1.迭代器 2.指针)

// ColorReduce.cpp : Defines the entry point for the console application. /*-----CODE FOR FUN--------------- -------CREATED BY Dream_Whui------ -------2015-3-9-------------------------*/ //颜色缩减 #in

2015-03-09 22:41:13 848

原创 Opencv2--像素点操作(加噪声)

// ReadPixels.cpp : Defines the entry point for the console application. /*-----CODE FOR FUN--------------- -------CREATED BY Dream_Whui------ -------2015-3-9-------------------------*/ //在原始图像上加白色噪

2015-03-09 22:40:34 2082

原创 数据结构--平衡二叉树

// Balanced Binary Tree.cpp : Defines the entry point for the console application. /*-----CODE FOR FUN--------------- -------CREATED BY Dream_Whui------ -------2015-3-5-------------------------*/ //

2015-03-09 18:41:34 586 1

空空如也

空空如也

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

TA关注的人

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