- 博客(81)
- 收藏
- 关注
原创 CSAPP 实验一lab1 fitsBits
/** fitsBits - return 1 if x can be represented as an * n-bit, two's complement integer.* 1 <= n <= 32* Examples: fitsBits(5,3) = 0, fitsBits(-4,3) = 1* Legal ops: ! ~ & ^ | + << >>* Max
2015-05-31 15:28:07
4454
转载 配置mpich2运行环境
原文地址 http://linux.chinaunix.net/techdoc/net/2008/12/17/1053626.shtml前段时间帮同学在linux下配了一个集群环境,参考了一些网上的文章,就把过程写出来,做个参考吧。其实在我们的环境下ssh已经是配置好的,但是我还是把网上看到的写下来,而且这个配置过程我试过,没有什么问题。创建SSH信任连接 1、更改/et
2015-05-05 14:39:26
1402
原创 C++重载二维数组下标 [ ][ ]
C++重载二维数组下标 [][]一维数组的重载比较简单,直接参数传入下标值,然后返回指针对应的数值。但是如果是重载二维应该下标[][]应当如何解决?比如我们有 Array2 a(3, 4); int i, j; for (i = 0; i < 3; ++i) for (j = 0; j < 4; j++) a[i][j] = i * 4
2015-04-07 17:31:28
3873
1
原创 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 total
2015-01-08 16:42:52
495
原创 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-01-08 10:56:26
361
原创 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-01-08 10:40:25
380
原创 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./** * Definition for binary tree
2015-01-07 16:57:06
454
原创 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./** * Definition for binary tree
2015-01-07 16:54:15
505
原创 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-01-07 16:26:34
447
原创 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./** * Def
2015-01-07 15:56:23
400
原创 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 3But the f
2015-01-07 15:41:44
417
原创 DTD简介入门
DTD是什么DTD-Document Type Definition,中文翻译即文档类型定义,可定义合法的XML文档构建模块。它使用一系列合法的元素来定义文档的结构。如何使用DTD内部声明DTDDTD可以直接包含于XML源文件中,使用方法如下> 一个简单的例子如下<!DOCTYPE note [ ]> George John
2014-12-28 17:42:33
932
原创 PHP实现分页
<?php header("Content-type:text/html;charset=utf-8"); $page=isset($_GET['page'])?intval($_GET['page']):1; //这句就是获取page=18中的page的值,假如不存在page,那么页数就是1。 $num=10; //每页显示10条数据
2014-12-17 15:55:25
556
原创 leetcode 之Merge Sorted Array
Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space (size that is greater or equal to m + n) to hold additional elements fro
2014-12-14 16:37:42
436
原创 leetcode 之Unique Paths II
Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space is marked as 1 and 0 respectively in the
2014-12-12 23:09:50
405
原创 leetcode 之Unique Paths
A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach the
2014-12-12 22:43:34
443
原创 leetcode 之Work Search
Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically
2014-12-12 11:04:20
812
原创 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
2014-12-05 16:42:05
433
原创 leetcode 之Single Number
Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without using e
2014-12-03 21:44:49
519
原创 leetcode 之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
2014-12-03 20:54:20
591
原创 PHP 上传文件大小限制
在使用CI框架实现文件的上传时,发现大于8M的文件就会提示出错,此时需要更改php.ini 中的相关设置。1.file_uploads = On ;打开文件上传选项 这个默认是打开的 2.upload_max_filesize = 8M ;上传文件上限 默认是8M,可根据需要更改,但需要注意的是这个是有一定限制的,如32位机最大不能超过INT_MAX大小。3.post_m
2014-12-01 12:15:01
618
原创 cURL使用之利用WeatherWebService获取天气预报
1.cURL是什么cURL是一个利用URL规则在命令行下工作的文件传输工具。2.WeatherWebService简介天气预报 Web 服务,数据每2.5小时左右自动更新一次,准确可靠。包括 340 多个中国主要城市和 60 多个国外主要城市三日内的天气预报数据。网址为 http://www.webxml.com.cn/WebServices/WeatherWebServic
2014-11-26 21:32:59
1825
原创 直接插入排序和shell排序
1.插入排序template void InsertSort(Record a[],int n){ for(int i=1;i<n;i++) //1 { Record temp=a[i]; //2 int j=i-1; whil
2014-11-15 15:04:43
482
原创 leetcode 之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], [
2014-10-27 22:28:34
535
原创 包含选择器和子选择器的区别
包含选择器,即加入空格,用于选择指定标签元素下的后辈元素。请注意这个选择器与子选择器的区别,子选择器(child selector)仅是指它的直接后代,或者你可以理解为作用于子元素的第一代后代。而后代选择器是作用于所有子后代元素。后代选择器通过空格来进行选择,而子选择器是通过“>”进行选择。总结:>作用于元素的第一代后代,空格作用于元素的所有后代。.food li{
2014-10-23 15:37:33
2236
原创 (具名)返回值优化 和 复制省略
1.以下代码共调用多少次拷贝构造函数: Widget f(Widget u) { Widget v(u); Widget w = v; return w; } main() { Widget x; Widget y = f(f(x)); } A 1 B 3 C 5 D 7
2014-10-16 15:00:22
939
1
原创 《剑指offer》面试题8 旋转数组的最小数字
题目描述:把一个数组最开始的若干个元素搬到数组的末尾,我们称之为数组的旋转。输入一个递增排序的数组的一个旋转,输出旋转数组的最小元素。例如数组{3,4,5,1,2}为{1,2,3,4,5}的一个旋转,该数组的最小值为1。输入:输入可能包含多个测试样例,对于每个测试案例,输入的第一行为一个整数n(1输入的第二行包括n个整数,其中每个整数a的范围是(1输出:对应每个
2014-10-10 21:47:32
557
原创 《剑指offer》面试题6 重建二叉树
#include using namespace std;typedef struct Binary_Node{ int value; struct Binary_Node *left; struct Binary_Node *right;}BinaryNode;int pre_order[1010];int in_order[1010];int flag;
2014-10-09 22:09:06
449
原创 PHP中的cookie与session
1cookie简介Cookie是存储在客户端浏览器中的数据,我们通过Cookie来跟踪与存储用户数据。一般情况下,Cookie通过HTTP headers从服务端返回到客户端。多数web程序都支持Cookie的操作,因为Cookie是存在于HTTP的标头之中,所以必须在其他信息输出以前进行设置,类似于header函数的使用限制。PHP通过setcookie函数进行Cookie的
2014-09-22 15:36:51
658
原创 2014腾讯校园招聘实习技术类笔试题目
2014-04-21笔试和面试2014、校园实习、笔试、腾讯王奎时间:2014-4-20职位:开发、后台、客户端、前端等城市:上海、合肥、沈阳、长沙、深圳(一)不定项选择题(4分X25)1. 使用深度优先算法遍历下图,遍历的顺序为()A ABCDEFG B ABDCFEGC ABDECFG D ABCDFEG2. 输入序列ABCAB
2014-08-27 14:34:40
1079
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人