Message from @Unwound

Discord ID: 543642115989831730


2019-02-09 03:52:08 UTC  

GR is a descent show.

2019-02-09 03:52:13 UTC  

Oh okay I guess

2019-02-09 03:52:18 UTC  

would you convert adp to ATP by adding a phosphate?

2019-02-09 03:52:30 UTC  

i'd tap that, sure

2019-02-09 03:52:41 UTC  

It’s more of a process than that

2019-02-09 03:52:51 UTC  

yes no duh sherlock

2019-02-09 03:53:49 UTC  

```c
void* rl(struct node *root)
{
struct Node *p, *n, *c = root;
while (c)
{
n = c->next;
c->next = p;
p = c;
c = n;
}
return p;
}
```

2019-02-09 03:53:59 UTC  

Is it true?

2019-02-09 03:54:04 UTC  

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. 😀

2019-02-09 03:54:32 UTC  

why not

2019-02-09 03:54:41 UTC  

mitochondria is the powerhouse of the cell

2019-02-09 03:55:49 UTC  

There. That should be the shortest code possible.

2019-02-09 03:56:16 UTC  

Boundary conditions covered, too, if you pass null, you get null back.

2019-02-09 03:56:25 UTC  

Won't work for loops.

2019-02-09 03:56:38 UTC  

O(n) no extra storage.

2019-02-09 03:58:39 UTC  

would it kill you to give real names to your variables?

2019-02-09 03:58:47 UTC  

You could make a minor change for loop detection.

2019-02-09 03:59:20 UTC  

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.

2019-02-09 03:59:26 UTC  

just store visited nodes

2019-02-09 03:59:40 UTC  

even easier, have a runner go 2x as fast, still o(n)

2019-02-09 03:59:57 UTC  

Yes, that is a common approach to loop detection.

2019-02-09 04:00:16 UTC  

@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.

2019-02-09 04:00:48 UTC  

Skiena, Steven S. The algorithm design manual: Text. Vol. 1. Springer Science & Business Media, 1998.

2019-02-09 04:01:26 UTC  

didn't he die recently?

2019-02-09 04:01:52 UTC  

Elements of Programming Interviews is as good as it gets in regards to core CS fundamentals and interviews

2019-02-09 04:01:55 UTC  

Yes, that's a good point.

2019-02-09 04:02:29 UTC  

Dennis? unfortunately. almost a decade ago i think

2019-02-09 04:02:37 UTC  

@CasualSailor You should always think of algorithms primarily in terms of the abstract entities, not in terms of the programming language.

2019-02-09 04:03:09 UTC  

Sorry, I don't like books that are specifically with interviews in mind. @Unwound

2019-02-09 04:03:16 UTC  

Doesn't mean it has to be bad.

2019-02-09 04:03:21 UTC  

to each his own, no worries.

2019-02-09 04:03:30 UTC  

They just don't place the right focus I think.

2019-02-09 04:04:14 UTC  

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.

2019-02-09 04:04:20 UTC  

Separation of concerns.

2019-02-09 04:04:47 UTC  

https://cdn.discordapp.com/attachments/463054787336732683/543643401933946890/unknown.png

2019-02-09 04:04:47 UTC  

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.

2019-02-09 04:05:00 UTC  

Tim got a bump from Joe Rogan.

2019-02-09 04:05:03 UTC  

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

2019-02-09 04:05:13 UTC  

@CasualSailor That book is good.