r/compsci • • 23d ago

“Modern” Intro Books

16 Upvotes

I am currently reading Complexity: A Guided Tour by Melanie Mitchell and since it was published in 2009, I am wondering if there are more “modern”/“up-to-date” intro books.


r/compsci • • 28d ago

Systems programming

46 Upvotes

So I am in 2nd year of college and after exploring here and there and there, I am genuinely interested in systems programming, I know c, ofcourse I will learn it deeply but what do I learn after it

The whole thing feels very overwhelming,

What shall be the flow of learning


r/compsci • • 28d ago

Compiler-checked manual free vs Rust's ownership model, which would you pick?

6 Upvotes

Been thinking about memory management in languages without a GC, and there's an approach I hadn't really seen before that I'm curious how people feel about compared to Rust.

In this model you can allocate objects as much as you like, pass objects around and put them in collections, all without lifetimes or moves. Nothing is ever freed automatically, not even at end of the scope. If you want the memory back you write free obj; yourself, and the compiler has to prove nobody else can still see it. If it can't prove that, it won't compile. Same for use after free and double free.

The Ironwood language does it this way. It's compiled with a closed-world link, so the compiler sees the whole program when it checks those frees. There's also defer free x; for cleanup on exceptions. If you just never call free, the memory stays allocated and you get a warning. Fine for a CLI tool, not so fine for a server.

The appeal is that you only have to prove anything at the point where you free. The rest of the code doesn't care. The downside is you have to remember to free.

Rust gets you automatic drops and a stronger guarantee overall, but you're thinking about ownership on every line, which at least for me is counter-productive.

Which memory management approach would you rather work with? And why?

```java // Ironwood: does NOT compile

public class Garage {

private static class Engine {

    void start() {
        System.out.println("Vroom!");
    }
}

private static class Car {

    private final Engine engine;

    Car(Engine engine) {
        this.engine = engine; // the car keeps a reference to the engine
    }

    void drive() {
        engine.start();
    }
}

public static void main(String[] args) {

    Engine engine = new Engine();
    Car car = new Car(engine);

    // Compiler error: the car still holds a reference to the engine,
    // so freeing it here would leave car.engine dangling.
    //
    //   error: cannot free 'engine': allocation is still borrowed by a live wrapper
    //
    // Fix: free the car first, then the engine.
    free engine;

    car.drive(); // would use a freed engine
    free car;
}

} ```

```rust // Rust: does NOT compile

struct Engine;

impl Engine { fn start(&self) { println!("Vroom!"); } }

// The car keeps a reference to the engine, so it needs a lifetime parameter. struct Car<'a> { engine: &'a Engine, }

impl<'a> Car<'a> { fn drive(&self) { self.engine.start(); } }

fn main() { let engine = Engine; let car = Car { engine: &engine };

// Compiler error: the car still borrows the engine,
// so dropping it here would leave car.engine dangling.
//
//   error[E0505]: cannot move out of `engine` because it is borrowed
//
// Fix: remove the drop and let both go out of scope
// (car is dropped before engine automatically).
drop(engine);

car.drive(); // would use a dropped engine

} ```


r/compsci • • Sep 21 '26

Understanding the Computer from the foundation to the physical

96 Upvotes

Has somebody ever understood or is educated enough to understand a computer from top to bottom. Meaning knowing a deep undergraduate level knowledge of math & physics -> computer science -> electrical engineering/computer engineering as if having all 4 degrees. If someone is knowledgeable in this or tried to study something similar like this, what is your experience? Will this knowledge help you become more skilled? What will you gain from studying this?


r/compsci • • Sep 21 '26

Back to Coupling and Cohesion

Thumbnail bastrich.tech
0 Upvotes

r/compsci • • Sep 21 '26

Does this already exist?

Thumbnail
0 Upvotes

r/compsci • • Sep 17 '26

What are some uncommon data types and file formats that might benefit from a dedicated compression algorithm?

22 Upvotes

Hi! Im considering a masters thesis about compression of large amounts of data for long-term archival. But instead of trying to revolutionize all of compression, i want to focus on a few, narrow domains, which are however still useful to people.


r/compsci • • Sep 17 '26

A distributed bulkhead: what can a shared concurrency limit actually guarantee?

Thumbnail blog.gaborkoos.com
0 Upvotes

r/compsci • • Sep 16 '26

What is this sorting method called?

35 Upvotes

We all know Bubble Sort. Well I used to do a thing to pass the time on deployment where I would bubble sort a shuffled deck of cards, but I often played around with it.

One time I thought to make bubble sort more efficient by, rather than returning to the start of the list after a successful pair, continue forward to the next wrong pair and sort those, and so on until I reach the end of the list. Then turn around and do the opposite, from the opposite direction. Repeat until sorted. So what you have is a reflecting wave of bubble sort that travels persistently back and forth through the entire list without skipping anything until it's all sorted.

I'm certain this has a name but I wouldnt know the first thing about how to find it. Does anybody know?

EDIT: solved! Cocktail Shaker Sort


r/compsci • • Sep 15 '26

Why I have trouble with Cantor's diagonal argument.

0 Upvotes

Cantor's diagonal argument starts with a pair of infinite sets s_n and T, where s_n is an enumeration each element of elements from T, and the elements of T is defined to be natural number. Then he shows that an element s_n of T can be constructed that doesn't correspond to any s_n in the enumeration. This is accomplished by bit flipping the n-th bit of the n-th element of digits in T. Thus s is a member of T that differs from each existing s_n because the n-th digits differ.

  • s_1 = (0, 0, 0, 0, 0, 0, 0, ...)
  • s_2 = (1, 1, 1, 1, 1, 1, 1, ...)
  • s_3 = (0, 1, 0, 1, 0, 1, 0, ...)
  • s_4 = (1, 0, 1, 0, 1, 0, 1, ...)
  • s_5 = (1, 1, 0, 1, 0, 1, 1, ...)
  • s_6 = (0, 0, 1, 1, 0, 1, 1, ...)
  • s_7 = (1, 0, 0, 0, 1, 0, 0, ...)
  • ...
  • s_n = (1, 0, 1, 1, 1, 0, 1, ...)

Let's assume s_n corresponds to the set of all natural numbers. But that's a problem since natural numbers, in spite of being a (presumed) countably infinite set, are defined such that every natural number has finitely many digits. Yet a member of the set T, in Cantor's construction, is allowed to extend to an infinite number of digits, because the set s_n is infinite. To show this I'll define what I'll call bin-adic numbers, in honor of p-adic numbers. Essentially just an inverted binary representation of base10 numbers.

  • Binary:
  • s_1 = (..., 0, 0, 0, 1)
  • s_2 = (..., 0, 0, 1, 0)
  • s_3 = (..., 0, 0, 1, 1)
  • s_4 = (..., 0, 1, 0, 0)
  • s_5 = (..., 0, 1, 0, 1)
  • s_6 = (..., 0, 1, 1, 0)
  • s_7 = (..., 0, 1, 1, 1)

  • Bin-adic: Where (...) consists only of a series of zeros of arbitrary length.

  • s_1 = (1, 0, 0, 0, ...)

  • s_2 = (0, 1, 0, 0, ...)

  • s_3 = (1, 1, 0, 0, ...)

  • s_4 = (0, 0, 1, 0, ...)

  • s_5 = (1, 0, 1, 0, ...)

  • s_6 = (0, 1, 1, 0, ...)

  • s_7 = (1, 1, 1, 0, ...)

Let the natural number have only finitely many digits, per standard definition. Then the natural numbers map one-to-one to the bin-adic numbers where the last 1 bit is, by definition, limited to a finite distance from the first bit. In fact the bin-adic numbers don't just map one-to-one to the natural numbers, they uniquely define the natural number that maps to it without reference to the index set s_n. Which I call well-ordering with identity. If the number of bits in any element is infinite, as Cantor has posited for the set T, then this unique mapping continues well beyond a finite distance from the first bit. Any bit set with all 1 bits a finite distance from the first bit in the element is by definition a natural number, limited to a finite number of digits. Any element of T that contains a 1 bit greater than a finite distance from the first bit is an integer with transfinite digits, hence not a natural number. Because the natural numbers are, by definition, those numbers where the 1s are limited to a finite distance from the first bit.

Here's the problem. Cantor assumed that for every infinite index s_n he could operate on a unique digit of T. But the digits of T are by definition finite. Hence, he must run out of digits in T before he exhausts the set s_n. His constructive new number must then terminate prior to reaching exhausting the s_n index. Leaving plenty members of the set of natural numbers he never operated on. By randomizing his natural number set he could obfuscate the assumption that the number of digits in a natural number equals the number of elements on the index of that set. The premise then concluded itself.

If the number of digits in a natural number are by definition finite, then that digit count cannot equal the index count of natural numbers. Because that would require a natural number with infinite digits, thus (by definition) cannot be a natural number. Any iteration over any given natural number must, by definition, terminate before exhausting the index set.

This implies to me that the set of all natural numbers are uncountably infinite. Because you cannot exhaust the index set before running out of digits in any given natural number to operate on Cantor style. If they are equal (one-to-one) then by definition they cannot be natural numbers to begin with. A natural number does not have infinite digits, by definition. Obscuring the digit count of an element in a set by randomization, and assuming the index count and the digit count of an element in the set maps one-to-one, merely assumes the premise proves itself.


r/compsci • • Sep 13 '26

What do you think about system programming in the future?

11 Upvotes

About a year ago, I started learning systems programming because I enjoy working close to the hardware and understanding how computers actually work. Recently, though, I've been spending most of my time solving LeetCode problems to strengthen my problem-solving skills before getting back to larger projects.

With AI improving so quickly, I've seen a lot of discussions about software engineering jobs changing or even being replaced. Most of those conversations focus on web development or general application programming, but I rarely see anyone talk about systems programming.

How do you think AI will affect this field over the next 10 to 20 years? Do you expect systems programmers to become more productive with AI tools, or do you think the demand for low-level developers will decrease? I'm especially interested in areas like operating systems, compilers, embedded software, and performance-critical software.

I'd like to hear the opinions of people who already work in these areas.


r/compsci • • Sep 14 '26

Beyond Solver Verdicts: Generative Reward Models for Autoformalizations

Thumbnail arxiv.org
3 Upvotes

r/compsci • • Sep 13 '26

AI incidents are starting to look less like isolated bugs, and more like subcritical chain reactions [N]

Thumbnail
0 Upvotes

r/compsci • • Sep 13 '26

The way my apartment complex handles packages stinks

Thumbnail
0 Upvotes

r/compsci • • Sep 10 '26

How much of Minesweeper is pure deduction vs forced guessing? Measured with a constraint solver over ~32k boards

13 Upvotes

Minesweeper's consistency problem is NP-complete (Kaye, 2000), but a more practical question is measurable: for a randomly generated board, how often is the game fully determined by logic, versus how often does it reach a state where no cell can be proven safe and you're forced into a probabilistic guess?

I implemented a solver to measure it, in two phases:

  • Deduction: treat each revealed number as a constraint on its hidden neighbours and propagate every forced conclusion (a cell is provably safe/mine iff all consistent configurations agree).
  • Probability: when propagation stalls, enumerate the mine configurations consistent with the frontier (the counting step — #P-flavoured in general) to get each hidden cell's exact mine probability, then take the minimum.

Run over tens of thousands of first-click-safe boards:

Difficulty Mine density No-guess solvable Solver win rate
Beginner (9x9, 10) 12.3% 80.6% 96.1%
Intermediate (16x16, 40) 15.6% 53.2% 85.0%
Expert (30x16, 99) 20.6% 3.9% 34.9%

So ~96% of Expert boards force at least one guess, and even playing the minimum-probability cell every time caps Expert wins near 35% — a few independent forced guesses is enough to lose on probability alone.

Two things I found worth discussing:

  • The cliff from 80.6% (Beginner) to 3.9% (Expert) comes from fairly small density changes — a phase-transition-like sensitivity around constraint density.
  • "No-guess" board generation is essentially rejection sampling on solvability, which raises a real cost question at scale.

Full method, seeds and charts: https://lkforge.com/blog/minesweeper-how-often-you-must-guess/ (my own implementation/write-up). Curious how others would formalise the "forced-guess" threshold.


r/compsci • • Sep 09 '26

Free live algorithms course starting Sept 17, taught by a CMU professor

Thumbnail
10 Upvotes

r/compsci • • Sep 09 '26

Optimizing a Spin-Lock

Thumbnail david.alvarezrosa.com
5 Upvotes

r/compsci • • Sep 07 '26

Is it fair to say that classical AI is becoming more important than ever because LLMs are now using classical AI techniques as tools?

0 Upvotes

P.S. By classical AI, I mean techniques that don't use machine learning such as SAT solvers.


r/compsci • • Sep 06 '26

Lisp compiler for x86-64

Thumbnail github.com
0 Upvotes

I’ve been building a small Lisp compiler written in C++ and compiles S-expressions directly to native x86-64 assembly, using a tiny runtime for things like printing integers, doubles, and strings.
Currently it has functions, arithmetic, integers, doubles, strings, etc.
The compiler is still pretty simple:

S-expressions → AST → semantic analysis → x86-64

No VM, no bytecode — just Lisp turning into machine code.
I’m also starting to look into adding a small IR between the AST and codegen as the language grows.
Mostly doing this as a learning project and because writing a Lisp compiler seemed like a fun rabbit hole. :)


r/compsci • • Sep 04 '26

In Memoriam: Richard E. Stearns (1936-2026)

Thumbnail cacm.acm.org
59 Upvotes

r/compsci • • Sep 03 '26

NAND to Tetris Course approach

7 Upvotes

I recently started NAND to Tetris Course because I wanted to understand low level better. I started Unit one yesterday where you build logic gates. I have only watched videos to 1.4 HDL and started doing exercises. As a programmer with no formal training it has been hard to wrap my head around NAND (im getting there). The thing is i have built every component so far from only NAND gates to make them more intuitive. It has been time consuming to figure out how to do it but i find it fun. Is this stupid approach or does it rly matter if i use only NAND or logic gates that i have already made for building more complex logic gates for future exercises? I have been taking notes from every gate that i have built so it would be easy to switch later if needed. This is my MUX notes that i made before building it with HDL.

EDIT.

I built every logic gate up to DMUX from NANDs and normally both. Process how to get to NAND gates always involved OR, AND and NOT gates anyway when using boolean algebra. I built all other logic gates too but ditched NANDs. Didnt rly feel like writing any extra repetitive lines when busses were introduced. I was fun at start when it was a challange but became easy very fast. I still have my notes from all the elementary logic gates if I ever need a refresher. One table for simplest implementation with fewest gates (I could find) and another where i transform that to NANDs.


r/compsci • • Sep 03 '26

What is the best method to try and compress a string of integers/extremely low entropy binary stream?

Thumbnail
0 Upvotes

r/compsci • • Aug 31 '26

Anyone know where I could find this vintage Motorola 68000 programmer's reference manual?

Post image
24 Upvotes

r/compsci • • Aug 29 '26

How is program synthesis better than writing code?

0 Upvotes

the idea of program synthesis (like Rosetta) is to reduce a function into its constraints in a spec sheet, and generate the program from those constraints. for example, in order to write something like x = x squared, you would need to write a spec sheet along the lines of ∀x∈Z,f(x)=x2. i am considering building a program synthesizer, but I still haven’t figured out why exactly this representation is supposed to be easier than writing the code directly (they look equally complex)


r/compsci • • Aug 29 '26

Either the BS in Comp Sci degree will dramatically change, or a new degree will arise to replace its relevance.

0 Upvotes

For context, I’m a dev with 15+ years of experience, started coding in my early teens, and have a total love for the act of programming. I miss how coding used to be, nothing about this post is an advocacy for if things should be this way. After mulling it over, it just seems like an inevitability.

Right now the field of software development is like Wiley Coyote, already off the cliff but still running because he hasn’t noticed.

There has become a massive disconnect between what people in the field of software development actually do at their jobs, and what they’re interviewed on and learn in college. It’s like someone in 2007 having mandatory classes in Fortran and having to prove their knowledge of punchcards during job interviews.

My job, and the job of so many other software developers, has become almost entirely just interacting with AI agents. Yet we have job applicants do leetcode problems and write code live for us during interviews when we haven’t written more than a handful of a lines of code ourselves in the past year. The same extends to what these applicants are learning in college.

Effectively, it seems to me that the curriculum we currently know as a BS in Computer Science will become as generally superfluous as a PhD in Computer Science. Not at all useless, far from it. But held by those who either have a specific passion for the field or are looking to go into small and highly specialized areas of the field, not by the broader population simply looking to find a job after graduating. And in its place, as the broadly achieved degree, will be something much more tailored to the average needs of employers.

Seems like just a matter of time, driven by economics. Most employers don’t need someone with the full expertise of a computer science degree. Why would they pay for it? The only reason they have that as a standard now is because they do need someone who isn’t an untrained vibecoder. But that leaves a gap in the middle. Someone who isn’t going to delete the company’s database, but not necessarily with experience in database structure and rollups and joins. Someone who can use git and GitHub and properly manage deployments, but not necessarily someone who has done pointer arithmetic and compiler design. Someone who can catch and well document issues, not necessarily someone familiar with big O notation. In broad practice, AI can write good database structure and queries, AI can handle writing and running software, AI can measure performance and find areas to increase efficiency.

“But AI still makes mistakes!” You say. And you’re right. But so do software developers, oftentimes more than AI. There are quite a lot of average and below average software developers out there. And big companies, especially those dealing with higher risk/importance systems, will still have full computer scientists, experts in being able to know better than AI and review its work. But that won’t be most roles. That big company will still need someone to update and add features to the website. And someone to add features to the in house analytics tools. And someone to take user bug reports and get them fixed. And countless other roles that are simply an added layer in the corporate structure for the purpose of interpretation, oversight, and execution for AI. And that’s what the degree would teach towards.

I’d compare it to how nurse practitioners are taking on a larger role in the medical field, doing duties traditionally done by doctors such as diagnosing and prescribing. Effectively, the expertise of a doctor isn’t needed for average/mundane medical work, so a field rose in prevalence to fill that role, with a doctor’s expertise brought in when needed.

So it seems obvious to me that, perhaps within the next 5-10 years, a new degree will become the standard that teaches to that average need in the new state of the field.

That, or in 10 years AI tech accelerates to the point of computer science irrelevance. AI can do it so well and so entirely that non-tech people can just bark orders at it that would have been given to developers or their managers in the past. The degree diminishes and goes into the west.

Anyone see the same thing or am I off base here? Every counter argument I considered just sounded like some form of coping.