摘要:
最(大)小堆的性质:(1)是一颗完全二叉树,遵循完全二叉树的所有性质。(2)父节点的键值(大于)小于等于子节点的键值堆的存储一般都用数组来表示堆,i结点的父结点下标就为(i – 1) / 2。它的左右子结点下标分别为2 * i + 1和2 * i + 2。如第0个结点左右子结点下标分别为1和2。海量... 阅读全文
摘要:
Java集合---HashMap源码剖析转载:http://www.cnblogs.com/ITtangtang/p/3948406.html一、HashMap概述二、HashMap的数据结构三、HashMap源码分析 1、关键属性 2、构造方法 3、存储数据 4、调整大小 5、数据读取 ... 阅读全文
摘要:
Palindrome Numbertime=434ms负数不是回文数public class Solution { public boolean isPalindrome(int x) { int palindrome=0; int revers=x; ... 阅读全文
摘要:
String to Integer (atoi)time=272ms accepted需考虑各种可能出现的情况public class Solution { public int atoi(String str) { int length=str.length(); ... 阅读全文
摘要:
Reverse IntegerReverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321time=272ms acceptedpublic class Solution { pub... 阅读全文
摘要:
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... 阅读全文
摘要:
Longest Palindromic SubstringGiven a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there... 阅读全文
摘要:
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... 阅读全文
摘要:
Longest Substring Without Repeating CharactersGiven a string, find the length of the longest substring without repeating characters. For example, the ... 阅读全文
摘要:
链接:http://leetcode.com/onlinejudgeAdd Two NumbersYou are given two linked lists representing two non-negative numbers. The digits are stored in revers... 阅读全文