https://github.com/munificent/linkedlist
Reversing a linked list
https://github.com/munificent/linkedlist
Last synced: 9 months ago
JSON representation
Reversing a linked list
- Host: GitHub
- URL: https://github.com/munificent/linkedlist
- Owner: munificent
- License: other
- Created: 2010-12-18T23:52:01.000Z (about 15 years ago)
- Default Branch: master
- Last Pushed: 2010-12-21T00:58:23.000Z (about 15 years ago)
- Last Synced: 2025-02-07T17:48:51.754Z (11 months ago)
- Language: Go
- Homepage:
- Size: 93.8 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README
- License: LICENSE
Awesome Lists containing this project
README
Apparently, a common programming interview question these days is to write a
function that reverses a linked list. Sometimes they explicitly request a
recursive or iterative solution. Like most bare data structure programming,
getting this right is surprisingly finicky (which is why most of us these days
use nice libraries that provide higher-level abstractions for this).
Just to make sure I'm keeping my tools sharp, I went ahead and implemented this
in all four permutations of:
- Recursive or iterative
- In-place or creating a new list
Unsurprisingly to any functional programmer, the recursive immutable list one is
the most terse.