in reply to Capturing the nth word in a string
Unless you are doing something that requires user interaction or is time dependent, if it works, and is somewhat readable, your solution is great. If you were dealing with a 5e10 words, yeah, efficiency would really matter. Who would want their machine to run out of memory?
It's like comparing the bubble sort to the merge sort to the quick sort on a small set of data. Oddly enough, bubble sort does really really well since the overhead is so low. But once the size gets significant, it does shitty. AND if you are performing an operation on a small set of data, not only on sorting, it doesn't really matter. It's readable, w/o your explanation. Horay! :)
|
|---|