Created
November 12, 2019 13:45
-
-
Save onpaws/d0310788b1b695869e687f804aefd2fe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
via https://news.ycombinator.com/item?id=21508927 | |
A semi-common beginning programmer's exercise is to write a program that numbers the lines in a text file. | |
The naive solution will use O(n) space, while a bit more thought reveals that this can be done in constant | |
(to be really precise, O(log n) where n is the number of lines in the file) space. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment