in reply to Re^2: Brute force vs algorithm (PWC # 100)
in thread Brute force vs algorithm (PWC # 100)

Hmm, I didn't think it my method was as bad as the brute force, but it apparently is. So much for that idea. (it's how I would've solved it. Also, your implementation was better than mine would have been, even for my naive algorithm.)
  • Comment on Re^3: Brute force vs algorithm (PWC # 100)

Replies are listed 'Best First'.
Re^4: Brute force vs algorithm (PWC # 100)
by LanX (Sage) on Feb 15, 2021 at 20:17 UTC
    > I didn't think it my method was as bad as the brute force

    It's not, brute (well the brutest) force will explore all possible path.

    The number of possible path grows much faster than m (I'd say exponentially).

    (... but with such a small triangle that's only of theoretical interest )

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

    ) sure it's p = 2**(n-1)