自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 vmware虚拟机:ubuntu server安装vmware tools

1、以root身份登录ubuntu 2、vmware中选择菜单虚拟机->安装VMware Tools 3、ubuntu命令行输入# mount -t iso9660 /dev/cdrom /mnt # cd mnt# cp VMWareTools-9.9.3-2759765.tar.gz /tmp# cd ..# unmount /dev/cdrom# cd /tmp# tar zx

2017-04-30 20:08:34 696

原创 Intel80x86内存寻址

Intel80x86内存寻址一、内存地址地址分为三种:逻辑地址 使用这种地址指定一个操作数或一条指令的地址,由16位的段(segment)和32位的偏移量(offset)组成线性地址 32位无符号整型,最高可表示4GB地址,通常用16进制数字表示,值的范围从0x00000000到0xffffffff。物理地址 用于芯片级内存单元寻址,由32位无符号整数表示CPU通过分段单元把一个逻辑地

2017-04-28 09:31:26 776

原创 ubuntu下mpich的安装与使用

在Ubuntu下安装mpich1、安装mpich在装之前,请确保以下软件都已经安装$gcc --version $g++ --version $python --version如果缺少相应的软件,先安装。 安装好以后,即可进入用以下命令安装mpich$ sudo apt-get install mpich等待安装完成后,测试安装结果$ which mpic

2017-04-27 22:32:44 9002

原创 Ubuntu16.04安装Oracle JDK

先测试系统中是否已经装过,用命令:java -version如果你看到像下面的输出,这就意味着你并没有安装过Java:The program ‘java’ can be found in the following packages:*default-jre*gcj-4.6-jre-headless*openjdk-6-jre-headless*gcj-4.5-jre-headless*o

2017-04-25 15:43:21 2597 3

原创 Ubuntu无法找到add-apt-repository问题的解决方法

新装的ubuntu出现无法找到add-apt-repository的问题,网上查了一下资料,原来是需要 : python-software-properties 用命令:apt-get install python-software-properties除此之外还要安装 software-properties-common 用命令:apt-get install software-properti

2017-04-25 15:37:58 1955

原创 Ubuntu16.04设置静态IP

ubuntu14.04设置静态ip1、找到文件并作如下修改:sudo vim /etc/network/interfaces修改如下部分:auto eth0 iface eth0 inet static address 192.168.0.100 #设置自己的ip地址 gateway 192.168.0.1 #自己的网关地址 netmask 255.255.255.0 #设置子网掩

2017-04-25 15:33:05 2228

原创 c语言函数返回值问题

C语言中,调用函数结束时,如果有返回值,会涉及到函数返回值传递问题,根据返回值的大小,会有不同的处理方式。 一、返回值小于等于4个字节 函数执行完毕后,如果返回值小于等于4字节,则会将值保存在寄存器eax中,然后在调用函数中通过读取eax的值来获得返回值。 二、当返回值大小在[5, 8]字节范围内时 因为eax寄存器只有四个字节,因此,当返回值在[5, 8]字节范围内时,一般采用eax和ed

2017-04-23 22:00:06 4344

原创 函数调用栈理解

一、相关寄存器(1) esp:栈指针寄存器(extended stack pointer),其内存放着一个指针,该指针永远指向系统栈最上面一个栈帧的栈顶。 (2) ebp:基址指针寄存器(extended base pointer),其内存放着一个指针,该指针永远指向系统栈最上面一个栈帧的底部。(ebp在当前栈帧内位置固定,故函数中对大部分数据的访问都基于ebp进行) (3) eip:指令寄存器

2017-04-23 21:43:05 462

转载 C语言的代码内存布局详解

一个程序本质上都是由 BSS 段、data段、text段三个组成的。这样的概念在当前的计算机程序设计中是很重要的一个基本概念,而且在嵌入式系统的设计中也非常重要,牵涉到嵌入式系统运行时的内存大小分配,存储单元占用空间大小的问题。BSS段:在采用段式内存管理的架构中,BSS段(bss segment)通常是指用来存放程序中未初始化的全局变量的一块内存区域。BSS是英文Block Started by

2017-04-23 20:08:08 260

原创 C语言中函数参数的入栈顺序

C语言中函数参数入栈顺序的确是从右至左的,一个例子来证明:#include <stdio.h>void func(int x, int y, int z){ printf("x = %d at [%X]\n", x, &x); printf("y = %d at [%X]\n", y, &y); printf("z = %d at [%X]\n",

2017-04-23 20:03:44 529

转载 C语言中extern的用法

在C语言中,修饰符extern用在变量或者函数的声明前,用来说明“此变量/函数是在别处定义的,要在此处引用”。extern修饰变量的声明。举例来说,如果文件a.c需要引用b.c中变量int v,就可以在a.c中声明extern int v,然后就可以引用变量v。这里需要注意的是,被引用的变量v的链接属性必须是外链接(external)的,也就是说a.c要引用到v,不只是取决于在a.c中声明exte

2017-04-23 19:26:59 609

原创 memcpy及memmove函数详解

•memcpy是把src指向的对象中的size个字符拷贝到dest所指向的对象中,返回指向结果对象的指针. •memmove也是把src指向的对象中的size个字符拷贝到dest所指向的对象中,返回指向结果对象的指针,但这两个函数在处理内存区域重叠的方式不同.注意memmove这个函数名称中有”move”这个单词,而实际上src处的数据仍然还在,并没有真的被”移动”了!这个函数名称有它的历史原因,是

2017-04-20 21:48:07 1195

转载 为什么主引导记录的内存地址是0x7C00?

简单说,计算机启动是这样一个过程。 1、通电 2、读取ROM里面的BIOS,用来检查硬件 3、硬件检查通过 4、BIOS根据指定的顺序,检查引导设备的第一个扇区(即主引导记录),加载在内存地址 0x7C00 5、主引导记录把操作权交给操作系统 所以,主引导记录就是引导"操作系统"进入内存的一段小程序,大小不超过1个扇区(512字节)。0x7C00这个地址来自Inte

2017-04-19 22:30:13 993

转载 计算机启动过程

一、第一阶段:BIOS上个世纪70年代初,”只读内存”(read-only memory,缩写为ROM)发明,开机程序被刷入ROM芯片,计算机通电后,第一件事就是读取它。这块芯片里的程序叫做”基本输入输出系統”(Basic Input/Output System),简称为BIOS。 1.1 硬件自检 BIOS程序首先检查,计算机硬件能否满足运行的基本条件,这叫做”硬件自检”(Power-O

2017-04-19 22:24:49 247

原创 Leetcode-108. Convert Sorted Array to Binary Search Tree

题目Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 给定一个排序的数组,返回二叉排序树思路递归建立树即可代码class Solution {public: TreeNode* sortedArrayToBST(vector<int>& num

2017-04-18 19:12:08 193

原创 Leetcode-25. Reverse Nodes in k-Group

题目Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. k is a positive integer and is less than or equal to the length of the linked list. If the number of

2017-04-09 12:12:50 320

原创 矩阵的最小路径和

题目给定一个矩阵,从左上角开始,每次只能向右或向下走,最后到达右下角位置,路径上所有的数字累加起来就是路径和,返回所有的路径中最小的路径和。 如 1 3 5 9 8 1 3 4 5 0 6 1 8 8 4 0思路经典动态规划方法,假设矩阵m行数为M, 列为N,先生成大小和矩阵相等的矩阵dp,dp [i][j]表示从左上角(0,0)位置走到(i, j)位置的最小路径和。对m的第一行来说,从(

2017-04-08 20:08:33 845

原创 蓝桥杯-入学考试

题目问题描述   辰辰是个天资聪颖的孩子,他的梦想是成为世界上最伟大的医师。为此,他想拜附近最有威望的医师为师。医师为了判断他的资质,给他出了一个难题。医师把他带到一个到处都是草药的山洞里对他说:“孩子,这个山洞里有一些不同的草药,采每一株都需要一些时间,每一株也有它自身的价值。我会给你一段时间,在这段时间里,你可以采到一些草药。如果你是一个聪明的孩子,你应该可以让采到的草药的总价值最大。”

2017-04-06 14:45:13 501

原创 排队打水问题

问题描述  有n个人排队到r个水龙头去打水,他们装满水桶的时间t1、t2………..tn为整数且各不相等,应如何安排他们的打水顺序才能使他们总共花费的时间最少? 输入格式   第一行n,r (n<=500,r<=75)   第二行为n个人打水所用的时间Ti (Ti<=100); 输出格式   最少的花费时间 样例输入 3 2 1 2 3 样例输出 7代码#include<algor

2017-04-06 14:24:51 696

原创 Leetcode-131. Palindrome Partitioning

题目Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. For example, given s = “aab”, Return [ [“aa”,”b”],

2017-04-05 19:32:44 204

原创 Leetcode-120. Triangle

题目Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, given the following triangle [ [2], [3,4], [

2017-04-04 20:43:52 228

原创 Leetcode-116. Populating Next Right Pointers in Each Node

题目Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; } Populate each next pointer to point to its next right node. If

2017-04-04 14:34:15 253

原创 Leetcode-113. 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 / \

2017-04-04 14:14:53 387 1

原创 Leetcode-112. 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 =

2017-04-04 13:51:54 234

原创 Leetcode-104. 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. 求二叉树的最大深度代码class Solution {public:

2017-04-04 13:41:47 348

原创 Leetcode-111. 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. 求二叉树的最小深度:根节点到最近叶子节点的路径长度。代码class Solut

2017-04-04 13:35:47 287

原创 Leetcode-232. Implement Queue using Stacks

题目Implement the following operations of a queue using stacks.push(x) – Push element x to the back of queue. pop() – Removes the element from in front of queue. peek() – Get the front element. empty(

2017-04-04 11:54:36 354

原创 Leetcode-114. 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 \

2017-04-04 11:18:05 281

原创 Leetcode-110. 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 differ b

2017-04-04 11:03:05 229

原创 Leetcode-101. Symmetric Tree

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

2017-04-04 09:57:13 292

原创 Leetcode-103. Binary Tree Zigzag Level Order Traversal

题目Given a binary tree, return the zigzag level order traversal of its nodes’ values. (ie, from left to right, then right to left for the next level and alternate between).For example: Given binary tre

2017-04-04 09:28:09 274

原创 Leetcode-173. 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() and ha

2017-04-04 09:22:05 217

原创 Leetcode-226. Invert Binary Tree

题目Invert a binary tree. 4 / \ 2 7 / \ / \ 1 3 6 9 to 4 / \ 7 2 / \ / \ 9 6 3 1 反转一颗了二叉树代码一、层次遍历TreeNode* invertTree(TreeNode* root) { if(

2017-04-04 09:10:42 216

原创 Leetcode-199. 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

2017-04-04 08:57:25 232

原创 Leetcode-107. 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,null,null,15,7

2017-04-04 08:47:02 224

原创 Leetcode-102. 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,null,null,15,7], 3 / \ 9 20

2017-04-04 08:40:49 264

原创 Leetcode-145. Binary Tree Postorder Traversal

题目Given a binary tree, return the postorder traversal of its nodes’ values.For example: Given binary tree {1,#,2,3}, return [3,2,1].Note: Recursive solution is trivial, could you do it iteratively?

2017-04-03 22:28:14 222

原创 Leetcode-94. Binary Tree Inorder Traversal

题目Given a binary tree, return the inorder traversal of its nodes’ values.For example: Given binary tree [1,null,2,3], return [1,3,2].Note: Recursive solution is trivial, could you do it iteratively?

2017-04-03 22:23:57 224

原创 Leetcode-144. Binary Tree Preorder Traversal

题目Given a binary tree, return the preorder traversal of its nodes’ values.For example: Given binary tree {1,#,2,3}, return [1,2,3].Note: Recursive solution is trivial, could you do it iteratively? 给

2017-04-03 22:00:39 232

原创 Leetcode-92. Reverse Linked List II

题目Reverse a linked list from position m to n. Do it in-place and in one-pass.For example: Given 1->2->3->4->5->NULL, m = 2 and n = 4,return 1->4->3->2->5->NULL. 反转链表中第m至第n个元素代码class Solution {public

2017-04-03 21:19:08 225

空空如也

空空如也

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

TA关注的人

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