n people are standing on a coordinate axis in points with positive integer coordinates strictly less than 106. For each person we know in which direct ...
分类:
其他好文 时间:
2017-07-25 19:56:35
阅读次数:
288
Almost Sorted Array We are all familiar with sorting algorithms: quick sort, merge sort, heap sort, insertion sort, selection sort, bubble sort, etc. ...
分类:
其他好文 时间:
2017-07-24 20:26:59
阅读次数:
267
POJ1094 Sorting It All Out 题目链接:http://poj.org/problem?id=1094 题意:这个题意确定是有点难懂,给你n个点,和m条边。问你在添加多少条边以后n个点的拓扑顺序是确定的,或者在添加多少条边以后出现了环,如果添加完所有的边,还存在有些点之间不可排 ...
分类:
其他好文 时间:
2017-07-24 01:25:03
阅读次数:
170
Cards Sorting 思路: 线段树; 代码: ...
分类:
其他好文 时间:
2017-07-22 21:06:23
阅读次数:
222
Cards Sorting time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Cards Sorting time limit pe ...
分类:
编程语言 时间:
2017-07-22 10:59:33
阅读次数:
180
Given an unsorted array, find the largest pair sum. Solution 1. O(n*logn) runtime, using sorting Solution 2. O(n) runtime, using heapify (max priority ...
分类:
其他好文 时间:
2017-07-22 09:55:44
阅读次数:
125
Strange Way to Express Integers Description Elina is reading a book written by Rujia Liu, which introduces a strange way to express non-negative integ ...
分类:
其他好文 时间:
2017-07-21 19:56:00
阅读次数:
227
LINK 题意:给出1~n数字的排列,求变为递增有序的最小交换次数 思路:水题。数据给的很小怎么搞都可以。由于坐标和数字都是1~n,所以我使用置换群求循环节个数和长度的方法。 ...
分类:
其他好文 时间:
2017-07-20 19:52:42
阅读次数:
144
本文记录于培训课程。 word order:Refers to the sorting in language units at all levels in the portfolio (1) We are trying our best to win success.陈述句 (2) Who inv ...
分类:
其他好文 时间:
2017-07-20 10:21:15
阅读次数:
151
Splay要支持找最左侧的最小值所在的位置。类似线段树一样处理一下,如果左子树最小值等于全局最小值,就查左子树;否则如果当前节点等于全局最小值,就查当前节点;否则查右子树。 为了统计答案,当然还得维护子树大小的函数。 找到位置以后,直接将左右子树交换即可。不需要打标记。 删除节点时,直接将其前驱(是 ...
分类:
其他好文 时间:
2017-07-15 17:50:38
阅读次数:
210