r/AskComputerScience • • 1h ago

Hanoi's recursion not making sense

• Upvotes

So I'm in the second year of my CS degree and doing DSA, now we have to understand Tower Of Hanoi, I studied the game, studied the trace diagrams, looked up multiple tutorials for it, I get what the program but I don't at the same time. I get how it arrives at the minimum but I think if you gave me a problem to solve via recursion I'd be stumped, I understand how this specific of recursion works but I don't know how I would...make it? If you asked me to create a Hanoi algorithm or any recrusive algorithm recursively I won't be able to but at the same time I understand somewhat how they work?


r/AskComputerScience • • 15h ago

why is comparison sorting stuck at n log n but counting sort gets away with O(n)

2 Upvotes

i get the decision tree argument for why any comparison sort needs log2(n!) comparisons, which is about n log n. but then counting or radix sort does it in linear time and people just say it's cheating because it isn't comparing.

what i can't figure out is whether that's a real escape or just hiding the cost somewhere. like radix sort is O(d*n) but d is basically log of the max value, so for n distinct keys isn't it back to n log n anyway?


r/AskComputerScience • • 4h ago

Guys, how do AI stuff works?

0 Upvotes

I'm kinda smart for a lot of things and thought AI was one of these thing but apparently it evolved too fast and I lost the line of understanding it almost automatically and now am a bit lost on the AI train.

So here it goes: what exactly is a model? is a LLM a type of AI or one of the stuff AI can do? what exactly is a token? how can AI run locally if it needs those tokens? what is an agent/how does it works? what is a harness? why the agent needs a harness?

I've been researching this subjects but only came across stuff that looks too advanced for my level to understand.

Thanks :)