题目
Given an array and a value, remove all instances of that value in place and return the new length.
The order of elements can be changed. It doesn't matter what you leave beyond the new ...
分类:
其他好文 时间:
2014-06-16 23:07:18
阅读次数:
188
题目
You are given an n x n 2D matrix representing an image.
Rotate the image by 90 degrees (clockwise).
Follow up:
Could you do this in-place?
方法
矩阵坐标的转换,循环替换。
public voi...
分类:
其他好文 时间:
2014-06-16 11:28:03
阅读次数:
199
1.创建一个基于对话框的MFC工程,名称设置为“My”。2.在自动生成的对话框模板中,删除“TODO:
Place dialog controls
here.”静态文本框、“OK”按钮和“Cancel”按钮。在对话框资源上从工具箱中添加上一个TabControl控件;3. 根据需要修改一下属性,然后...
分类:
其他好文 时间:
2014-06-16 08:19:29
阅读次数:
314
堆排序(heapsort)是一种原地(in place)排序算法, 它的时间复杂度是O(nlgn). 堆数据结构不只是在堆排序中有用,它还可以构成一个有效的优先队列。堆数据结构是一种数组对象,它可以被视为一颗完全二叉树。如图: Aheap-size是放在A中堆的元素个数。根据数组节点的索引,我们.....
分类:
其他好文 时间:
2014-06-15 21:27:58
阅读次数:
239
You are given an n x n 2D matrix representing an image.
Rotate the image by 90 degrees (clockwise).
Follow up:
Could you do this in-place?
思路:第一种思路是一层一层的进行旋转,比较直观,但是花费的时间要久一些;第二种思路则比较取巧,首先沿着...
分类:
其他好文 时间:
2014-06-15 08:46:26
阅读次数:
170
Given a sorted array, remove the duplicates in place such that each element appear only onceand return the new length.Do not allocate extra space for ...
分类:
其他好文 时间:
2014-06-14 16:59:58
阅读次数:
221
Reverse a linked list from positionmton. Do it in-place and in one-pass.For example:Given1->2->3->4->5->NULL,m= 2 andn= 4,return1->4->3->2->5->NULL.No...
分类:
其他好文 时间:
2014-06-14 13:15:06
阅读次数:
199
Given a binary tree, flatten it to a linked
list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened t...
分类:
其他好文 时间:
2014-06-13 15:11:35
阅读次数:
273
Reverse Linked List IIReverse a linked list from
positionmton. Do it in-place and in one-pass.For example:Given
1->2->3->4->5->NULL, m= 2 andn= 4,retu...
分类:
其他好文 时间:
2014-06-12 07:03:54
阅读次数:
308