alex brady Posted on Oct 17, 2020 Can you spot the algorithmic error? #computerscience #algorithms #algorithmicthinking #pseudocode Buggy Code This algorithm has a bug in it. (Spoiler Alert: Solution below) This is the same pseudocode with the bug removed Did I miss any bugs? Top comments (2) Subscribe Personal Trusted User Create template Templates let you quickly answer FAQs or store snippets for re-use. Submit Preview Dismiss Collapse Expand Ben Sinclair Ben Sinclair Ben Sinclair Follow I'm an ex-sysadmin from the late 20th century. These days I do more software architecture and whatnot, and promote UX and accessibility. Location Scotland Education Something something cybernetics Pronouns They/them Work General-purpose software person Joined Aug 29, 2017 • Oct 17 '20 Dropdown menu Copy link Hide Did you miss any bugs? Yes, the question count is undefined. For it to work in your code it needs to start at zero, otherwise the length of the game is indeterminate and possibly infinite :) Collapse Expand alex brady alex brady alex brady Follow Software Engineer, Specialty: Web Open for work Email iamalexbrady@gmail.com Location Remote Work Software Engineer at alex brady's llc Joined Oct 13, 2020 • Oct 22 '20 Dropdown menu Copy link Hide I actually just fixed this in the actual blog post yesterday. Good eye! Code of Conduct • Report abuse Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink. Hide child comments as well Confirm For further actions, you may consider blocking this person and/or reporting abuse
Top comments (2)
Did you miss any bugs? Yes, the question count is undefined. For it to work in your code it needs to start at zero, otherwise the length of the game is indeterminate and possibly infinite :)
I actually just fixed this in the actual blog post yesterday. Good eye!