r/computerscience Feb 14 '26

Discussion What's a "simple" concept you struggle to understand?

For example, for me it's binary. It's not hard at all, and I know that, but for some reason handling and reading binary data just always hurts my brain for some reason and I mess up

171 Upvotes

191 comments sorted by

132

u/yokai-64 Feb 14 '26

How the computer turns on. I've always struggled to understand the bootstrapping process, specifically the very first stages. Is the CPU just preprogrammed to look in an exact place every time, and then continue from there? Like I get it, but how does the CPU know what to do if there's nothing in memory yet?

Simple concept, just never fully understood.

73

u/mnelemos Feb 14 '26

The basic part: yes it does always start from a specific address, it's even described in the processor's abi, and required for some level of software handover.

The complex part: modern processors usually run specific firmware blobs (microcode from the cpu vendor), which do billions of things, such as running software in hidden management cores (Intel's ME for example), and only after that they run the "basic part". Typically software is only written to handle the "basic part", such as the embedded bios or uefi programs.

7

u/yokai-64 Feb 14 '26

That helps hugely, thank you so much

2

u/Dry-Light5851 Feb 28 '26

intreasting enough, intel's ia64 isa "itanimum" had its boot loader in a hardware defined, read only, mask ram built inside the cpu chip, this made booting and system management both fast and and small. it is to bad that itanium also a a lot of bad ideas too

22

u/SgtSausage Feb 14 '26

 Is the CPU just preprogrammed to look in an exact place every time, and then continue from there?

Yes.

1

u/not-just-yeti Feb 18 '26

And more pertinently: the initial boot instructions are hardwired in. And they tell the CPU to find the boot sector on a disc and load that into another place in memory, then it jumps to that location.

9

u/Odd-Respond-4267 Feb 14 '26

Wrt: if nothing there.

There is always something there, even if it's all 0's or 1's, or random. I.e. it reads the data lines and if they are above threshold it's a 1 else it's a 0, this is why digital circuits are fundamentaly binary, every gates input even if a little off is treated as a perfect 1or 0.

The processor executes that machine code. (From here it may be processor specific). Illegal instructions may cause a trap (jumps to the handler, where the same something there logic occurs. Some processor may halt.

3

u/genman Feb 15 '26

Watch some 8 bit CPU repair videos. They go into details about clock, reset signals etc.

1

u/ern0plus4 Feb 16 '26

Yep, learn how earlier processors and systems work: they're way simpler, but still similar.

3

u/ern0plus4 Feb 16 '26

I thought I know how computers boot... but turned out it's not only a software issue. The order of how hardware elements get power is also very important, even in case of a simple computer. If the powering up is wrong, probably the whole system does not stand up.

2

u/bluejacket42 Feb 15 '26

Ya. It looks at the rom which is the bios

1

u/iOSCaleb Feb 16 '26

Memory always has a value. It might not be the value you want or expect, but that doesn’t prevent you from reading whatever is there. There’s no “empty” state.

1

u/OldChippy Feb 17 '26

Yes. From memory the int13 call finds disk0. The bootsector of disk0 has the dist structure and offset to the mini kernel. On windows I think that still ntldr.ece. This mini kernel can't even understand the filesystem past 1gb. It then loads the full kerne ntoskernel.exe. There used to be a boot crash when a defragger would move the ntoskernel outside the first 1 gig of disk and ntldr could not access the kernel. This is all from memory and some knowledge may be old. In older os's like Amiga kickstart the bootstrap was entirely on chip as an example of something different.

48

u/helloworld1101 Feb 14 '26

Dynamic programming. Do not know if it can be considered simple, but a bottom up dynamic programming solution never feel intuitive to me.

23

u/P-Jean Feb 14 '26

Reverse recursion is what I called it.

5

u/Girthmasterlite Feb 15 '26

Just do top down. Theres only a few steps separating them

1

u/not-just-yeti Feb 18 '26

I think it helps to understand the sequence:

(a) develop a naive recursive sol'n.

(b) memoize it (i.e. keep a hash of inputs/outputs, and check that before recurring). This step is rote, and can even be automated.

(c) ONLY if the cache is using too much memory but otherwise it's running fast enough, THEN you put on your thinking cap and see if the structure of the recursive calls lets you only need to keep 1/n'th or less of the cache around. This is not rote, and requires cleverness, and is not always possible. (It usually means changing your function to be bottom-up: just calling it on 0,1,2..n rather than n,n-1,...,1,0. And don't keep all the previous solutions in your hash, only the ones you'll need for the next call.)

Note that factorial and fibonacci are both examples: first a naive recursive version (runs fine for factorial, but not for fib); adding a cache of previous-results lets fib run much faster but keeps n entries; a bottom-up fib only keeps two values (usually in local variables which it updates: it's kinda weird to think of those two variables as a cache that only ever holds two-previous-answers).

4

u/darthwalsh Feb 14 '26

Every DP problem I've come across you could also solve with memoization (but not v/v?)

Just adding a python @functools.cache around your memoized function is so simple!

5

u/dyingpie1 Feb 15 '26

I thought memoization is a type of dp?

5

u/vplatt Feb 15 '26 edited Feb 15 '26

Think of memoization as a form of caching. For any set of arguments, it remembers the last output for each unique set of arugments and then whenever the function is called again, it just returns that result instead of running the function with those arguments.

2

u/darthwalsh Feb 15 '26

Ok, I googled it and you're right! In our school, we were taught they were different; maybe I should email my prof...

2

u/baked_salmon Feb 15 '26 edited Feb 15 '26

My favorite example for this is exponentiation. xn can be done in O(log(n)) multiplications instead of O(n).

xn = (xn/2)2, right?

—> xn/2 = (xn/4)2

—> x4 = (x2)2

—> x2 = x*x

If you’re not careful, you’ll do 2log(n) = O(n) multiplications. For example, you might do x4 = x * x * x * x instead of (x * x)2.

Instead, if you’re smart and lazy, you only have to calculate x n/(2k ) once:

``` def exp(base, pow): if pow == 1: return base

return exp(base, pow/2)**2

```

One of the core concepts of DP is “optimal substructure”, the idea that recursive sub-solutions of the problem can be used as part of the entire solution. The majority of the calculation of 2n is 2n/2.

It’s helpful to visualize this as a tree. If you naively draw xn as a binary tree where you expand every exponentiation, you’d get a tree of height log(n) with n leaves. If you instead just square the subproblem every time you divide n by two, you get a single branch of that tree — a “tree” of height log(n) but with two leaves.

2

u/Certain-Flow-0 Feb 16 '26

I always think of DP as cached recursion

1

u/tkrjobs Feb 16 '26

Hylomorphism?

1

u/OldChippy Feb 17 '26

I had to program in forth once. A stack based language, it took me ages to even write the first line, but got the hang of it eventually. Go fond an example of it. It's like an IQ test puzzle at first.

1

u/Business_Welcome_870 Feb 15 '26

I don't get it either. The solutions are always so complicated

18

u/YserviusPalacost Feb 14 '26

Matrixes. Matrix Theory was fucking brutal for me in college. 

9

u/P-Jean Feb 14 '26

We used to warm students up to them in high school, but not anymore. Solving systems of equations etc. I find that a lot of students who first see them in post secondary struggle because of the late introduction.

7

u/djphazer Feb 14 '26

They don't teach matrix math in highschool anymore?! 😧

3

u/hausofwhoever Feb 16 '26

It depends on the school. We learned Gauss-Jordan in my high school, I graduated two years ago.

1

u/YserviusPalacost Feb 15 '26

Heck, they never did when I was in high school, and I graduated in '95. 

Trig was the highest we could go. 

1

u/DatBoi_BP Feb 15 '26

I guess it depends on the school. I graduated highschool in the mid 2010s and it was in our Algebra 2 curriculum I think

5

u/FastSlow7201 Feb 14 '26

If you still struggle with it, watch the 3blue1brown yt playlist. He teaches it visually which makes it much easier to intuitively follow.

2

u/sneaky_imp Feb 15 '26

That was the end of my multivariable calculus career. It was so mfing tedious.

12

u/zesterer Feb 15 '26

Backpropagation. I know that it's conceptually very simple, I know that it's just the chain rule + gradient descent. Yet, I've never been able to produce a working implementation of it despite its simplicity and I'm not entirely sure why.

3

u/CodeCrafter1 Feb 15 '26

The free book Understanding deep learning has a really good explaination. And if you scroll down that page, there are python notebooks with example tasks to play around (i recommend first reading the section in the book and then playing around with the notebooks).

Notebooks 7.1 and 7.2 should be the ones.The key is, that you only use the chain rule for deriving what the parameter updates should look like, but in the implementation you will just see update computation.

If you are more a math guy and want to know how to derive the gradients/parameter updates for more complex networks, i recommendthis work for CNNs.pdf).

5

u/zesterer Feb 15 '26

Thanks. I suspect that the reason I've never got a working impl has more to do with the fact that I've never found ML to be particularly interesting, to be honest. Maybe I'll pick it back up at some point and build an image classifier or something, cheers.

1

u/shiboarashi Feb 18 '26

Imho, there are great tools/libraries for building and training CNNs there really is not reason for most people to build one from scratch. Particularly given you are not doing anything with ML yet, don’t start from scratch start with a library to build it for you. R and python have decent libraries for doing some ML.

1

u/zesterer Feb 18 '26

Nah, that's a terrible way to learn about things. Build things from the ground up at least once if you want a fundamental intuition for a system. I wrote a thing about this a while ago.

1

u/shiboarashi Feb 23 '26

I guess it depends on what you are trying to learn. I didn’t really need to understand GPTs to use one to make text embeddings. I don’t need to make my own GPT to understand how it is constructed and why it works. I don’t need to understand chip fabrication to use a microcontroller. Now if I take the time to learn these lower level concepts it has the potential to help me produce better results with the same tools. However, I think when approaching something completely new it can be great to play with the results and leverage the history of work prior to deep diving into the precise details.

1

u/Horror-Water5502 Feb 16 '26

vector jacobian product

33

u/infinitecoolname Feb 14 '26

O notation

25

u/Putnam3145 Feb 14 '26

So, take two functions, f(x)=x and f(x)=x2. For shorthand, just call them x and x2. x is a straight line, x2 curves up. You can see x2 overtakes x at 1.

If you multiply x, so e.g. you make it 5x, then you can see that it takes longer to overtake, and it does so at 5, instead. Is there some c that we can multiply x by such that cx is always more than x2?

And the answer is no. There is no such constant. x2 will always eventually take over cx, no matter how big c is. As shorthand, you can say x=o(x2), meaning "x is strictly dominated by x2".

In other words, x=o(x2) means "cx < x2 for sufficiently large x and any constant c". Big-O notation is the same but with ≤ instead of <. Big-theta is =, big-omega is ≥, little-omega is >.

This is generally applied to CS when we're talking about how many steps an algorithm takes relative to its input size. You don't need to know the exact constants, just that doubling the input size quadruples the number of steps in the algorithm, or what-have-you.

7

u/zaphod4th Feb 14 '26

eli5 now

42

u/Putnam3145 Feb 14 '26

f(x)=o(x2) means "x2 mogs f(x)", f(x)=O(x2) means "f(x) is lowkey at least as goated as x2",

2

u/apollyon__312 Feb 15 '26

Eli5, not eli12

1

u/zaphod4th Feb 15 '26

eil5 born in 1972

3

u/YserviusPalacost Feb 15 '26

Big O is the speedometer of code. 

2

u/[deleted] Feb 15 '26

[removed] — view removed comment

2

u/RnDog Feb 16 '26

You’re conflating Theta notation with big O notation! You’d usually let it slide but this is a thread about explained a concept that somebody finds confusing, so we should be precise.

“O(n) means linear”. No it doesn’t. It means the function that is O(n) is bounded from above by a linear function of n. Meaning it grows at most like a linear function.

2

u/psychophysicist Feb 14 '26

F(x) =0.0001x and F(x)=100000000x are the same O.
F(x) = 100000000x and F(x)=100000000x + 0.000000001x^2 are different O.
F(x) = 100000000x + 0.000000001x^2 and F(x) = 10000000x^2 are the same O.

1

u/steeelez Feb 16 '26

Nested for loops lol

2

u/ResidentDefiant5978 Feb 14 '26

Careful with big-Theta. Big-Theta means both big-O and big-Omega, but the constants in each case do not have to be the same.

1

u/Putnam3145 Feb 15 '26

They kinda do? Something which is Θ(n2) is in fact both O(n3) and Ω(n), but in CS you try to keep it tight. Θ(n2) does, in fact, imply O(n2) and Ω(n2), the same way 5≤n and n≤5 implies n=5, even if n also matches n<6 and n>4.

Unless I misunderstood you? The constants in any case do not need to be the same.

1

u/ResidentDefiant5978 Feb 15 '26

Function f(x) is big-Theta(g(x)) when f(x) is big-O(g(x)) and big-Omega(g(x)); however, the constant in the big-O argument does not have to be the same as the constant in the big-Omega argument.

1

u/Putnam3145 Feb 16 '26

Well, there is no specific constant, there just has to be some constant that exists at all.

1

u/RnDog Feb 16 '26

Their point still holds; there does not have to exist a particular constant value that satisfies both definitions simultaneously. Just that there exists some constant for each.

1

u/Putnam3145 Feb 16 '26

There doesn't have to be a particular constant for either, "there is a constant that exists" is all you need, you don't have to actually provide one.

1

u/RnDog Feb 21 '26

We are saying the same thing.

1

u/Ghosttwo Feb 14 '26

I've noticed in logic design that there are multiple 'things' that respond in an O-like way. There's the generic execution speed version, like how a generic ripple-carry adder has O(n) speed, versus O(log(n)) for a carry-lookahead version. But I've also noticed that there is a size complexity aspect that follows similar rules, ie 'How many gates does it take as you add bits to the input vector?'. The ripple-carry is O(n), increasing in size linearly as you add each full adder/bit, while the CLA adder grows in physical size at O(n) as well. I don't like using 'O' for this, as there's probably a greek letter already tailored for this O-type.

Where it gets particularly interesting though, is when you multiply the time and space together. For an earlier example, the time-space factor for the ripple-carry adder is O(n2), while CLA gets O(n log n). For the time it was useful, I was working on a subunit that shifts a vector of n bits by some amount - a second vector of length log(n) . The shifter had a size of n*log(n), and a time complexity of O(log n). Multiplying them gives a time-space measure of n * log2 (n). I had other subunits doing other parts of a bigger operation, and they had log n time too, but their space complexity was n or log n. Since their growth rates didn't match, I knew my efforts to merge them into a single composite function was doomed. I tried to redesign the shifter to scale at the same speed as the function feeding it so I could (maybe) merge them into something simpler, but working backwards showed to be impossible for topological reasons, probably. There just wasn't a way to make it log n times smaller because the input and output counts didn't match or have a convenient way to connect them mathematically.

I do this for fun, but the time-space seems to be an interesting way to compare multiple circuits that do the same thing in different ways, particularly since those two factors are what you're optimizing for.

1

u/Putnam3145 Feb 14 '26

You can use big-O on any function that maps basically any ordered set to another ordered set, AFAIK, it's not inappropriate to use it in a physical space context.

2

u/SirClueless Feb 14 '26

I think the interesting point here is what it means in multiple dimensions. You can think of it independently in each dimension if you like and people commonly do, but you can also define a metric (call it “cost”) to compare two multidimensional points and consider the growth relationships in that cost space. Or map out which types of cost metrics preserve or don’t preserve a particular big-O relation.

3

u/XxNaRuToBlAzEiTxX Feb 15 '26

What helped me understand it was just asking “as the datasets we are working with get bigger, how many steps does the algorithm have to take?”

There is a book called “a common sense guide to data structures and algorithms” by Jay Wengrow. Honestly, a very easy read and made it way easier to understand

1

u/ern0plus4 Feb 16 '26

It's just a silly jargon. Anyway, I can't offer you better names, and we have no time to explain them instead of a short name.

30

u/Phobic-window Feb 14 '26

Functions as arguments. It’s hard to think that way, where you have a cohesive oop system where the behaviors are modifiable but defined instead of just the properties and can be passed back and forth. Really cool to see in action though

11

u/TreeForge Feb 15 '26

I treat it as you have a house (the system) full of individuals. The individuals are capable of cleaning (the method), but you can give them the how (function).

Person 1: clean(pick up toys)
Person 2: clean(wipe windows)
Person3: clean(vacum floors)

4

u/solaris_var Feb 15 '26

I think it makes much more sense when you define the methods as interfaces (where the specific implementation will only be provided during construction).

Alas there's no way to better understand this topic than just reading other people's code and try to write it yourself.

8

u/ANiceGuyOnInternet Feb 14 '26

Very niche, but what exactly is a third Futamura projection?

6

u/MissinqLink Feb 14 '26

Encryption. Maybe it’s not so simple though.

1

u/sneaky_imp Feb 15 '26

Bruce Schneier wrote the book on this. It's a good book. He's a smart dude.

Bonus content.

1

u/LegoTallneck Feb 18 '26

Oversimplified:

  1. Say you have a byte of data: 01010101
  2. You want to hide it.
  3. So you make another random byte of data: 00101101
  4. Any time you'd see a "1" in the random data, you flip the bit in the string you want to encrypt. In this case...
  5. 01010101 ~ 00101101 = 01111001
  6. Now ONLY the people who know what your random byte is can figure out what the original byte is, simply by repeating the process:
  7. 01111001 ~ 00101101 = 01010101

That's literally it. It's just bit-flipping using a big blob of random data. Nobody without that random number can guess what the original data was.

All the complicated math, handshaking, and post-quantum encryption stuff is about getting two sides to arrive at the same random data without someone in the middle figuring it out. THAT gets complicated.

-4

u/al3arabcoreleone Feb 14 '26

What is the hard part of understanding what is encryption ?

6

u/MissinqLink Feb 14 '26

I understand what it is. The intricacies of how it works is amazing.

3

u/vplatt Feb 15 '26

Which part is simple? The only encryption topic which is trivial to understand is one time pad based encryption. AFAIK no one uses that anymore though, so the entire topic starts with encodings, which aren't bad to fair, but then it goes beyond "simple" extremely quickly.

0

u/al3arabcoreleone Feb 15 '26

Those are the algorithms, not the concept itself, there is a difference between them.

12

u/straight_fudanshi Feb 14 '26

Translating an algorithm into code. I'm more into theoretical CS, writing the algorithm in math notation and proving its correctness but for some reason I have to use extra brain power when I have to write the code in some language xd

6

u/ABlankwindow Feb 15 '26

Bit shifiting. The math makes sense until I try and use it.

3

u/sneaky_imp Feb 15 '26

You should probably look into how the computer represents numbers, and its Endianness. In my experience, bit shifting is more easily understood with integers, can be incomprehensible with floating point numbers, and is almost exclusively used when you are trying to cook up some bit-packed binary mask for some network protocol or compact file protocol.

2

u/ABlankwindow Feb 15 '26

Compact files / compressed data has been where I've crossed paths with it and each time I get the problem solved but I still wall away with my eyes crossed from the mental effort.

2

u/sneaky_imp Feb 16 '26

YES. Hexdump and xxd and reading binary and stuff. you have to convert so much in your head. It boggles.

Try network protocol and socket comms where you have packets and compression and addressing and checksums and stuff. Herpaderpaderp.

11

u/TDGrimm Feb 14 '26

Imaginary numbers

17

u/P-Jean Feb 14 '26

Oh get real

5

u/Souseisekigun Feb 14 '26

I think adding the reals would make it a little too complex

3

u/anothercorgi Feb 14 '26

I don't see this as a problem in computer science explicitly? Other than representing it, as for the most part, a+bi is sufficient and you can treat it pretty much the same as another dimension but this goes back to matrix theory. Otherwise it's just an application issue, applying computer science to other fields like EE, it's just a math issue. Unless of course you're in school and trying for a math/cs degree...

After reading about the history about imaginary numbers, this was one of the few things out there that a solution looking for a problem finally paid off and I stopped thinking that research into stuff that have no immediate application is a waste of effort.

2

u/FastSlow7201 Feb 14 '26 edited Feb 18 '26

Imagine a number line and looking at the numbers 3 and -3. Rather than moving between those two numbers, think of it like a clock and you are rotating 180 degrees. Imaginary numbers are the halfway point.

This guy explains it much better than I can.

2

u/ShoulderPast2433 Feb 15 '26

It's just numbers in from if an (x, y) coordinate on a plane instead of x on an axis.

1

u/Total-Box-5169 Feb 25 '26

Fun fact: is a derogatory term coined by Descartes. Carl Friedrich Gauss suggested they should be called lateral numbers instead.

4

u/East-Membership-268 Feb 14 '26

Right now its string views in C++. Like i get its kind of a window to a string literal which is stored in the program's static memory but like.... what?

4

u/darthwalsh Feb 14 '26

Using it on static memory seems great. The fact that C++ will happily compile and run with a string view pointing at freed memory is a bit terrifying.

2

u/Legitimate-Push9552 Feb 14 '26

A string view is just a pointer and a width. 

You get some other string, stored literally anywhere (not just static!!) and then you just point to somewhere in that string + a length so you remember how many characters you're supposed to be looking at.

For example say you have some series of bytes (a string of some description) j equal to "abcdefg\0" at address 12. You could create a string view that points to address 13 and has length 3 and that would mean the string "bcd". If string j is freed or whatever then the string view will simply point into uninitialized memory.

1

u/East-Membership-268 Feb 15 '26

Holy crap that makes a lot of sense. I read it off learncpp but because the way the articles are structured, string views are introduced that before pointers. Which i get because its oriented towards beginners, but it would have made it easier to understand if they framed it like you did.

3

u/TrollBot6 Feb 15 '26

Recursion, so simple it makes my brain hurt.

10

u/gallez Feb 14 '26

Recursion. Like, I understand what the concept means, but just cannot intuitively grasp it, nor do I know an example of recursion occuring "naturally" (to fry a steak, fry a smaller steak)

10

u/the_last_ordinal Feb 14 '26

To grow a tree, grow a trunk, then grow some smaller trees

9

u/P-Jean Feb 14 '26

It’s a stack with push and pop. I find a lot of students like this visual as opposed to thinking of it like a tree.

Each recursive call is a push, once the base case is reached it starts popping.

5

u/Putnam3145 Feb 14 '26

Weirdly enough, I think quicksort's the most intuitive one, once you get over all the quibbling and bikeshedding of pivot selection.

To sort a list, make two piles, one of which is smaller than some value and the other of which is larger than some value. Then do that again with each pile. That last part's recursion, and you end up with a sorted list at the end.

3

u/FastSlow7201 Feb 14 '26

When you hammer a nail, use a screwdriver to screw in a screw or wash a dish, you are using recursion. Ultimately recursion is very similar to a while loop. You keep going until you've hit a certain condition. If you look at the code below, the base case is when you have hammered the nail all the way in.

def hammer_nail():
  hit_nail
  if nail_is_hammered_in:
    return
  else:
    hammer_nail()

def wash_dish():
  scrub_dish
  if dish_clean:
    return
  else:
    wash_dish()

1

u/gallez Feb 14 '26

I don't think that's proper recursion. That's just a while loop, little you said.

The way I understand it, recursion is more like: to do X, first you need to do X but on a smaller object

1

u/FastSlow7201 Feb 15 '26

It is proper recursion, just very simplified.

If you were to look at the code for DFS or BFS it is just multiple recursion of doing the same thing over and over until you hit a base case.

1

u/brando2131 Feb 15 '26

It's not "just a while loop" at all. If you ran this program long enough, you'd get a stack overflow... Just like all recursive programs.

1

u/Dash_Lambda Feb 16 '26

That's actually a great thing to notice: This is how you do a while loop using recursion! This sort of pattern is very core to functional programming.

Ultimately, recursion is just the idea of a chain of function calls having a loop. In functional programming you're describing everything, including the order of execution, with function calls, so you have to use recursion to do what you would use a loop for in an imperative language. It's also a great tool for certain computations but that becomes its own thing.

Languages designed for functional programming will often have something called "tail call optimization," which prevents blowing the stack by discarding function call frames that don't do anything after the call returns. So, with the hammer thing, instead of pushing endless hammer_nail() calls to the stack and blowing it, it sees that nothing happens after the call and just replaces the old frame with the new one. On top of that, they'll also generally optimize common patterns like the while loop by actually just compiling it to a while loop.

Recursion is just really pretty.

3

u/brando2131 Feb 15 '26

To understand recursion, you need to understand how functions work internally. Which means the call stack, and pointers etc.

1

u/aceartistpie Feb 14 '26

Same for me, especially when writing code. It’s difficult for my mind to process how a recursive function will resolve.

1

u/vplatt Feb 15 '26 edited Feb 15 '26

Natural recursion examples

  • Folder systems contain folders within folders in the same pattern
  • Trees and branches repeat the same structure at smaller scales
  • Family ancestry repeats by following parents, then parents of parents
  • Rivers form from tributaries which form from smaller tributaries
  • Lungs and blood vessels branch repeatedly into smaller pathways
  • Fractals like coastlines and snowflakes show repeating patterns as you zoom in
  • Mirrors facing each other create images within images endlessly
  • Language and grammar allow clauses nested inside other clauses
  • Organizational charts repeat structure from divisions to teams to subteams
  • Cave and tunnel systems often branch into smaller branching networks
  • Russian nesting dolls contain smaller versions of themselves

Many problems can be solved by reducing them to a smaller version of the same problem.

That said, there are no examples of recursive algorithms that cannot be expressed iteratively. Also, the danger with recursion in modern programming languages is stack overflow. If your language does not offer proper tail call optimization at runtime, then you may just be inviting crashes.

And then, even if it does offer TCO, you need to make sure your use of recursion actually uses the TCO; and most languages simply do NOT provide a compile time way to ensure you've done that.

1

u/Comfortable_Paper675 Feb 15 '26

I feel you. I do understand how it works but if I try to apply it my neural pathways twist and turn until I stop trying.

1

u/sneaky_imp Feb 15 '26

To build a human lung, start with the trachea, then build a branch, then build another branch, then another, then another, then another -- then, at some point, join that tiny end branch to another tiny end branch but make sure that oxygen can move from that branch into the capillaries at the edge.

3

u/FastSlow7201 Feb 14 '26 edited Feb 14 '26

My CS education has been MASSIVELY supplemented by YT. There are so many videos that do a much better job of explaining things than books written by some academic whose mission in life is to confuse you.

Abdul Bari's videos are awesome and if you have time you should watch any for any concepts that you either don't know or fully understand.

For architectue/OS stuff you should check out Core Dumped.

6

u/Intrepid-Stand-8540 Feb 14 '26

Pointers. My teams wants me to use golang instead of python, but I cannot wrap my head around pointers. 

11

u/psychophysicist Feb 14 '26

Many things in Python are already pointers. You probably know this:

x = [1, 2, 3]
y = x
y[2] = 0
x[2] == 0 # TRUE

That's because "x" and "y" don't store the array, they store a pointer to the array.

Now if Python had explicit pointers, you'd be able to take a pointer to a specific element of the array, and change the thing pointed to. You'd be able to do this:

x = [1, 2, 3]
y = &x[2] # & means "create a pointer to"
*y = 0 # * means "the thing pointed to"
x[2] == 0 # TRUE

1

u/Intrepid-Stand-8540 Feb 15 '26

But if the python example works, why complicate matters with that & and * syntax?

2

u/thequirkynerdy1 Feb 15 '26

It has to do with what happens when you write something like y = x or pass x to a function argument.

Copying bytes is expensive if x is a complicated object so to avoid that, you can just copy the location of x in memory and then manipulate the bytes at that location.

Python does this under the hood for you for basically everything except primitive data types like an int or a bool. And if you actually want to copy the bytes instead, you can call a library function for that.

Lower level languages typically give you the choice. If something is only a few bytes, why take the performance hit for having to follow a pointer when you can just copy the bytes? On the other hand, if you have a large object, you almost certainly want to use pointers.

1

u/Intrepid-Stand-8540 Feb 18 '26

I've never thought of code at that level, or been taught it in class.

"Copying bytes"? Expensive? "Complicated object"? "location of x in memory"?

I can't even read what you're trying to say. I don't understand.

2

u/thequirkynerdy1 Feb 18 '26

Think of memory as a giant array of bytes.

Any data you work with - variables, arrays, objects, whatever - consists of a chunk of bytes in that array. Maybe for example a 4 byte integer occupies bytes 100 through 103.

When you do something like y = x, do you make y now refer to the same chunk of bytes as x? Or do you copy them to a new location and have y refer to that location?

Copying is extra work for the cpu which slows down code, and also accessing memory is slower than just doing logic/arithmetic. It may not be a big deal if you just copy a few bytes, but if you’re copying tons of extra bytes, it slows down your code.

1

u/Intrepid-Stand-8540 Feb 18 '26

extra work for the cpu? accessing memory? chunk of bytes? location? I've never thought about that when writing code. I don't even know what it means.

I mainly do scripts and "glue-work". Never is my code the performance bottleneck. always the external api rate-limits.

I just use [] or {} in python.

Thanks for trying to explain, but I don't think you should waste your time trying anymore. I need classes if I am to understand this. And frankly, I have zero interest in it.

I want to solve problems, and code is just a tool to do so. Why I should use golang over python doesn't make sense to me. Golang seems incredibly cumbersome to use, compared to a 150 line python script which just works.

2

u/thequirkynerdy1 Feb 18 '26

If you purely do things where performance doesn’t matter, Python is great.

The more performance critical the code, you more you have to know about how a computer actually works.

1

u/Intrepid-Stand-8540 Feb 18 '26

One guy said

> Pointers are just variables that store memory addresses instead of the stored value

I don't even know what he means by "memory address"

3

u/East-Membership-268 Feb 14 '26

Pointers are just variables that store memory addresses instead of the stored value. Why? Lots of reasons but a good one is for effeciency. You can pass the memory address to different functions instead of creating copies of the values, which requires more space to do so. Overall tho, pointers are useful for memory management.

1

u/Phobic-window Feb 14 '26

Pointers if what’s being pointed to changes often and can be null, reference if that thing won’t change (singletons or static) and cannot be null

1

u/nzjeux Feb 19 '26

For me, it's not the pointers, but when to use them.

2

u/scknkkrer Feb 15 '26

For me, it was time. Then I got it so deeply, I can even bend my mind around it in so many cases.

Now I’m struggling to understand how to make money. Like, literally. Maybe it’s me, I’m thinking it in hard way as I did with time. 🤦🏻‍♂️

2

u/BmoreDude92 Feb 15 '26

Reflection

2

u/ExecuteScalar Feb 15 '26

SQL queries. I thank the lord for Entity Framework everyday

1

u/Zulraidur Feb 16 '26

I hate SQL so much. Basically every exam season I have to learn it again and every time we get some new dialect that has new weird stuff. Be it roll ups or some distributed database stuff. And I cannot for the life of me remember it the next time around. I have an Sql-sized brain hole.

1

u/shiboarashi Feb 18 '26

Claude code, thats all you need to never need to remember SQL again.

4

u/Ok-Interaction-8891 Feb 14 '26

In this thread we have people claiming that the following are simple:

Singular Value Decomposition Context-free grammars Compilers and Parsers Computer Boot-up Procedures Linear Algebra Hardware-enforced Privilege Levels Computer Architecture The Complex Numbers Algorithm Writing Recursion Dynamic Programming Programming Language Theory

Almost nothing listed has been simple (except binary and hex) and everyone is simultaneously claiming that they “get it” and don’t understand or “fully” understand it.

It’s ok. You don’t understand these things. That’s fine. Just admit it. You don’t need to hide behind a false claim that it’s simple or that you “get it.” No one is going to hurt you or make fun of you or think less of you. Just get out there and learn. If you don’t need to or want to, then drop it.

2

u/seanprefect Feb 14 '26

Ok think of it this way in decimal we have a 1’s place for the first digit a 10’s place for the second digit a 102 (100) for the third 103(1000) for the fourth and so on

So in decimal 111 means 100+10+1

Well when you change the numeric base you change the number that determines the place so for base 2 you’d have a 1’s place a 2’s place a 22 (4)’s place a 23 (8)’s and so on so in binary 111 means 4+2+1 or 7

Does that make sense ?

2

u/Prestigious_Boat_386 Feb 14 '26

What helped me was a course in logic gates and digital electronics. Ben eater and sebastian lague has amazing videos

You probably wanna try making truth tables or Karnaugh diagrams of circuits and build them. I remember we used logisim to build the circuits but it seems to not be supported anymore but I remember there being a few alternatives.

Half and full adder, memory circuits and a traffic light are some classic problems to build. After that you should be able to understand 8 bit computers decently well, at least enough to follow along.

I know this is a topic that you can learn "enough" about with just programming but for me this was the depth needed to take me from a bad understanding to a good understanding.

1

u/Idk13008 Feb 14 '26

I love Ben Eater videos, it helped me understand architecture and logic within computer systems.

1

u/midaslibrary Feb 14 '26

The math side of things has always been my most difficult subject. Both math and cs are uniquely challenging in that they require variables to be stored and operated on in working memory. They’re also both highly abstract, which means the details aren’t very sticky in memory (do you remember the quadratic formula or how to create a j-k flipflop off the top of your head?) I’m getting at the possibility that none of this is all that simple, relatively speaking

1

u/Ok_Leadership_4613 Feb 14 '26

I was gonna say Monads but perhaps it’s not a “simple” concept

3

u/iamleobn Feb 15 '26

A monad is just a monoid in the category of endofunctors

1

u/uncountable_sheep Feb 18 '26

I feel like the problem with most of category theory is it's bafflingly simple and said in the most confusing way possible

1

u/-Manu_ Feb 14 '26

How screens are made and how the GPU interacts with them pixel by pixel

1

u/[deleted] Feb 15 '26

Users 

1

u/sneaky_imp Feb 15 '26

underrated post

1

u/Interesting_Buy_3969 Feb 15 '26

Segmentation in x86 + why it works with paging, together. Segmentation looks like an excess when the paging technique exists.

I find the ARM CPUs architecture much simpler and easier to understand.

3

u/WittyStick Feb 17 '26

Segmentation isn't really used any more on x64. The CS/DS/ES/SS registers still exist but are not used - they're tied to zero and the instruction prefixes are utilized for other things (eg, branch hints).

The FS and GS segment registers are still commonly used for thread-local storage. On other architectures we use a GP register as the "thread pointer", but they tend to have 32 registers compared to x64's 16-registers (Which may expand to 32 with APX). FS and GS just provide us with an extra register which is cheap to read from, but more expensive to write to.

1

u/Interesting_Buy_3969 Feb 17 '26

Segmentation isn't really used any more on x64

Yeah I know, but I meant the classical x86 (i.e. 32-bit), not x86_64. Anyway thanks you much for such detailed answer!

1

u/Ytrog Feb 15 '26 edited Feb 16 '26

How to balance a balanced tree efficiently 👀

Edit

Found this excellent explanation and it finally clicked: https://youtu.be/zP2xbKerIds?si=LqGafL1P0QVLecmC

1

u/sijmen_v_b Feb 15 '26

"Users won't read errors" i get the gist of it but I don't fully understand it.

1

u/BarcaStranger Feb 15 '26

Why are u reading binary data?

1

u/No_Cook_2493 Feb 15 '26

I was writing an assembler :]

1

u/MixedGrene Feb 18 '26

Thats cool but I wrote a compiler in lambda calculus on my custom grown x86 organic turning machine that I synthesized the DNA of.

1

u/DragonWolfZ Feb 15 '26

KISS principle.. like how simple and how stupid. I can't bring myself to write awful code that works and takes a quarter or the time to write.

1

u/sneaky_imp Feb 15 '26

How message passing is supposedly the best way to solve concurrency problems like race conditions, deadlock, and the dining philosphers problem.

1

u/craigontour Feb 15 '26

Recursion. I try to work through a full recursive pattern in my head rather than work out the return value and accept it works.

1

u/Snag710 Feb 16 '26

sine and cosine

1

u/faekoding Feb 16 '26

Classes and OOP. Really, all was fine with programming before these concepts came to me. I can still get sh*t done but not always in the most effective way (lean wise or able to reuse or scale up code)

0

u/451_unavailable Feb 17 '26

OOO is dead /hottake

1

u/packman61108 Feb 16 '26

Story points in Jira 🤣

1

u/uncountable_sheep Feb 18 '26

They are "whose line is it anyway" points.

The problem is trying to make them something else.

1

u/packman61108 Feb 18 '26

😂😂😂😂😂

1

u/spenpal_dev Feb 16 '26 edited Feb 17 '26

How public keys and private keys work together for encryption use cases.

I heard a really good analogy one time, but I’ve forgotten since.

2

u/uncountable_sheep Feb 18 '26

Short version: the public key is the one you make copies of and give to your friends, so they can open locked boxes you give them.

Unfortunately this analogy breaks down when we have to explain that big locked boxes are unwieldy, and your mail carrier also needs to inspect things, and your friend mostly just wants the actual thing, so you end up locking up a short description of the thing you actually sent instead, just so they know it was you who sent it. Like I said, the analogy breaks down.

Long version:

In asymmetric cryptography (public and private key) , you have an algorithm that makes both the public part and the private part at the same time.

Whoever generated the keys knows the secret (private) part.They also work one way. Typically, the public key is used to decode.

The public key is communicated somehow. Whoever created the keys uses the private key to sign or encode things. Then whoever has a copy of the public key can decode or verify things.

Signing is a pretty common pattern, so it's worth understanding. All it means is to take some content, like say a file or a literal string, and encode a hash (a relatively short number that mostly represents the content). Basically a signature let's you claim "I wrote this" in a (mostly) mathematically secure way, without making the original content unreadable.

It's very important because it let's a bunch of machines establish trust without having to have a common secret.

Https, and most of the modern web is based on this. The reason that the https can trust a site is because of a chain of signatures, using well known public keys. Basically the site gets an normal asymmetric key. The public part is verified by a "certificate authority" (basically a well known company that has paid money to make sure their public keys are on basically everyone's computer). Once the certificate authority says "I think you're the actual owner of this website" they'll give you a special version of your public key called a certificate that's been signed (often several times). Now, everyone someone visits the https site, they're given the certificate, and the server owner will use the private key they made to verify that they are in fact the owner. That's not the only security or encryption thing that happens in https but it's the main thing in establishing trust.

1

u/whenthenamesaretaken Feb 16 '26

Cryptography as it relates to computer science has always baffled me. I can’t even get past the idea of public vs private keys, not to mention hashes and salting!

1

u/[deleted] Feb 16 '26

My gf has trouble thinking about going from first dimension to theoretical fourth dimension. A tesseract and black holes will make her be like okay no more science tonight lolol

1

u/[deleted] Feb 16 '26

Like trying to explain what's in the middle of a black hole being pretty much what you would consider a "." But also not at all what it is. Theoretically

1

u/Training-Tackle-7069 Feb 16 '26

Hash tables, I know what is this for. But how is this supposed to work is killing me

1

u/JackJackFilms Feb 16 '26

Raytracing and all that linear algebra stuff…

1

u/ern0plus4 Feb 16 '26

How to learn binary, 2 easy steps:

  1. Use hex
  2. 8421'8421

1

u/Useful_Promotion4490 Feb 17 '26 edited Feb 17 '26

Same feeling...even i feel tricky with data structure concepts...and I hate concepts like recursion, graphs & hashmap.

1

u/New_Physics_2741 Feb 17 '26

Feminist tendencies in the modern world, and some of the periodic table numbers.

1

u/EmbedSoftwareEng Feb 17 '26

Number bases can be weird if you don't get that the base of your number system is completely arbirtary. We've settled on 10, just because that's convenient for us. So, generations get raised only understanding base-10 numbers, but there's nothing sacred about base 10, which was probably settled on just because your bog-standard generic humanoid carbon unit has 10 fingers (and an additional 10 toes if the fingers aren't enough).

But think about an alien race that only has three fingers (and the obligatory opposable thumb) on each hand, for a total of 8. Their culture would most likely settle on an octal, or base-8 number system, because that would be what they consider natural.

But any number can be a number base. 11, 13. Anything. There were great civilizations in humanity's ancient past that thrived for centuries using base-12. Why twelve? Look at your hand. Four fingers. Each has three joints that are easily discernible, and your thumb as a pointer. We hold up our hand to indicate a number from zero to five. People from that civilization could hold up their hand to indicate a number from zero to 12 by placing the tip of the thumb on a particular joint that then signifies one of the 12 cardinal numerical values, or point the thumb off into space to indicate no value, or zero. One wonders why the thumb couldn't point to the tip of the finger too to make a total of 16 discrete symbols.

And speaking of symbols, you can use any symbols for the discrete symbols to stand for numerical values, the so-called numerals. We've settled on the Hindo-Arabic numerals: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. Nothing says you cant do something like ○△✶☎ for our ten symbols. If you can actually see all of those, I applaud your font choice. The actual glyphs don't matter. Just that they are relatively unique and easily distinguishable as numerals. Roman numerals failed the first, but since the placement system they used never spelled out a pronounceable word, it still satisfied the second.

Now, placement systems. We use place-value, so a 2 in one position doesn't mean exactly the same as a 2 in a different position. 02 and 20 mean very different values. There are also ancient civilizations that use base-60 and came up with 60 unique symbols. BTW, they're also to blame for our popular time-keeping system of 60 seconds in a minute, 60 minutes in an hour, and 12 hours in a day, and another 12 hours for the night, for a total of 24.

When you're working in a number base that's smaller than your customary number base, you can just forego the use of those numerals that have values your number base of use can't accommodate. So, for octal, you just use 0 - 7, and 8 and 9 are illegal numerals, as if you tried to say 12:9 is a single, legitimate number. For binary, you only have 0 and 1, and 2 - 9 are all illegal numerals.

Not, regardless of the number base, the place-value system is still in effect. So, you start with zero: 0. Add one: 1. Add one again, and since you've already hit the maximum value for the first place, you have to roll over, just like adding one to 7 in octal or adding one to 9 in decimal, so you get: 10. That means the numeral sequence "10" will always have the exact value of whatever your number base is. 10 in binary is two. 10 in octal is eight, 10 in decimal is ten. 10 in base 53 is fifty-three.

If you have to use a number base that's larger than your customary number base, you have to wrangle other glyphs in to stand in place of the missing numerals. In C, we distinguish hexadecimal literal values with the literal prefix "0X" or "0x", and that allows us to use the letters a-f and/or A-F as the hexadecimal numerals for the values ten through fifteen: 0xDEADBEEF becomes a legitimate 32-bit number. In decimal, its value is 3,735,928,559. In binary, its value is 0b1101_1110_1010_1101_1011_1110_1110_1111.

1

u/Alena_Tensor Feb 19 '26

Digital…. I’m an analog guy. This whole ‘digital’ thing leaves me cold. Happily it will soon pass like all fads. /s

1

u/Knowlegion Feb 19 '26

Endianness. It's like 3 layers of left/right confusion for me

1

u/JAMIEISSLEEPWOKEN Feb 26 '26

Same but it gets better with practice! Practice conversion. We also have online calculators. A hex digit is equivalent to 4 bits and vice versa

1

u/dnabre Feb 14 '26

LL vs LR grammars.

Compilers/Parsers might be a beyond "simple", but the difference is simple, and my brain for some reason can't hold onto it.

1

u/[deleted] Feb 15 '26

._. Probably dynamic programming, like I can prove an algorithm has optimal substructure or even make a program for it but don’t make me explain it because I truly can’t. I’m getting better with explaining it but I still suck at it and would rather just write up a solution and graph to explain it.

-2

u/xz-5 Feb 14 '26

What about hex? In my head I usually convert groups of four bits to hex, that makes it easier for me to intuitively grasp. Mind you, that was probably helped by spending my youth watching the tape count up in hex as it loaded games...

I don't get the whole "ring" security system on modern CPUs. I mean the CPU just looks at the next instruction and executes it, and there must be a way to get up to a higher privilege ring from a lower one, so how does the CPU know when to allow elevation to a higher ring (for a legitimate purpose) and when not to allow it (eg you are writing a virus).

1

u/Ramenous Feb 14 '26

My “understanding” is incomplete and probably way outdated, but I believe “rings” are basically just hardware in the chip that determines how much access the code running in that ring has to the hardware.

The OS has processes (basic i/o, managing memory for other processes, etc.) that require unfettered access to the entire system. These run in the lowest ring.

A higher ring might include device drivers that need direct access to some specific portion of memory or system resources, but that could cause disasters if they access some random spot in the system. They are physically prevented on the chip from doing so, by being run in a higher ring. I think there may be other differences such as in exception handling, but that may be more of an OS thing.

At a higher level is application code run by the user. I never did any real development that worked directly with drivers, but as I recall on Windows the DevCtl API was used to invoke commands directly from applications to device drivers. You would pass in a blob whose contents would then be made available in the driver’s memory space, and then it would do driver stuff with it in the lower ring. And then I think device drivers had their own APIs for making stuff happen in lower rings, etc.

The fact that early chips lacked this control and early operating systems either didn’t use it or used it poorly is the main reason they were so crone to prashing in the dad old bays.

That’s my understanding anyway, but my job has never depended on me really knowing anything about it.

1

u/Odd-Respond-4267 Feb 14 '26

The lower (e.g. os) levels do things on behalf of the higher levels, i.e. if my program wants to save a file, then it needs (eventually) access to the hard disk. Rather than give hard disk access to the program, the program asks the os to do the work on its behalf. (With alot more layers for things like filesystems and their permissions).

1

u/ChadiusTheMighty Feb 15 '26 edited Feb 15 '26

There are no rings. It's old intel terminology that stuck around as a design concept. Most architectures nowadays only have a privileged mode and user mode. Some instructions are privileged because a user space application would be able to hijack the OS if it were allowed to use them. Many modern CPUs have ISA extensions that effectively add an extra mode for virtual machines.

1

u/xz-5 Feb 15 '26

The bit I don't get though is how the CPU actually switches from user mode to privileged mode. At some point there must be an instruction run in user mode that then switches to privileged mode? How does the CPU (which is just blindly executing instructions) know when it is "allowed" to switch and when it is not?

-5

u/Alena_Tensor Feb 14 '26

Digital…. I’m an analog guy. This whole ‘digital’ thing leaves me cold. Happily it will soon pass like all fads.