自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

强哥快飞

So we beat on, boats against the current, borne back ceaselessly into the past.

  • 博客(27)
  • 收藏
  • 关注

转载 位运算的一些总结

Java提供的位运算符有:左移( 、右移( >> ) 、无符号右移( >>> ) 、位与( & ) 、位或( | )、位非( ~ )、位异或( ^ ),除了位非( ~ )是一元操作符外,其它的都是二元操作符。1、左移( Test1、将5左移2位:public class Test { public static void main(String[] args) {

2015-02-04 09:20:41 322

原创 java Thread 学习

一、Thread and Runnable之前说过 Thread 的两种实现方式,一种是继承Thread类,一种是实现Runnable接口。 两种实现方式的异同如下: 其实就是Class 和 Interface 之间的不同。Runnable 为一个接口,由于接口的多实现性,使其更具可扩展性,而且有利于资源的共享。比如,一个实现了Runnable接口的对象可以创建多个线程,使他们可以

2015-02-04 07:42:39 370

原创 leetcode MergeTwoSortedList

/** *  * 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. * */key Notethe solution is sam

2015-01-30 02:05:32 302

原创 leetcode remove duplicate of sorted list

/** * Given a sorted linked list, delete all duplicates such that each element appear only once. * */很简单,没有啥可说的public void removeDuplicates(ListNode node){ListNode cur = node;while(cur!=

2015-01-30 01:30:17 291

原创 求该整数的二进制表达中有多少个1

题目:输入一个整数,求该整数的二进制表达中有多少个1。例如输入10,由于其二进制表示为1010,有两个1,因此输出2。分析:这是一道很基本的考查位运算的面试题。包括微软在内的很多公司都曾采用过这道题。一个很基本的想法是,我们先判断整数的最右边一位是不是1。接着把整数右移一位,原来处于右边第二位的数字现在被移到第一位了,再判断是不是1。这样每次移动一位,直到这个整数变成0为止。现在的

2015-01-29 11:56:07 609

原创 java.util List and set

List and Set are two interfaces which extends from the interface Collection.1.ListList接口提供的适合于自身的常用方法均与索引有关,这是因为List集合为列表类型,以线性方式存储对象,可以通过对象的索引操作对象。List接口的常用实现类有ArrayList和LinkedList,在使用Lis

2015-01-29 01:49:50 347

原创 java.util Iterable and Iterator

Iterable and Iterator两个接口, 很简单。/*** Iterable is an interface allows an objefct to be the target of the * "foreach" statement**/public interface Iterable{ //return an iterator over a set of

2015-01-29 01:26:24 473

原创 顶住!!!

不知道如何形容此时的心情,迷茫、失落、期待、担心、愧疚、不舍、孤单、烦躁、沉重,却又是那么的麻木。因为这些情绪我都可以承担,就像没有任何情绪。就像,必须,一个人承担起生命的重量。I can handle this, I can take this

2015-01-28 14:15:15 511

原创 java.util Collection interface understand1

Java Collection interface understanding

2015-01-28 13:47:00 367

原创 A simple implement of the Tetris in JAVA

A simple implement of the Tetris in JAVA

2015-01-28 08:27:07 370

原创 The implement of Binary Search Tree (JAVA)

An implement of Binary Search Tree in JAVAFunctionsCreate Insert Delete Find Min Max Display Search Traver

2015-01-28 08:19:39 403

原创 PlusOne

/** * Given a non-negative number represented as an array of digits, plus one to * the number. *  * The digits are stored such that the most significant digit is at the head of * the list.

2015-01-27 04:58:26 443

原创 连续最大和自数组

题目:/** * Find the contiguous subarray within an array (containing at least one number) * which has the largest sum. For example, given the array [-2, 1, -3, 4, -1, * 2,1, -5, 4 ], the contiguo

2015-01-27 04:57:54 349

原创 leetcode 之 二进制数相加

/** * Given two binary strings, return their sum (also a binary string). *  * For example, a = "11" b = "1" Return "100". *  * 题目翻译: *  * 给定两个二进制字符串,返回它们的和(也是一个二进制字符串)。 例如, a = "11" b =

2015-01-27 04:55:19 323

原创 leetcode 之 length of last word.

题目/** *  * Given a string s consists of upper/lower-case alphabets and empty space * characters ' ', return the length of last word in the string. *  * If the last word does not exist, ret

2015-01-27 04:52:15 273

原创 单向链表的简单实现

java单向链表的简单实现。关于单向链表Advantages· Linked lists are a dynamic data structure, allocating the needed memory while the program is running.· Insertion and deletion node operations ar

2015-01-27 04:50:33 346

转载 转 一篇关于java中简单集合类的详解

关于java中集合类的详解,写的非常详细。有时间仔细阅读以下。点击打开链接

2015-01-27 04:46:38 279

原创 单向链表的java简单实现

一种单向链表的简单实现java关于单向链表单向链表的数据结构可以分为两部分:数据域和指针域,数据域存储数据,指针域指向下一个储存节点的地址。Advantages· Linked lists are a dynamic data structure, allocating the needed memory while the program is

2015-01-27 04:43:03 411

原创 leetCode 之SearchInsertPosition

题目:Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.其实就是查找的扩展两种, 递归和迭代 // 递归 pub

2015-01-07 16:01:27 321

原创 leetCode 之 两个二进制数相加

题目: * Given two binary strings, return their sum (also a binary string). *  * For example, a = "11" b = "1" Return "100". *  * 题目翻译: *  * 给定两个二进制字符串,返回它们的和(也是一个二进制字符串)。 例如, a = "11" b =

2015-01-07 15:50:33 1139

原创 LeetCode 之RemoveElement

题目: Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn't matter what you leave beyond the new length.

2015-01-07 15:47:54 343

原创 记账

记账系统。占个空!

2015-01-03 05:29:39 647

原创 LeetCode 之 preorder traversal of binary tree

Given a binary tree, return the preorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3},   1    \     2    /   3return [1,2,3].Note: Recursive sol

2015-01-03 04:43:06 331

原创 LeetCode 之 Remove Nth Node From End of List

Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the

2015-01-03 04:37:28 285

原创 Queue 实现

Java queue 实现先进后出dequeue()enqueue()clear()isEmpty()firstElement()import java.util.LinkedList;public class Queue { private LinkedList list = new LinkedList(); public void clear(){

2015-01-02 10:48:48 271

原创 Stack 的 java 实现

用双向链表实现一个 堆栈  先入先出。 push()pop()isEmpty()peek()clear()import java.util.LinkedList;public class Stack { private LinkedList list = new LinkedList(); public void clear(){ lis

2015-01-02 10:27:29 360

原创 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-26 16:10:01 268

空空如也

空空如也

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

TA关注的人

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