- 博客(21)
- 资源 (15)
- 问答 (1)
- 收藏
- 关注
原创 有关二叉树的部分操作
struct TreeNode{ ElemtType val; TreeNode *left,*right;}; 1.判定一棵二叉树是否是完全二叉树借助于层次遍历的算法,将所有结点入队列,包括空结点。出队遇到空结点时,查看其后是否有非空结点,若有,则不是完全二叉树。bool isComplete(TreeNode* root){ TreeNode* Q[Max
2015-03-28 22:13:12 682
原创 [LeetCode]Merge k Sorted Lists
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.这道题是要求归并k个有序单链表。采用分治法,将任务分成两个子任务,然后递归求子任务,最后回溯:将k个list分成两半,然后继续划分,剩余连个list就合并。/** * Definition for si
2015-03-22 21:45:42 416
原创 [LeetCode]Maximum Subarray
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 contiguous subarray [4,
2015-03-22 20:24:12 460
原创 [LeetCode]Linked List Cycle
Given a linked list, determine if it has a cycle in it. Follow up: Can you solve it without using extra space?这道题是要求在不额外使用存储空间的基础上判断一个单链表中是否存在一个环。环的存在,就是在无环的基础上,将最后一个结点的next不设为NULL,而是指向该结点前的任意
2015-03-22 18:55:49 583
原创 [LeetCode]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.这道题是给定一个有序的单链表,将它转换成一棵平衡的二叉搜索树。首先要知道平衡的二叉搜索树的特点: 1. 左子树上的所有结点的值小于根节点的值,右子树上所有结点的值大于根节点的值。即
2015-03-22 18:47:29 691
原创 [LeetCode]Reverse Linked List II
Reverse a linked list from position m to n. Do it in-place and in one-pass. For example: Given 1->2->3->4->5->NULL, m = 2 and n = 4, return 1->4->3->2->5->NULL. Note:
2015-03-22 18:38:47 565
原创 [LeetCode]Partition List
Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve the original relative order of the nodes in each o
2015-03-22 18:30:20 585
原创 [LeetCode]Remove Duplicates from Sorted List II
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. For example, Given 1->2->3->3->4->4->5, return 1->2->5.
2015-03-22 18:06:44 652
原创 [LeetCode]Rotate List
Given a list, rotate the list to the right by k places, where k is non-negative. For example: Given 1->2->3->4->5->NULL and k = 2, return 4->5->1->2->3->NULL. 这道题是要求将单链表循环右移k次,每次
2015-03-20 22:23:50 541
原创 [LeetCode]Remove Duplicates from Sorted List
Given a sorted linked list, delete all duplicates such that each element appear only once. For example, Given 1->1->2, return 1->2. Given 1->1->2->3->3, return 1->2->3. 这道题是要求删除有
2015-03-20 22:10:05 597
原创 [LeetCode]Insertion Sort
Sort a linked list using insertion sort.这道题是要求用插入排序的方式对单链表进行排序。先不考虑边界情况: 1. 将第一个结点看做有序区,之后的所有结点看做无序区。 2. 从第二个结点p开始,遍历有序区,知道遇到比结点p值大的结点q,将结点p插入到结点q之前。 3. 重复上述步骤直到链表遍历结束。需要注意的是: 1. 遍历无序区时,需要保存当前结点的后
2015-03-20 22:04:28 560
原创 [LeetCode]Reorder List
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},
2015-03-17 21:49:06 509
原创 [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
2015-03-17 20:59:51 659
原创 [LeetCode]Remove Duplicates from Sorted Array
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra space for another array, you must do this in place wit
2015-03-17 15:36:54 580
原创 [LeetCode]Same Tree
Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally identical and the nodes have the same value.这道题是要判断两棵树是不
2015-03-17 15:26:45 552
原创 [LeetCode]Sort List
Sort a linked list in O(n log n) time using constant space complexity.这道题是要求对单链表进行排序,有个O(nlogn)的时间复杂度的要求。我的想法是采取类似头插法的方式,遍历链表结点,设3个指针,min指向当前链表中的最小值,max指向当前链表中的最大值,cur指向前一插入的值。min , max , cur 初始时都指向第
2015-03-17 14:42:14 446
原创 MySQL修改密码与更改默认编码
修改密码管理员身份进入cmd,关闭Mysql服务 net stop mysql切换到mysql的bin目录,运行命令 mysqld –defaults-file=”C:\Program Files\MySQL\MySQL Server 5.6\my.ini” –console –skip-grant-tables打开新cmd窗口,启动Mysql服务 net start mysql
2015-03-17 14:26:14 590
原创 [LeetCode]Maximum Product Subarray
Find the contiguous subarray within an array (containing at least one number) which has the largest product. For example, given the array [2,3,-2,4], the contiguous subarray [2,3] has th
2015-03-13 23:06:46 624
原创 [LeetCode]Find Minimum in Rotated Sorted Array
Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). Find the minimum element. You may assume no duplicate
2015-03-11 22:01:25 683
原创 [LeetCode]Reverse Bits
Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as 001
2015-03-10 12:00:10 1177
原创 [LeetCode]Rotate Array
Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4]. Note: Try to come up as many solu
2015-03-10 11:49:14 602
commons-collections.jar
2016-03-19
Head First Servlets and JSP 2nd Edition.Mar.2008
2014-07-21
Objective-C Programming- The Big Nerd Ranch Guide, 2 edition
2014-04-20
关于clojure中的some函数问题
2016-08-29
TA创建的收藏夹 TA关注的收藏夹
TA关注的人