写伪代码时,有没有用到 let in 这种结构的。这是什么关系啊。

2014-05-20 17:39:35 +08:00
 dhnUphp
2510 次点击
所在节点    程序员
2 条回复
davidli
2014-05-20 19:03:40 +08:00
给个例子吧。
我猜了两种。
1) list.append(element)
2) if element in list: ...
dhnUphp
2014-05-21 09:19:50 +08:00
Pseudo Code 11.10.
1 function reachabilityAndRadius(G = (V; E); s) =
2 let
3 % requires: X = fu 2 V j G(s; u) < ig ^
4 F = fu 2 V j G(s; u) = ig
5 % returns: (RG(s); maxf G(s; u) : u 2 RG(s)g)
6 function BFS(X; F; i) =
7 if jFj = 0 then (X; i)
8 else
9 let
10 X0 = X [ F ( Visit the Frontier )
11 N = NG(F) ( Determine the neighbors of the frontier )
12 F
0 = N n X0
( Remove vertices that have been visited )
13 in BFS(X0
; F0
; i + 1) end ( Next level )
14 in BFS(fg; fsg; 0) end

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/113441

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX