V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
dhnUphp
V2EX  ›  程序员

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

  •  
  •   dhnUphp · May 20, 2014 · 3070 views
    This topic created in 4363 days ago, the information mentioned may be changed or developed.
    2 replies    2014-05-21 09:19:50 +08:00
    davidli
        1
    davidli  
       May 20, 2014
    给个例子吧。
    我猜了两种。
    1) list.append(element)
    2) if element in list: ...
    dhnUphp
        2
    dhnUphp  
    OP
       May 21, 2014
    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
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2428 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 05:10 · PVG 13:10 · LAX 22:10 · JFK 01:10
    ♥ Do have faith in what you're doing.