杭电OJ(HDU)-ACMSteps-Chapter Three-《FatMouse' Trade》《今年暑假不AC》《排名》《开门人和关门人》...
分类:
其他好文 时间:
2014-06-25 19:50:46
阅读次数:
227
Peterson's algorithm (AKA Peterson's solution) is a concurrent
programming algorithm for mutual
exclusion that allows two processes to share a single-use resource without conflict, using only shar...
分类:
编程语言 时间:
2014-06-25 19:38:19
阅读次数:
748
Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete a...
分类:
其他好文 时间:
2014-06-25 12:59:40
阅读次数:
202
Given an array of integers, every element appears twice except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using e...
分类:
其他好文 时间:
2014-06-24 23:30:08
阅读次数:
278
【题目】
Say you have an array for which the ith element is the price of a given stock on day i.
Design an algorithm to find the maximum profit. You may complete at most two transactions.
Note:
You may not engage in multiple transactions at the same time (i...
分类:
其他好文 时间:
2014-06-24 23:28:43
阅读次数:
223
问题
归并排序是一种常用的排序方法,本文讲述了其基本思想以及用python实现的方法。
在python中,有一个非常强大的模块heapq,提供了merge方法,让归并排序在python中更简单了。
思路说明
归并操作过程:
1. 申请空间,使其大小为两个已经排序序列之和,该空间用来存放合并后的序列
2. 设定两个指针,最初位置分别为两个已经排序序列的起始位置
3. 比较两...
分类:
编程语言 时间:
2014-06-24 21:07:01
阅读次数:
269
%%% Fragment
%%% 对原图做四个方向的平移,然后对平移的结果取平均
%%% 碎片效果
clc;
clear all;
addpath('E:\PhotoShop Algortihm\Image Processing\PS Algorithm');
Image=imread('4.jpg');
Image=double(Image)/255;...
分类:
其他好文 时间:
2014-06-24 21:06:24
阅读次数:
226
【题目】
Say you have an array for which the ith element is the price of a given stock on day i.
Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy one and sell one share of the stock multiple times). H...
分类:
其他好文 时间:
2014-06-24 19:40:53
阅读次数:
240
排序算法有不少,当然,一般的语言中都提供某个排序函数,比如Python中,对list进行排序,可以使用sorted(或者list.sort()),关于这方面的使用,在我的github代码库algorithm中有几个举例,有兴趣的看官可以去那里看看(顺便告知,我在Github中的账号是qiwsir,欢迎follow me)。但是,在某些情况下,语言中提供的排序方法或许不适合,必须选择某种排序算法。
...
分类:
其他好文 时间:
2014-06-24 18:33:33
阅读次数:
205
Given an array of integers, every element appears three times except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without u...
分类:
其他好文 时间:
2014-06-24 15:52:58
阅读次数:
222