1.安装
Linux下直接apt-get install git 或者 apt-get install git-core 即可
2.创建版本库
进入目录 git init 此时会生成一个.git的目录,用来管理你的这个目录下的版本,一般不要动.git目录。
3.添加文件,并提交
git add filename 可以看作将文...
分类:
系统相关 时间:
2014-05-23 08:14:08
阅读次数:
374
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a link...
分类:
其他好文 时间:
2014-05-23 07:43:23
阅读次数:
246
1、
??
Convert Sorted List to Binary Search Tree
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.
分析:将一个升序排列的链表转换为平衡二叉搜索树,采用递归的方式,先找到链表...
分类:
其他好文 时间:
2014-05-22 12:33:30
阅读次数:
270
目的:本文通过分析JDK源码来对比ArrayBlockingQueue 和LinkedBlockingQueue,以便日后灵活使用。
1. 在Java的Concurrent包中,添加了阻塞队列BlockingQueue,用于多线程编程。BlockingQueue的核心方法有:
* boolean add(E e) ,把 e 添加到BlockingQueue里。如果BlockingQueue可以容纳,则返回true,否则抛出异常。
* boolean offer(E e),表示如果可能的话,将 e 加...
分类:
数据库 时间:
2014-05-22 12:19:23
阅读次数:
442
Remove Nth Node From End of List删除链表倒数的第N个元素...
分类:
其他好文 时间:
2014-05-22 11:15:52
阅读次数:
170
【题目】
原文:
2.2 Implement an algorithm to find the nth to last element of a singly linked list.
译文:
实现一个算法从一个单链表中返回倒数第n个元素。
【分析】
【思路一】
(1)创建两个指针p1和p2,指向单链表的开始节点。
(2)使p2移动n-1个位置,使之指向从头...
分类:
其他好文 时间:
2014-05-22 09:03:53
阅读次数:
315
问题
Given a singly linked list L: L0→L1→…→Ln-1→Ln,
reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…
You must do this in-place without altering the nodes' values.
For example,
Given {1,2,3,4}, reorde...
分类:
其他好文 时间:
2014-05-22 07:04:46
阅读次数:
298
23.List接口实现类:
List接口继承了Collection接口,它是一个允许存在重复项的有序集
合。
1>实现类ArrayList:
ArrayList类支持可随需要而增长的动态数组。数组列表以一个原大小被创建,当超过了它的大小,
类集自动增大,当对象被删除后,数组就可以缩小。
优点:ArrayList类对于使用索引取出元素用较高的效率,他可以用索引快速定位...
分类:
编程语言 时间:
2014-05-20 16:11:41
阅读次数:
425
戳我去解题Merge two sorted linked lists and return it as
a new list. The new list should be made by splicing together the nodes of the
first two lists.分析:直...
分类:
其他好文 时间:
2014-05-20 08:52:09
阅读次数:
277
戳我去解题Given a linked list, remove thenthnode from
the end of list and return its head.For example, Given linked list:
1->2->3->4->5, and n = 2. Aft...
分类:
其他好文 时间:
2014-05-20 08:04:28
阅读次数:
291