一、插入排序 核心:通过构建有序序列,对于未排序序列,在已排序序列中从后向前扫描(对于单向链表则只能从前往后遍历),找到相应位置并插入。实现上通常使用in-place排序(需用到O(1)的额外空间) 性质: 交换操作和数组中倒置的数量相同 比较次数>=倒置数量,<=倒置的数量加上数组的大小减一 每次 ...
分类:
其他好文 时间:
2017-06-18 11:50:10
阅读次数:
211
Remove Element 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 ...
分类:
其他好文 时间:
2017-06-17 14:24:44
阅读次数:
136
Reverse a linked list from position m to n. Do it in-place and in one-pass. For example:Given1->2->3->4->5->NULL, m = 2 and n = 4, return1->4->3->2->5 ...
分类:
其他好文 时间:
2017-06-16 16:31:46
阅读次数:
192
A common typing error is to place your hands on the keyboard one row to the right of the correct position. Then ``Q'' is typed as ``W'' and ``J'' is t ...
分类:
其他好文 时间:
2017-06-14 21:09:01
阅读次数:
242
题目链接:https://leetcode.com/problems/remove-duplicates-from-sorted-array/ Given a sorted array, remove the duplicates in place such that each element ap ...
分类:
其他好文 时间:
2017-06-13 10:04:19
阅读次数:
110
题目: 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. ...
分类:
其他好文 时间:
2017-06-13 09:59:34
阅读次数:
142
C:反反复复 C:反反复复 总时间限制: 1000ms 内存限制: 65536kB描述 Mo和Larry发明了一种信息加密方法。他们首先决定好列数,然后将信息(只包含字母)从上往下依次填入各列,并在末尾补充一些随机字母使其成为一个完整的字母矩阵。例如,若信息是“There's no place li ...
分类:
其他好文 时间:
2017-06-12 16:22:36
阅读次数:
276
//: Playground - noun: a place where people can play import Cocoa class Person { var residence: Residence?//供选连接 } class Residence { var rooms = [Room ...
分类:
其他好文 时间:
2017-06-11 16:28:34
阅读次数:
164
Suppose you have a long flowerbed in which some of the plots are planted and some are not. However, flowers cannot be planted in adjacent plots - they ...
分类:
其他好文 时间:
2017-06-11 10:09:51
阅读次数:
226
接上篇翻译的文章:使用‘Inplace‘方法直接从5.0升级至5.7,在此记录我实践的过程。1、环境准备数据库A版本:5.1字符集:latin1引擎:MyISAM数据库量:约220G表数据量:约600服务器:centos6.52、升级过程已经搭建好5.1版本数据的从库,等主从同步之后,开始升级从库在第一次升..
分类:
数据库 时间:
2017-06-09 17:37:53
阅读次数:
444