Message from @Undead Mockingbird
Discord ID: 543642682505953289
Is it true?
I'm just going to admit my ignorance. Last time someone posted something cryptic and I googled it, I was not happy that I did. 😀
why not
mitochondria is the powerhouse of the cell
There. That should be the shortest code possible.
Boundary conditions covered, too, if you pass null, you get null back.
Won't work for loops.
O(n) no extra storage.
would it kill you to give real names to your variables?
You could make a minor change for loop detection.
I wasn't sure. That's why I had to change it. I was inclined to type proper names, but I also wanted it short for Discord.
just store visited nodes
even easier, have a runner go 2x as fast, still o(n)
Yes, that is a common approach to loop detection.
@Undead Mockingbird I picked up this book years ago. It's written by Brian Kernighan who wrote C with Dennis Richie. In it he takes all sorts of routines like linked lists, trees, sorts and writes them in C, C++, Java, Perl, and a few others to show the strengths and weakness and the libraries of each. It sort of changed the way I looked at programming. It helped me to think of things language independent.
Skiena, Steven S. The algorithm design manual: Text. Vol. 1. Springer Science & Business Media, 1998.
didn't he die recently?
Elements of Programming Interviews is as good as it gets in regards to core CS fundamentals and interviews
Dennis? unfortunately. almost a decade ago i think
@CasualSailor You should always think of algorithms primarily in terms of the abstract entities, not in terms of the programming language.
Sorry, I don't like books that are specifically with interviews in mind. @Unwound
Doesn't mean it has to be bad.
to each his own, no worries.
They just don't place the right focus I think.
IMHO it's better to have a book that doesn't worry about interviews, like Skiena, Knuth, and so forth and then buy a separate book that is just about coding interviews.
Separation of concerns.
That's the thing, you have to find a book that appeals to you. Lots of people recommend Algorithms in C by Sedgwick but I found him dry and hard to read.
Tim got a bump from Joe Rogan.
best way to git gud is to just literally code. lol. but yes the math portions of CS (almost all of it) is to be learned by book
@CasualSailor That book is good.
The best way I have found to improve my algorithm skills is with code competitions.
CS is math, not programming.
For example, there is the Top Coder Arena. I think they were bought by Google.
You can enter all sorts of challenges. For a long time I would code some algorithm every morning and time myself.
But Petzold's Programming Windows taught me so much about writing GUIs that I could not recommend it enough. Once you can write windows apps using the native API calls doing so with library code is a breeze.
Ah, Petzold. Yes, I read that.
I have done a bit in Win32 in the days.