- 博客(22)
- 问答 (1)
- 收藏
- 关注
原创 git bash 修改默认路径
刚学习如何使用github。使用Git Bash但是这个每次打开都要先cd到工作目录,才能用。觉得有点烦,怎么来改它呢?在Git bash的图标上右击=》属性然而在开始位置填入你的工作目录。然后确定跑一下,看打开后在哪?如果没有到工作目录,那就看一下下面第一个红框位置有没有--cd-to-home这句话。把这句话删了。就可以了。
2016-05-30 23:08:02 2526
原创 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"
2016-05-30 18:56:10 355
原创 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.import java.util.*;public cla
2016-05-30 18:32:46 406
原创 构造MaxTree O(n)方法
题目描述对于一个没有重复元素的整数数组,请用其中元素构造一棵MaxTree,MaxTree定义为一棵二叉树,其中的节点与数组元素一一对应,同时对于MaxTree的每棵子树,它的根的元素值为子树的最大值。现有一建树方法,对于数组中的每个元素,其在树中的父亲为数组中它左边比它大的第一个数和右边比它大的第一个数中更小的一个。若两边都不存在比它大的数,那么它就是树根。请证明这个方法的正确性,同
2016-05-29 18:31:22 1033
原创 剑指Offer:二叉树的镜像
题目描述操作给定的二叉树,将其变换为源二叉树的镜像。 输入描述:二叉树的镜像定义:源二叉树 8 / \ 6 10 / \ / \ 5 7 9 11 镜像二叉树 8 / \ 10 6 / \ / \ 11
2016-05-27 20:20:26 292
原创 剑指Offer:树的子结构
/**public class TreeNode { int val = 0; TreeNode left = null; TreeNode right = null; public TreeNode(int val) { this.val = val; }}*/public class Solution { publi
2016-05-27 16:52:48 337
原创 剑指Offer:合并2个排序的链表
方法一:/*public class ListNode { int val; ListNode next = null; ListNode(int val) { this.val = val; }}*/public class Solution { public ListNode Merge(ListNode list1,List
2016-05-27 15:59:51 262
原创 剑指Offer:反转链表
方法一:简单粗暴,还有点小问题。只是改了节点的值,没有真正交换2个节点/*public class ListNode { int val; ListNode next = null; ListNode(int val) { this.val = val; }}*/public class Solution { public L
2016-05-27 14:26:37 331
原创 剑指Offer:链表中倒数第k个结点
/*public class ListNode { int val; ListNode next = null; ListNode(int val) { this.val = val; }}*/public class Solution { public ListNode FindKthToTail(ListNode head,int
2016-05-26 20:23:54 269
转载 Java基本概念:集合类(Collection)List/Set/Map... 的区别和联系
Java基本概念:集合类(Collection) List/Set/Map... 的区别和联系Collection:List、SetMap:HashMap、HashTable如何在它们之间选择一、Array , ArraysJava所有“存储及随机访问一连串对象”的做法,array是最有效率的一种。1、效率高,但容量固定且无法动态改变。array还有一个缺点是,无法
2016-05-26 15:09:16 609
原创 多线程:生产者 消费者
/*producer-customer.c*/#include #include #include #include #include #include #include #include #include #define MYFIFO "myfifo" /*缓冲区有名管道的名字*/#define BUFFER_SIZE 3 /*缓冲区的单元数*/#define UNIT
2016-05-24 17:35:10 721
原创 多线程 同步
/*thread_mutex.c*/#include #include #include #define THREAD_NUMBER 3#define REPEAT_NUMBER 3#define DELAY_TIME_LEVELS 10.0pthread_mutex_t mutex;void *thrd_func(void *arg){ int th
2016-05-24 17:32:11 427
原创 多线程编程实验
/*thread.c*/#include #include #include #define THREAD_NUMBER 3 /*线程数*/#define REPEAY_NUMBER 5 /*每个线程中的小任务*/#define DELAY_TIME_LEVELS 10.0 /*小任务之间的最大时间间隔*/void *thrd_func(void *arg){/*线程函
2016-05-24 17:29:53 1587
原创 线程编程中 undefined reference to `pthread_create' undefined reference to `pthread_jion'
undefined reference to `pthread_create' undefined reference to `pthread_jion' 在编译是添加-lpthread
2016-05-21 14:49:03 457
原创 亚信的实习的一到笔试题,交换链表的后半部分
链表节点结构package parameterValues;public class LNode { int value; LNode next;}这是主程序package parameterValues;import org.junit.Test;import sun.security.action.GetLongAction;public cl
2016-05-18 21:44:18 816
原创 Java文件流 字节流和字符流
Java 流分成2大类:1.字节流2.字符流顾名思义 字节流就是内容以字节的形式存储在流中,字符流则以字符的形式存储在流中,一般而言,字符流只用来处理纯文本文件,而字节流则可以用来处理文本,图片,视频,音频等。而对于字符流和字节流来说都可以分成输入输出两部分,所以可以分成: 字节流 字符流
2016-05-18 21:22:07 717
原创 由二叉树的中序遍历和前序遍历求二叉树重建二叉树
剑指offer:重建二叉树输入某二叉树的前序遍历和中序遍历的结果,请重建出该二叉树。假设输入的前序遍历和中序遍历的结果中都不含重复的数字。例如输入前序遍历序列{1,2,4,7,3,5,6,8}和中序遍历序列{4,7,2,1,5,3,8,6},则重建二叉树并返回。因为已知前序特点,第一个节点必然是根节点。然后由该点可以在中序可以找到对应的1。这样可以吧中序遍历分成左子树{4,7,
2016-05-13 17:51:37 407
转载 Linux fork() 返回值详解
转自: http://blog.csdn.net/lovenankai/article/details/6874475对于主进程 fork()返回新建的子进程ID, 子进程fork()返回0进程配置有唯一的进程控制块PCB,由proc结构和usr结构组成。下面依次介绍进程相关的系统调用:1:fork()函数 创建一个子进程 #include /* 提供类型
2016-05-06 14:48:07 6461 2
空空如也
刚搭完服务器,连好交换机,应该怎么配置局域网?
2016-07-08
TA创建的收藏夹 TA关注的收藏夹
TA关注的人