V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
tedd
V2EX  ›  问与答

loop 里面做 reduce 的效率很差吧?应当如何优化呢?

  •  
  •   tedd · Apr 12, 2016 via iPhone · 1390 views
    This topic created in 3676 days ago, the information mentioned may be changed or developed.
    这等实现的大 O 是多少呢?我记得应该是最差的一种。如果要优化的话我能想到的是(譬如 loop 的是个数组),那逐个将数组元素给 pop 出来,然后做 reduce ,不知道会不会好些呢?
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1039 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 18:42 · PVG 02:42 · LAX 11:42 · JFK 14:42
    ♥ Do have faith in what you're doing.