摘要: 最(大)小堆的性质:(1)是一颗完全二叉树,遵循完全二叉树的所有性质。(2)父节点的键值(大于)小于等于子节点的键值堆的存储一般都用数组来表示堆,i结点的父结点下标就为(i – 1) / 2。它的左右子结点下标分别为2 * i + 1和2 * i + 2。如第0个结点左右子结点下标分别为1和2。海量... 阅读全文
posted @ 2015-04-02 14:17 懒人部落 阅读(1485) 评论(0) 推荐(0) 编辑
摘要: Java集合---HashMap源码剖析转载:http://www.cnblogs.com/ITtangtang/p/3948406.html一、HashMap概述二、HashMap的数据结构三、HashMap源码分析 1、关键属性 2、构造方法 3、存储数据 4、调整大小 5、数据读取 ... 阅读全文
posted @ 2015-03-31 10:25 懒人部落 阅读(193) 评论(0) 推荐(0) 编辑
摘要: Palindrome Numbertime=434ms负数不是回文数public class Solution { public boolean isPalindrome(int x) { int palindrome=0; int revers=x; ... 阅读全文
posted @ 2015-03-26 11:16 懒人部落 阅读(210) 评论(0) 推荐(0) 编辑
摘要: String to Integer (atoi)time=272ms accepted需考虑各种可能出现的情况public class Solution { public int atoi(String str) { int length=str.length(); ... 阅读全文
posted @ 2015-03-26 10:50 懒人部落 阅读(280) 评论(0) 推荐(0) 编辑
摘要: Reverse IntegerReverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321time=272ms acceptedpublic class Solution { pub... 阅读全文
posted @ 2015-03-17 14:17 懒人部落 阅读(150) 评论(0) 推荐(0) 编辑
摘要: ZigZag ConversionThe string"PAYPALISHIRING"is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern i... 阅读全文
posted @ 2015-03-13 09:08 懒人部落 阅读(255) 评论(0) 推荐(0) 编辑
摘要: Longest Palindromic SubstringGiven a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there... 阅读全文
posted @ 2015-03-12 14:25 懒人部落 阅读(140) 评论(0) 推荐(0) 编辑
摘要: Median of Two Sorted ArraysThere are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run... 阅读全文
posted @ 2015-03-11 14:35 懒人部落 阅读(466) 评论(0) 推荐(0) 编辑
摘要: Longest Substring Without Repeating CharactersGiven a string, find the length of the longest substring without repeating characters. For example, the ... 阅读全文
posted @ 2015-03-10 14:18 懒人部落 阅读(156) 评论(0) 推荐(0) 编辑
摘要: 链接:http://leetcode.com/onlinejudgeAdd Two NumbersYou are given two linked lists representing two non-negative numbers. The digits are stored in revers... 阅读全文
posted @ 2015-03-09 11:33 懒人部落 阅读(342) 评论(0) 推荐(0) 编辑