由买买提看人间百态

topics

全部话题 - 话题: shortest
1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)
k**********g
发帖数: 989
1
来自主题: Programming版 - 请教一个算法题关于shortest path的

好像是正解.
A shortest path from n0 (starting point) to ny (any point) can be classified
as:
n0 ... ... ny (not touching any constrained point), OR
n0 ... n2 ... ny (touching only n2), OR
n0 ... n5 ... ny (touching only n5), OR
... (more combinations if there are additional constrains)
The best result from the first class is simply computed by removing all
constrained points from the graph.
For each of the remaining classes, the search can be broken down into:
(e.g. for the class that allows n2, r... 阅读全帖
S**I
发帖数: 15689
2
来自主题: Programming版 - shortest path algorithm(dijkstra)的变形
一个heuristic的算法是用distance做为weight计算K shortest paths,然后从中寻找符
合total time < T的路径,或着是反过来用time做为weight计算K shortest paths,然
后选取distance最小的那条。
m********r
发帖数: 811
3
【 以下文字转载自 Physics 讨论区 】
发信人: miniplayer (mplayer), 信区: Physics
标 题: What is the shortest non-zero lenght, L, of a magnetic quadrupole that is imaging in the horizonta
发信站: BBS 未名空间站 (Mon Aug 31 18:20:27 2009, 美东)
What is the shortest non-zero lenght, L, of a magnetic quadrupole that is
imaging in the horizontal plane, with omega=9 ?
c**i
发帖数: 6973
4
Nepal’s shortest man seeks world record. BBC, Feb. 21, 2010.
http://news.bbc.co.uk/2/hi/south_asia/8527008.stm
My comment:
(a) Associated Press reports he is 18.
(b) He Pingping
http://en.wikipedia.org/wiki/He_Pingping
(born in 1988 in Inner Mongolia, China)
(c) Gul Mohammed
http://en.wikipedia.org/wiki/Gul_Mohammed
(1957–1997)
r******r
发帖数: 700
5
来自主题: JobHunting版 - the shortest code to crash your system
Who can try the shortest code that immediately consumes up all your CPU
power?
r*******y
发帖数: 1081
6
来自主题: JobHunting版 - shortest path problem
. . . . e
. . x . .
. s . x .
. . . . .
Need to find a shortest path from starting s to ending e
and can not pass through the point marked with x
At each point we can go right, left, up or down.
Thanks.
a*******y
发帖数: 1040
7
来自主题: JobHunting版 - shortest path in matrix
You have a matrix of size n*n with entries either 1 or 0. 1 means there is a
path, 0 means no path. Find shortest path and print it from (0,0) to (n-1,
n-1)
这个我觉得用backtrack,但是keep那个path有点麻烦,假如你在某一点发现路径走的
cell数目相同,你怎么update那个path?任选一个?
a*******y
发帖数: 1040
8
来自主题: JobHunting版 - shortest path in matrix
no, 你这个不对,
不是shortest的,你要比较下再push
d******a
发帖数: 238
9
来自主题: JobHunting版 - shortest path in matrix
我感觉这代码是有些蛮力的,不太好。但result应该是shortest的,因为我是得到了所
有路径,只保存最短的路径。
c****x
发帖数: 15
10
来自主题: JobHunting版 - shortest path in matrix
If you want to keep all shortest path, you can modify the hash table in BFS
to allow duplication of cell in search node
a*****8
发帖数: 10
11
碰到的一题online coding
Given a string s, return the shortest substring that is only occurring once.
Examples:
s="aabbabbaab" retunrs either "bab" or "baa"
s="aaaa" returns "aaaa"
大家看看有什么好的想法
h*********2
发帖数: 192
12
来自主题: JobHunting版 - Find shortest among two nodes in binary tree
但是对整个树找shortest path怎么做呢?好像要用dp,大家给个思路吧~~
谢谢!
r*******n
发帖数: 3020
13
来自主题: JobHunting版 - Find shortest among two nodes in binary tree
two nodes 路径不就一条吗,还有shortest 之说?
tree 是没有环的图
i***y
发帖数: 285
14
My Mom stay here for 183 days, Can she count for my dependent? What is the
shortest duration for her to be a dependent of mine?
I heard that if I add her as dependent, i can have $13,000 tax deduction. Is
that true?
z****l
发帖数: 5282
15

What is the shortest duration?
yes if you can file as resident.
183. Kindly read the chapter 1 of publicaiton 519 on www.isr.gov
Is
ask whoever told you so.
s******8
发帖数: 4192
16
Chile is the shortest team competing in the World cup, with an average
height of 1.76m
n****y
发帖数: 106
17
来自主题: Programming版 - shortest path algorithm(dijkstra)的变形
你意思是先找k 条最短路径,然后在里面找出最短但是符合条件的
我们现在就是这么做的,但是manager想avoid k shortest paths algorithm...
我不明白为什么要avoid,但是我没有决定权
你还知道其他的算法么?
谢谢

找符
n****y
发帖数: 106
18
来自主题: Programming版 - shortest path algorithm(dijkstra)的变形
1. The patent I talked about(need a free registration to get the pdf):
http://www.patentstorm.us/patents/6321271/claims.html
2. http://www-users.cs.umn.edu/~mokbel/Beriut99.pdf
3. google constrained shortest path algorithm...
thanks..

found
e*u
发帖数: 17
19
来自主题: Programming版 - shortest path algorithm(dijkstra)的变形
After a simple search, I find this paper:
I. Dumitrescu and N. Boland, "Improved Preprocessing, Labeling and Scaling
Algorithms for the Weight Constrained Shortest Path Problem", Networks, 42(3
), pg. 135-153, 2003.
The authors compared several algorithms. The conclusion is that the labeling
algorithm is the best, which, by the way, is close to my algorithm, hehe.
p**********g
发帖数: 378
20
the shortest synthetic route
m********r
发帖数: 811
21
What is the shortest non-zero lenght, L, of a magnetic quadrupole that is
imaging in the horizontal plane, with omega=9 ?
D**u
发帖数: 204
22
来自主题: Science版 - a (longest)shortest path problem
Just heard such a problem:
(0,0,0), (1,0,0), (0,1,0), (0,0,2),... (1,1,2) are the vertices of a
chang2 fang1 ti3. An ant is at (0,0,0) and can move on the surfaces of
this chang2 fang1 ti3. If you pick up a point A on the surface, the
ant can always choose the shortest path to A (from (0,0,0) ).
In order to make the ant move the longest path, you
need to find a point on the surface.
Question:
(1) Do you think (1,1,2) is the point that you should choose?
(2) if you have the energy, please find ou
c*****a
发帖数: 808
23
来自主题: JobHunting版 - 搞了小半个月,leetcode还有20题
新鲜写的 longest common prefix,之前没做过
public class Solution {
public String longestCommonPrefix(String[] strs) {
// Start typing your Java solution below
// DO NOT write main() function
if(strs.length ==0) return "";
String shortest=strs[0];
for(String s: strs){
if(s.isEmpty()) return "";
if(s.length() shortest = s;
}
int length = shortest.length();
while(true){
b... 阅读全帖
p**********1
发帖数: 1458
24
来自主题: Football版 - Super bowl props
大家觉得哪个可以赌啊?最后一列(例如2.21 跟1.704)是赔率,下注一块。
NFL Propositions
New York Giants vs New England Patriots: Aaron Hernandez Props
SUN 2/5 WILL AARON HERNANDEZ SCORE A TD?
03:30 PM 701 Yes 2.210
702 No 1.704
SUN 2/5 TOTAL PASS RECEPTIONS FOR AARON HERNANDEZ?
03:30 PM 703 Over 5.5 Receptions 1.840
704 Under 5.5 Receptions 2.020
SUN 2/5 TOTAL RECEIVING YARDS FOR AARON HERNANDEZ?
03:30 PM 705 Over 68.5 Receiving Yards 2.050
706 Under 68.5 Re... 阅读全帖
h*****u
发帖数: 109
25
来自主题: JobHunting版 - 近来比较重复的问题, 求解
我感觉这个是one-to-all shortest path的变形。如果在坐标上有一个点s,距离的和
最小,等同于每个城市到s的shortest distance。
for s in all points
determine the sum of the shortest distances
output the minimum one
算shortest distances时,可以用all-pair shortest paths, such as Floyd-
Warshall
o*q
发帖数: 630
26
来自主题: JobHunting版 - 请教leetcode高频题是哪些题
# Title Editorial Acceptance Difficulty Frequency
1
Two Sum 28.3% Easy
292
Nim Game 54.4% Easy
344
Reverse String 57.3% Easy
136
Single Number 52.2% Easy
2
Add Two Numbers 25.6% Medium
371
Sum of Two Integers 51.6% Easy
4
Median of Two Sorted Arrays
20.4% Hard
6
ZigZag Conversion 25.6% Easy
13
Roman to Integer 42.7% Easy
237
... 阅读全帖
w*******g
发帖数: 9932
27
来自主题: CS版 - This Woman is really cute

You don't follow the same shortest path as before.
You only update the nodes that are neighbors of u where k(u) = i for each i.
The key here is that for a unknown graph, you don't know how long is the shortest
path from source to the destination. That is why Bellman-Ford's algorithm needs
|V| iterations.
For this problem, that distance of the shortest path between v and u
is bounded by the distance of the previous shortest path and
you can find out the new shortest path by a BSF-like traversal
s*x
发帖数: 3328
28
来自主题: Mathematics版 - 一个三角形问题
中学数学题
sum distance <= 2 x measure / shortest edge
= shortest edge x height / shortest edge
= height on the shortest edge
<= any edge that is not the shortest
<= sum of any two edges
d********w
发帖数: 363
29
来自主题: JobHunting版 - [算法] word ladder problem
amazon好像出过此题,简单的说,就是一个原始字符串,一个目标串,求最少的变换的
路径,要求每次变化后的词都在一个字典中。
有些人说bfs,还是dijkstra算法?
下面是原题
// http://www.cs.duke.edu/csed/newapt/allwordladder.html
A word ladder is a sequence of words in which each word can be transformed
into the next word by changing one letter. For example, the word ladder
below changes 'lot' to 'log'.
lot dot dog log
This is not the shortest word-ladder between 'lot' and 'log' since the
former can be immediately changed to the latter yielding a word ladder of
length two:... 阅读全帖
D**********R
发帖数: 25234
30
今天带娃参加学区的language group,是给语言表达上有欠缺的孩子提供的服务,不过
很多指导对普通孩子也可能有帮助,训练师给了一张单子,是
concepts in order of difficulty by age band
按半年的时段,给3-6岁的孩子提出了一些需要掌握的概念,让我贴在家里冰箱上,对
照娃的年龄那一条,经常在对话中用到这些概念,让娃也会掌握和使用这些概念。
敲完发现有许多词是重复的,顺序也不一样,不知道怎么回事,不过既然总体就这些概念,照着练练总没错的,大家做
参考吧
3-0 to 3-5 (三岁0个月到三岁5个月,以下类推)
least difficult to most difficult
top
another
under
missing
highest
finished
nearest
all
up
empty
tallest
both
outside
down
largest
different
full
same
longest
in front
many
across
most
smallest
around
next
===========... 阅读全帖
w*******g
发帖数: 9932
31
来自主题: CS版 - This Woman is really cute
hmmm, it is not exactly BFS.
This is not the same problem as the one that I dealt with before :(
I think the solution should be that
assume each node u is given the total weight (d(u)) and
the # of edges (let's call it k(u)) of the shortest path from the source v.
Based on the new weights of all edges,
update the shortest path of all nodes have edges from u where k(u)=1
and then update the shortest path of all nodes with edges from u where k(u) = 2,
and then update the shortest path of all nodes
i**********e
发帖数: 1145
32
来自主题: Programming版 - [算法] word ladder problem (转载)
【 以下文字转载自 JobHunting 讨论区 】
发信人: dongfeiwww (feifei), 信区: JobHunting
标 题: [算法] word ladder problem
发信站: BBS 未名空间站 (Mon Jan 24 23:59:22 2011, 美东)
amazon好像出过此题,简单的说,就是一个原始字符串,一个目标串,求最少的变换的
路径,要求每次变化后的词都在一个字典中。
有些人说bfs,还是dijkstra算法?
下面是原题
// http://www.cs.duke.edu/csed/newapt/allwordladder.html
A word ladder is a sequence of words in which each word can be transformed
into the next word by changing one letter. For example, the word ladder
below changes 'lot' to 'log'.
lot dot dog log
This is not... 阅读全帖
q**j
发帖数: 10612
33
来自主题: Automobile版 - 终于有人说真话了
再给你看几个例子。你要是说美国人民不喜欢Camry,Sonata和Mustang,整个美国人都
笑了。TrueCar要吸引人眼球,谁简单轻信这种分析才是真的要反省了。
http://www.prnewswire.com/news-releases/truecarcom-identifies-m
e-shortest-and-longest-stays-on-dealership-lots-103851803.html
2010 Shortest Vehicles in Inventory, by model

2010 Chevrolet Equinox
2010 GMC Terrain
2010 Toyota 4Runner
2010 Longest Vehicles in Inventory, by model
2010 Toyota Camry
2010 Hyundai Sonata
2010 Ford Mustang
2011 Shortest Vehicles in Inventory, by model
Honda Accord
Ford Esc... 阅读全帖
b******y
发帖数: 660
34
来自主题: JobHunting版 - 问一道数据结构题
if it the "path" is the shortest path,
we can use adjacency matrix, each entry a[u][v] stores the length the
shortest path from u to v.
if u->v has no path, then set a[u][v] = -1
In this way, we can tell whether this is a path from u to v in O(1) by
checking if the entry is -1; we can also tell in O(1) whether there is a
shortest path of length k by checking whether the value of the entry is k.
if it the "path" is the simple path,
we can expand the adjacency matrix to be 3-D, i.e., a[u][v][i], t... 阅读全帖
w*******l
发帖数: 14
35
来自主题: JobHunting版 - Thoughtworks code assessment, aptitude paper.
code assessment是我自己面的。
aptitude paper是从老印论坛扒的。
PROBLEM ONE: TRAINS
Problem: The local commuter railroad services a number of towns in Kiwiland
. Because of monetary concerns, all of the tracks are 'one-way.' That is,
a route from Kaitaia to Invercargill does not imply the existence of a route
from Invercargill to Kaitaia. In fact, even if both of these routes do
happen to exist, they are distinct and are not necessarily the same distance!
The purpose of this problem is to help the railroad p... 阅读全帖
p****n
发帖数: 69
36
来自主题: JobHunting版 - 问一道题(groupon)
Assume the shortest path is of length N.
Call the shortest path algorithm for each node that is directly connected to
the source and record the lengths. Among these lengths, there should be one
(or some) equal to N-1, corresponding to the shortest path. If the next
smallest length is M. Then the answer is M+1.

getShortestPath
r****c
发帖数: 2585
37
来自主题: CS版 - This Woman is really cute
Faint
The problem is not clear and well defined
It is said that "the shortest path is already computed" is it mean a certain
pair of
source and destination or all pairs
for the objective: find the new shortest path is mean the all pairs
if all pairs, it could not be O(E)
Btw, even the objective is for a fixed pair of end points,
do not understand your solution
"just go through the graph edge by edge and determine whether the current
edge is the shortest path between its end points. the algorithm
c******m
发帖数: 98
38
来自主题: CS版 - This Woman is really cute
Could you please explain how to exam each edge? Thanks.
Given the shortest path between any pair, how to compute
the shortest path after adding k?
Besides, maybe what is given is only the shortest path to
one specific source node.
r****c
发帖数: 2585
39
来自主题: CS版 - This Woman is really cute
Yeah you are right
actually, we can find the shortest path tree not only a pair of shortest path
the key observation is that every edge is considered at most once,
can you imagine how to find the all shortest path in O(E)?

once.
v.
k(u) = 2,
k(u) = 3,
previously
complexity
c***g
发帖数: 472
40
来自主题: Programming版 - one question about algorithm
given one article, and a set of keywords
find the shortest length part which contain all the keywords
how to do that?
After translated, it will be: given a sequence, how to
find a shortest substring that contains all the items required. Example: a s
equence "abaccdefgacel" and a set of key words "a" "c", "d" and "e". The sho
rtest substring contianing all of the key words is "accde". Find one of such
shortest substrings.
w*******y
发帖数: 60932
41
Link:
http://www.amazon.com/gp/product/B003B3P2CO/ref=s9_simh_gw_p23_d0_i1?pf_rd_m=ATVPDKIKX0DER&pf_rd_s=center-2&pf_rd_r=063YWSJCN0DN85NWZKST&pf_rd_t=101&pf_rd_p=470938631&pf_rd_i=507846
Amazon.com Product Description
Outsmart traffic with the TomTom XXL 540M, complete with five-inch
widescreen navigation plus Lifetime Map Updates. On average, 15% of the road
network changes each year, so it is important to have the most up-to-date
maps. With the TomTom XXL 540M you'll always stay current with ... 阅读全帖
C********g
发帖数: 9656
42
转基因玉米的神话
http://www.rainbowplan.org/bbs/topic.php?topic=107689
送交者: 六指 于 2010-03-25 12:25:45
转基因现在是网上的热门话题,这其中自然少不了在转基因食品上市前就已试吃过的方
老师的身影。学习完他的科普熊文“转基因玉米更有益健康”后,再做延伸阅读,稍加
搜索就看到一篇2004年的洋文”Bt corn reduces serious birth defects”【http://westernfarmpress.com/news/10-27-04-Bt-corn-birth-defects/ 】。方老师的文章基本观点,数据,内容编排都和这篇雷同,不少句子更是原文照译。这进一步验证了一条世人皆知的谣言“方老师写的东西,也有成段的引文献或者直接是英语文章翻过来的”。方老师打开门辟谣,关上门立马就造谣,此等大无畏的勇气和人格力量实在是让我等折服。
方老师涉嫌抄袭早已不是什么新鲜话题,这里说说转基因。这篇洋文的两位作者实际上
是做”二阶科学传播“,主要介绍了当年在“营养学杂志”发表的一篇综述【http://jn... 阅读全帖
E*V
发帖数: 17544
43
Amtrak 票价 NYC - DC $134- $162
today one way
Afternoon $134.00
Evening $134.00
Shortest Trip
2 hr, 47 min
$162.00
next month if you buy in advance
$49 3Hours and 15 min to 3 hours 57 mins
$139 for for 2 hr 47 min
Lowest Price
Morning $49.00
Afternoon $49.00
Evening $49.00
Shortest Trip
2 hr, 47 min
$139.00
E*V
发帖数: 17544
44
来自主题: Military版 - Amtrak 票价 NYC - DC $134- $162
today one way
Afternoon $134.00
Evening $134.00
Shortest Trip
2 hr, 47 min
$162.00
next month if you buy in advance
$49 3Hours and 15 min to 3 hours 57 mins
$139 for for 2 hr 47 min
Lowest Price
Morning $49.00
Afternoon $49.00
Evening $49.00
Shortest Trip
2 hr, 47 min
$139.00
c*****g
发帖数: 21627
45
来自主题: USANews版 - 疣太高盛迫害前员工
Michael Lewis: Did Goldman Sachs Overstep in Criminally Charging Its Ex-
Programmer?
A month after ace programmer Sergey Aleynikov left Goldman Sachs, he was
arrested. Exactly what he’d done neither the F.B.I., which interrogated him
, nor the jury, which convicted him a year later, seemed to understand. But
Goldman had accused him of stealing computer code, and the 41-year-old
father of three was sentenced to eight years in federal prison.
Investigating Aleynikov’s case, Michael Lewis holds a s... 阅读全帖
c*******o
发帖数: 8869
46
来自主题: USANews版 - 福临,priebus, Spicer可能被雷
Flynn, the shortest lived NSA,
Spicer, the shortest lived press secretary...
c********d
发帖数: 11593
47
我还是觉得tomtom好使,如果不是它的地图更新总不够快……天晓得设计garmin最短路
径算法的是什么角色,家里的garmin每次给我指的路都超级奇葩。如果要shortest
time,它至少能带我多兜三个迈,直接导致我比其他人晚几分钟到;如果要shortest
distance,它就带我尽走些窄得匪夷所思的羊肠小道,石子路都有。
终极解决方式是配了google map或者waze的手机。
z*********3
发帖数: 37
48
来自主题: JobHunting版 - 发Google面经,为明天MS攒rp
能不能展开说说? 用dp的话,不能保证两个子串的shortest substring合起来也是
shortest substring吧,中间还有很多字符
c*****e
发帖数: 74
49
来自主题: JobHunting版 - 请教一下超大图的存储问题
Several things to consider in designing a graph data structure:
1. Is there a need to add/delete graph Nodes?
2. Is there a need to add/delete graph Edges?
3. How to check whether there is a edge between two Nodes?
4. How to iterate all the edges incoming/outgoing to one Node?
5. How to calculate the shortest path between two Nodes?
6. How to calculate the shortest path of each node pair?
7. How to serialize and deserialize a graph data structure?
Seems the problem here is on how to serialize/de... 阅读全帖
v****s
发帖数: 1112
50
来自主题: JobHunting版 - share一个a公司的2nd phone
how to compute all-pair shortest path in a give graph? complexity?
how to store them in a database to get efficient query performance? e.g.,
how
to return the shortest path for query vertices A and B?
1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)