Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> most optimal solutions tended to require a stateful, even pointer-diddling, style of code

not necessarily, a search problem can be solved in a functional way in 2 steps: 1) constructing a search space in lazy stream, this is where dfs or bfs happens 2) filtering the stream using standard filter function

Similarly if you do dynamic programming using memoization instead of tabularization you might not need any state

I think, like practical problem solving, algorithms have been predominantly taught in a stateful way of writing code that was popular because of the computing power constraints back in the day. That doesn't mean that's the only way to write them



Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: