- 博客(5)
- 收藏
- 关注
原创 InterviewQuestion-QuickSort
1。Nuts and bolts. A disorganized carpenter has a mixed pile of n nuts and n bolts. The goal is to find the corresponding pairs of nuts and bolts. Each nut fits exactly one bolt and each bolt fits exact
2017-12-15 15:31:25 308
原创 QuickSort
在coursera上学习了quicksort的实现方法,老师给的代码一下子能完美运行,先给出老师的代码:package part1.week3.quicksort;import edu.princeton.cs.algs4.StdRandom;/** . * Learn from coursera. * @author aerfalwl * */public class QuickSor
2017-12-14 12:36:17 288
原创 leeCode题目324. Wiggle Sort II
Given an unsorted array nums, reorder it such that nums[0] < nums[1] > nums[2] < nums[3]….Example: (1) Given nums = [1, 5, 1, 1, 6, 4], one possible answer is [1, 4, 1, 5, 1, 6]. (2) Given nums = [1
2017-12-13 17:45:48 216
翻译 InterviewQuestionsMergesort
1.Merging with smaller auxiliary array. Suppose that the subarray a[0] to a[n−1] is sorted and the subarray a[n] to a[2∗n−1] is sorted. How can you merge the two subarrays so that a[0] to a[2∗n−1]
2017-12-11 19:31:06 265
原创 常见的位操作bit manipulation
常见的位操作-bit manipulation列表内容判断一个数是否是2的幂次方:if(n &amp;amp;amp;amp; n - 1 == 0) return true;else return false;判断一个十进制的数转化为二进制时包含的1的个数:(因为每次N&amp;amp;amp;amp;(N-1)操作都是将n最末尾的1反转为0,因此反转个数即为1的个数)public int hammingWeight(int n) {
2017-12-04 21:09:51 2213
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人