Sort a linked list in O(n log n) time using constant space complexity.一谈到时间复杂度O(nlogn),立即联想到以下3种排序方法:1.归并排序(基于分治):时间复杂度O(nlogn),归并排序的最好、平均、最坏时间复杂度没有差别... Read More
Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.思路:(1)点1到点n (a)以点1为参考点,求“点1”与“点2到点n”各个斜率下点的个数; (求出直... Read More
Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another ex... Read More
Reverse Words in a StringGiven an input string, reverse the string word by word.For example, Given s = "the sky is blue", return "blue is sky the".Cla... Read More
题目:n个人编号分别是1,2,3,...,n,围坐在一张圆桌周围,从编号为k的人开始报数,数到m的人出列。然后他的下一个人开始报数,数到m的那个人又出列;依次循环,直到所有人出列。struct LNode{ int data; LNode *next;};//n为总人数,k为第一个开始报数的人,... Read More
struct BiTreeNode{ int data; BiTreeNode *leftChild; BiTreeNode *rightChild;};三种遍历是:前序、中序、后序遍历;每种遍历的实现都有递归和循环2种方法。(注:递归在本质上就是一个栈结构,所以遍历的循环方法可以用栈实现)前序遍历... Read More
写这篇博客的缘由: 对于专利《基于边缘自适应的高效图像盲去模糊方法》,是关于图像处理方面的,平时写代码和分析问题时一套一套的,很长时间不讲突然要向别人说就磕磕巴巴的也说不清楚。遂有了要认真思考,并陈述总结自己所学的想法。虽然以后并不定做盲去模糊方面的东西,但所学总有相通。遂写下这篇文章描述整体思路。 Read More