- 博客(18)
- 收藏
- 关注
原创 Project:Capacitated Facility Location Problem:(二)模拟退火算法
在上一篇博客中,我们使用了贪心算法来解决仓库选址问题,这一次,我们可以尝试使用模拟退火算法模拟退火算法的原理很容易理解:类似我们在金属淬火时的操作,为了寻求全局的最佳温度,我们有时候可能会趋向于选择一个看上去更差的解,从而使我们不束缚于局部的最优温度,可以继续前进。我们使用的模拟退火的算法步骤大致如下:完全不考虑开销,将所有的顾客按顺序分配给仓库,这样我们就得到一个初始的可行解,作为起点...
2018-12-27 15:32:00 346
原创 Project:Capacitated Facility Location Problem:(一)贪心算法
Capacitated Facility Location ProblemSuppose there are n facilities and m customers. We wishto choose:which of the n facilities to openthe assignment of customers to facilitiesThe objective is t...
2018-12-25 20:18:36 240
原创 算法设计与分析(十六):DP
Arithmetic SlicesA sequence of number is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the same.For example, these are ari...
2018-12-24 22:26:34 183
原创 算法设计与分析(十五):DP
Stone GameAlex and Lee play a game with piles of stones. There are an even number of piles arranged in a row, and each pile has a positive integer number of stones piles[i].The objective of the gam...
2018-12-24 22:04:07 178
原创 算法设计与分析(十四):DP
Counting BitsGiven a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1’s in their binary representation and return them as an array.Example 1:I...
2018-12-24 21:23:49 116
原创 算法设计与分析(十三):DP
Maximum Sum of 3 Non-Overlapping SubarraysIn a given array nums of positive integers, find three non-overlapping subarrays with maximum sum.Each subarray will be of size k, and we want to maximize t...
2018-12-03 21:45:57 156
原创 算法设计与分析(十二):DP
Shortest Path Visiting All NodesAn undirected, connected graph of N nodes (labeled 0, 1, 2, …, N-1) is given as graph.graph.length = N, and j != i is in the list graph[i] exactly once, if and only i...
2018-12-03 20:01:58 183
原创 算法设计与分析(十一)String
Minimum Time DifferenceGiven a list of 24-hour clock time points in “Hour:Minutes” format, find the minimum minutes difference between any two time points in the list.Example 1:Input: ["23:59","00:...
2018-12-03 18:54:56 141
原创 算法设计与分析(十):DP
Burst BalloonsGiven n balloons, indexed from 0 to n-1. Each balloon is painted with a number on it represented by array nums. You are asked to burst all the balloons. If the you burst balloon i you w...
2018-11-19 00:29:31 194
原创 算法设计与分析(九):Dynamic
Maximum Length of Pair ChainYou are given n pairs of numbers. In every pair, the first number is always smaller than the second number.Now, we define a pair (c, d) can follow another pair (a, b) if ...
2018-11-10 23:43:07 121
原创 算法设计与分析(八):Dynamic
Minimum Falling Path SumGiven a square array of integers A, we want the minimum sum of a falling path through A.A falling path starts at any element in the first row, and chooses one element from ea...
2018-11-05 00:38:33 154
原创 算法设计与分析(七):Graph And Tree
Non-overlapping IntervalsGiven a collection of intervals, find the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping.Note:You may assume the interval’...
2018-10-29 00:38:28 154
原创 算法设计与分析(六):Graph And Tree
Is SubsequenceGiven a string s and a string t, check if s is subsequence of t.You may assume that there is only lower case English letters in both s and t. t is potentially a very long (length ~= 50...
2018-10-21 01:39:11 249
原创 算法设计与分析(五):Graph And Tree
Couples Holding HandsN couples sit in 2N seats arranged in a row and want to hold hands. We want to know the minimum number of swaps so that every couple is sitting side by side. A swap consists of c...
2018-10-14 17:15:26 170
原创 算法设计与分析(四):Graph And Tree
Keys and RoomsThere are N rooms and you start in room 0. Each room has a distinct number in 0, 1, 2, …, N-1, and each room may have some keys to access the next room.Formally, each room i has a lis...
2018-10-08 22:35:32 161
原创 算法设计与分析(三):Graph And Tree
Minimum Height TreesFor a undirected graph with tree characteristics, we can choose any node as the root. The result graph is then a rooted tree. Among all possible rooted trees, those with minimum ...
2018-09-21 20:17:51 300
原创 算法设计与分析(二):Divide And Conquer
Maximum SubarrayGiven an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.Example: Input: [-2,1,-3,4,-1,2,1,-5,4], ...
2018-09-16 20:28:19 369
原创 算法设计与分析(一):Divide And Conquer
Search a 2D Matrix IIWrite an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: -Integers in each row are sorted in ascending from left to ...
2018-09-09 15:45:44 564
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人