r/compsci • u/VectorDevz • 5h ago
We’re looking at the P vs. NP problem all wrong. It’s not a math puzzle; it’s a 1D physical limitation
Your thoughts are appreciated. Your words, even more so.
r/compsci • u/VectorDevz • 5h ago
Your thoughts are appreciated. Your words, even more so.
r/compsci • u/RudraMaths • 19h ago
I wanted to look at P vs NP purely through the lens of foundational data structures and standard graph algorithms.
Instead of trying to convert 3SAT into 2SAT, I broke the 3SAT clauses down into simple, direct implication tracks. These implications naturally chain together wherever the ending variable of one statement matches the starting variable of the next.
By running Tarjans Strongly Connected Components algorithm directly on this network of tracks, the components reveal the truth assignments. Because of the way the paths connect, the algorithm evaluates everything in a forward pass with absolutely zero backtracking or branching required. This drops the total evaluation into polynomial time, proving that P = NP.
The paper is fully formatted in LaTeX and safely hosted on Zenodo with a permanent, time-stamped DOI. All the steps are laid out in the PDF. Let me know what you think:https://doi.org/10.5281/zenodo.23696546
r/compsci • u/Most-Bookkeeper-950 • 1d ago
r/compsci • u/False_Actuator_6236 • 3d ago
r/compsci • u/voz83333 • 5d ago
Imagine we need brain surgery to remove a tumor. The surgery goes well, but afterward, you struggle to write or understand code. Scary, right?
We know that neurosurgeons try to preserve important abilities like speaking and moving during brain surgery. But what about programming?
A new study in Human Brain Mapping explores exactly this!
The researchers developed a new protocol during awake brain surgery to help identify and preserve brain areas involved in programming.
The idea is simple: if coding is an important part of someone's life, shouldn't we try to preserve that ability too?
Here's the paper: https://doi.org/10.1002/hbm.70634
r/compsci • u/kottbusser_floor • 6d ago
I made a game to teach computer architecture and digital logic: play.simten.dev
You start with basic logic gates and build up to a working CPU. It's built on Simten, a TypeScript-based HDL, so you write the circuits as code and they show up live on a canvas next to the editor. For sequential circuits you can scrub the clock backwards and forwards to watch the state change cycle by cycle. You can also drill down into abstracted components (like the half adder shows). Because of the layout it only works on desktop browsers for now.
It's open source, any feedback or contributions are welcome!
r/compsci • u/dedSEKTR • 7d ago
r/compsci • u/KebanFiru • 8d ago
Spent the last while building this: a browser based canvas where you can draw and run finite automata, pushdown automata, Turing machines, and Mealy/Moore machines, all with animated step-by-step execution.
A few things it does that I'm proud of:
- Converts a regex into an NFA (Thompson's construction), then NFA into a minimized DFA (subset construction), and can extract a regex back out of an automaton (FA to GNFA to regex)
- Local first: works fully offline with localStorage, no account needed
- Optional accounts unlock "Teams": real time collaborative canvases with live cursors and presence, so you can whiteboard an automaton with someone else the same way you'd use Figma
- There's a learning section with guided lessons, each paired with a live, editable simulator embed instead of static diagrams
It's free to use: theoryofcomputationsimulator.com
Would love feedback, especially from anyone who's TA'd or taken a theory of computation course and can poke holes in the UX.
r/compsci • u/Mossack-Fonseca • 9d ago
I know this has been discussed before, but it's extremely confusing for me because of how many variations there are in definitions. Here are some observations:
Most people would agree that process-switches and system calls both involve context switching, however I think the underlying "state saving" is different between these two events. In a system call, there is an entry phase where the kernel saves register state to the kernel stack (and not every system call leads to a process or thread switch). In a process-switch, the PCB gets updated so that the process can later be resumed. Is this accurate?
On Linux, both processes and threads are schedule-able (they're both "tasks"). As best as I can understand, there's a function called context_switch() in the Linux kernel that gets called during scheduling. However, it seems context switching is used in a broader sense. In other words "context switching" doesn't mean exactly that we're calling the function "context_switch()".
There is at least one textbook that considers functions as having their own context (Doeppner's Operating Systems in Depth). This is a little confusing because I can't find anyone else who considers a function call a change in context.
The question is: does anyone have a technical definition of context switching that captures what most people mean when they say "context switch"?
I've also been reading about the xv6 since it's a smaller educational operating system. If somebody has experience/knowledge of the xv6 internals, I would appreciate any input. Thank you
r/compsci • u/AssociationNo4311 • 9d ago
Modern APIs ship large payloads. LLMs consume structured data token by token. Validation failures surface too late. Streaming is standard but most formats weren't designed for it.
These are problems we kept running into, so we spent years working on a format built specifically for them. The core question we kept coming back to: why does every record in a dataset need to repeat the field names?
The idea we landed on — separate the schema from the data entirely. Define structure once. Records contain only values.
name, age, gender, joiningDt, address: {street, city, state?}, colors, isActive
---
~ Alice Smith, 28, f, d'2021-04-15', {Elm Street, Dallas, TX}, [yellow, green], T
~ Bob Johnson, 22, m, d'2022-02-20', {Oak Street, Chicago, IL}, [blue, black], T
~ Rachel Green, 31, f, d'2021-12-11', {Sunset Boulevard, Los Angeles, CA}, [purple, pink], T
~ Michael Scott, 41, m, d'2021-07-22', {Pine Street, Scranton, PA}, [green, orange], F
The header defines the structure. --- separates schema from data. Everything below is pure values.
You can go further and add type constraints directly in the schema:
age: { int, min: 0, max: 150 }
The parser enforces this at parse time — invalid data is rejected before it reaches the application. No separate validation step.
The format also supports inline comments, built-in types like email, url, date, and datetime, and is JSON-compatible so existing data works as-is.
We're curious whether this actually solves a real problem or whether we've been too deep in it to see the obvious issues. A few things we'd genuinely like feedback on:
--- separator between schema and data — does that feel natural or awkward?If you want to poke at it, there's a playground at play.internetobject.org and the spec is at docs.internetobject.org. We built it — happy to answer questions about the design decisions, including the ones we're not sure about.
r/compsci • u/WatchInternational89 • 9d ago
Body:
> Not an RL agent and not a behaviour tree — the "policy" is a spiking simulation of a real fly connectome, and the body
> is a MuJoCo fly whose legs are moved by an imitation-learned network. It sees, smells wind-borne odor, gets scared by
> spiders, grooms, lands, eats. Everything that isn't the brain is labelled on screen. Live: twitch.tv/dodo_gun
r/compsci • u/gilnett • 10d ago
Traditional B-Trees waste substantial CPU cycles on pointer chasing across node levels, causing avoidable cache misses on modern architectures. The PGM-index approach fixes this by modeling key distributions through streaming piecewise linear regression with strict +/- epsilon error guarantees.
Instead of dereferencing tree pointers, the position is predicted directly on the ALU (y = ax + b), leaving only a small local search window that fits entirely within L1 cache. The construction runs in a single O(N) streaming pass with zero external solvers.
I built a pure Rust implementation with zero dependencies to benchmark this against standard B-Trees and verify the theoretical bounds: https://github.com/gilnett/learned_index_lab
While traditional transactional engines stick to B-Trees for in-place page updates, learned models completely outclass them on read-heavy or immutable storage (like LSM SSTables and columnar stores) where pointer overhead is pure waste.
Has anyone here benchmarked or deployed learned data structures in production storage layers? How do you approach optimal epsilon tuning when key distributions are unpredictable?
r/compsci • u/Key-Impress5490 • 13d ago
r/compsci • u/raliev • 16d ago
Hi all,
I'd like to share some recent work in stringology / text mining. We developed BloomSpan, an algorithm for mining Maximal Contiguous Frequent Phrases (MCFPs) from large text corpora — token sequences that occur in at least σ documents and can't be extended on either side without dropping below σ. Unlike general Sequential Pattern Mining (GSP, PrefixSpan, BIDE+), no gaps are allowed, which matters for things like template extraction, plagiarism detection and phrase mining, where gaps only blow up the candidate space.
How it works
To be fair, it's less a brand-new algorithm than a careful combination of known pieces:
Memory stays O(W + M) in the input size (corpus + filter).
Results
The paper includes a topological analysis (LZ phrase ratio / entropy rate) of why natural language is the sweet spot.
Links
Happy to discuss implementation details, data structure choices, or the dataset topology analysis.
r/compsci • u/big_hole_energy • 17d ago
r/compsci • u/Willy_Importance69 • 17d ago
Hello, I want to share a project that i've been working on for the last month or so. It's and implementation (from what i could find the only rn on the internet) of Andreas Bjorklund's theoretical algorithm for determining weather a graph is hamiltonian or not. The algorithm is revolutionary because it lowered the exponential part of the time complexity of Held-Karp which is the standard algorithm for determining weather a graph is hamiltonian, from O*(2n) to O*(1.657n) for general graphs(this is what i've managed to implement as of right not) and for bipartite its O*(1.414n).
It might have some logical errors, and could maybe be optimised but right now, as of writting this it is 4AM and i want to sleep.
link to paper: https://arxiv.org/pdf/1008.0541
link to the github repo: https://github.com/Ak0-m/Bjorklunds_algorithm_for_Hamiltonicity
r/compsci • u/beeskness420 • 20d ago
r/compsci • u/cringevampire • 21d ago
r/compsci • u/azurerazor • 21d ago
r/compsci • u/Putrid-Ad-3768 • 22d ago
I've been going deep on data structures lately and found bloom filters pretty intriguing. I made a short video on what a bloom filter is, how the bit array and hash functions interact, and where the false positive formula comes from.
link: https://youtu.be/nNv4ZTQp_s8?si=j52fIUBYaDcaps0_
I'd love feedback, especially if I got anything wrong. Happy to go through the derivation in the comments if anyone wants it.
r/compsci • u/FollowingEvery4802 • 23d ago
So, lean is the language built specifically to prove theorems.but if the algorithm will be rewritten in another programming language, such as python, will it be accepted?
(mathematical theorems)
r/compsci • u/sciencenerd_1943 • 24d ago
Main Website: https://www.ruleflow.org/
For the past year, I have been developing a framework to simulate certain discrete systems for a research team at my university (paid for by the School of Engineering and Physics, but I had the freedom to license it under MIT). As it turns out, I got carried away generalizing it to work for many, many different types of complex systems (String Rewriting Systems, Cellular Automata, etc.) and ended up creating our own domain-specific language.
The website's landing page has a bunch of GIF-style examples... so you should be able to get a good idea of what this project is about.
If any of y'all are interested in this, feel free to take a look and try it out!
EDIT:
Out of the interest of not being "vague", here are some more details. RuleFlow was developed with a primary focus on analyzing causality in Sequential Substitution Systems. This is why there is a major focus on causal graphs, cellular identity, etc. While originally developed for Sequential Sub Systems, we generalized the DSL to support many types of rewriting systems by providing the user with flags and directives to control how rules behave. Furthermore, we bootstrapped Python and the Wolfram Language so that complex rulesets could be scaffolded as macros. The main goal of RuleFlow is NOT simply to simulate systems (there's already plenty of software for that, such as Golly and even just Mathematica), but to provide extensive tooling for causal analysis.
Here is some interesting research from our (small) team:
My job has been to provide better research tooling, extending what we already have in Mathematica code to open source and free Python.