Java
文章平均质量分 79
_Jason_ZHANG
Undergraduate & Computer Science & Beihang Univ.
github.com/jasonlovescoding
展开
-
逆序数个数 (Inversion Counting) - Merge and Sort
普林斯顿的算法课质量很赞,这次作业中涉及到一个"逆序数"的知识,正好在之前学习mergesort时有一道课后提供的面试题与之相关,于是试着实现了。原题链接:http://www.practice.geeksforgeeks.org/problem-page.php?pid=558Given an array, find inversion count of array.原创 2016-09-22 00:07:21 · 3171 阅读 · 0 评论 -
求两个排好序的数组的中位数 - 二分法
There are two sorted arrays A and B of size m and nrespectively. Find the median of the two sorted arrays.Have you met this question in a real interview? YesExampleGiven A=[1,2原创 2016-09-22 00:14:06 · 2150 阅读 · 0 评论 -
主成分个数 - 快排中partition的深入理解
算法课课后习题对深化理解某一算法确实很有帮助.. 这一次课程学习了快速排序,每一次排序都涉及一个partition操作,也就是把数组分为比pivot大的部分,和比pivot小的部分。这个题目是在线性时间内找到某一长N的数组中出现次数超过某一比例,如N/3的全部元素。https://leetcode.com/problems/majority-element-ii/Given原创 2016-09-22 00:21:59 · 1764 阅读 · 0 评论 -
8-puzzle 可解性的证明 & 最优解性的证明
问题来自Coursera上Princeton所开Algorithms Part I第四周的作业:http://coursera.cs.princeton.edu/algs4/assignments/8puzzle.html这一次作业要求用Priority Queue实现一个经典的A*搜索算法,来找到一个8-puzzle问题的解(或者在有限时间内发现它的无解性)。作业要求里对算法的描述很细致原创 2016-09-21 23:38:05 · 9855 阅读 · 0 评论