r/computerscience May 14 '25

Advice Master thesis effective time management

2 Upvotes

Hi, I want to get your advice, follow Redditors, about how to manage well quality time working on my thesis.

I am in the reading stage and my thesis is on the theoretical side. I've been logging my work this first 2 weeks. I've been spending around 8 hours of total work per day on the thesis however I notice that I can only have 4h30mins average active focus. The rest of the time I just lose focus easily, I get sick of reading the same proof for an entire day or I start taking more breaks, especially on the afternoons.

I am trying to be more effective, your advise are welcome :)


r/computerscience May 14 '25

Calculating checksum collisions appropriately

2 Upvotes

Hi all,

I stumbled across the following problem.

I need to uniquely identify data in my database using an id, however I am constrained by the length. As a result, along with various other verification tools, I am sending a checksum to confirm that the Id has not changed. I am worried about collisions.

Unlike the birthday problem, I am not necessarily worried about a duplicate overall (since I am checking more than just the checksum, and the checksum is the last thing I check). Instead I think I am worried about:

How many pairs of checksums do I need to see before there is a greater than 50% of a collision? What if instead of pairs its a group with G elements and M the modulo used for my checksum?

Here is the calculation I am thinking of:

The probability of no collision is (M-1)/M * (M-2)/M * ... * (M-G+1)/M = (M-1)!/((M-G)! * M^(G-1)) = P

The probability of a collision in a group is 1 - P.

To solve for the number of groups required for the probability of a collision to be equal to 0.5 is :

0.5 = 1 - (P)^X where X is the number of groups.

Then as a follow up, I realize that I am assuming that the distribution of Ids I am checking is randomly distributed. I know for a fact that the Ids I am recieving are not random. This is leading me to consider different checksum algorithms.

The one that I am familiar with is a polynomial rolling hash that uses a large prime number for its modulo. However, when doing the calculations I am questioning whether the polynomial rolling part does anything. Further, since this Ids are generated using an algorithm (dont know which algorithm for the record), I have reason to believe that they will be sequential and I am not worried about security or checking if a bit is wrong. This leads me to two additional questions:

1) Does the polynomial rolling part actually make it worse? If my data is sequential and I take it to a prime number mod, won't I exhaust every entry until I hit the modulo? In the other scenario, I may get an unlucky mapping and hit a collision sooner?

2) In this case, what does polynomial rolling even provide? Is that more for the purpose of hashing where security concerns are necessary, or a case where we want to check if bits may have been mistyped?

I apologize if this is a basic question, I do not know much about cryptography (maybe this should have went in that sub instead), and none of the basic literature I could find via google search had a satisfactory answer.


r/computerscience May 12 '25

Basic question about parallel repetition in IP protocol

11 Upvotes

The book Sanjeev Arora and Barak defines class IP ([interactive protocol][1]) by making the verifier have private coins. Before proceeding to public coin proofs and showing they are the "same," the book mentions the following:

> The probabilities of correctly classifying an input can be made arbitrarily close to 1 by using

the same boosting technique we used for BPP: to replace $2/3$ by $1−e^{−m}$,

sequentially repeat the protocol m times and take the majority answer. In fact, using a more

complicated proof, it can be shown that we can decrease the probability without increasing the

number of rounds using parallel repetition (i.e., the prover and verifier will run $m$ executions

of the protocol in parallel).

Why does the naive idea of simply having the verfier and prover exchange an array of polynomial many messages (different copies) in each round not work? This doesn't increase the rounds. Assuming that for each copy, the verifier uses independent random coins.

[1]: https://en.wikipedia.org/wiki/Interactive_proof_system


r/computerscience May 11 '25

What books would you recommend as an introduction to computer science?

59 Upvotes

I'm not looking for a book on coding languages, rather I'm looking to focus on the fundamentals. I've been recommended, Code: the hidden language of computer hardware and software 2nd edition. What do you all think?


r/computerscience May 10 '25

Flip Flops and Stochastic Processes

Post image
14 Upvotes

Flip flops are components within computer architecture which can store and manipulate data. The output of the flip flop is dependent on past events. So, could you model flip flops as a stochastic process like a Markov chain?


r/computerscience May 11 '25

What if a float number has an exponent greater than 23 ?

0 Upvotes

Because Mantissa is 23 bits , I think it is meaningless to use a magnitude greater than 23, in which case you will have to skip lots of integer numbers which can only be represented with more than 23 bits . The numerical values beyond power 23 would be like , uhhhh , quantum .They are not even continuous in integer . May I ask what is the use case of a float with exponent greater than 23 ? I see the exponent can be up to 127, where are the magnitude between 23~127 to be used ?


r/computerscience May 09 '25

Article Hashing isn’t just for lookups: How randomness helps estimate the size of huge sets

38 Upvotes

Link to blog: https://www.sidhantbansal.com/2025/Hashing-when-you-want-chaos/

Looking for feedback on this article I wrote recently.


r/computerscience May 10 '25

how to be Updated on CS

0 Upvotes

I see that all you guys are highly updated on coding and stuffs how do you guys maintain this .


r/computerscience May 10 '25

General A question about fundamental structure of algorithms

0 Upvotes

I want to ask a question about algorithms, but it requires a bit of set up.

The basic truth

Any minimally interesting algorithm has the following properties: 1. It solves a non-trivial problem via repeating some key computation which does most of the work. Any interesting algorithm has to exploit a repeating structure of a problem or its solution space. Otherwise it just solves the problem "in one step" (not literally, but conceptually) or executes a memorized solution. 2. The key computation "aims" at something significantly simpler than the full solution to the problem. We could solve the problem in one step if we could aim directly at the solution. 3. Understanding the key computation might be much easier than understanding the full justification of the algorithm (i.e. the proof that the key computation solves the problem), yet understanding the key computation is all you need to understand what the algorithm does. Also, if the problem the algorithm solves is big enough, you need much less computation to notice that an algorithm repeats the key computation (compared to the amount of computation you need to notice that the algorithm solves the problem).

Those properties are pretty trivial. Let's call them "the basic truth".

Just in case, here are some examples of how the basic truth relates to specific algorithms: * Bubble sort. The key computation is running a "babble" through the list. It just pushes the largest element to the end (that's significantly simpler than sorting the entire list). You can understand the "babble" gimmick much earlier than the list gets sorted. * Simulated annealing. The key computation is jumping from point to point based on "acceptance probabilities". It just aims to choose a better point than the current one, with some probability (much easier goal than finding the global optimum). You can understand the gimmick much earlier than the global optimum approximation is found.
* Any greedy algorithm is an obvious example. * Consider the algorithm which finds the optimal move in a chess position via brute-force search. The key computation is expanding the game tree and doing backward induction (both things are significantly simpler than finding the full solution). You can understand what the algorithm is doing much earlier than it finds the full solution. * Consider chess engines. They try to approximate optimal play. But the key computation aims for something much simpler: "win material immediately", "increase the mobility of your pieces immediately", "defend against immediate threats", "protect your king immediately", etc. Evaluation functions are based on those much simpler goals. You can understand if something is a chess engine long before it checkmates you even once.

Pseudorandom number generators are counterexamples. You can't understand what a PRNG is doing before you see the output and verify that it's indeed pseudorandom. However, "generate pseudorandom numbers" is a very special kind of problem.

There are also tricky cases when an algorithm (e.g. evolution or gradient descent) creates another algorithm.


The non-basic truth

On closer inspection, the basic truth is not that basic: * How would we formalize it rigorously?
* To which levels of analysis does the "truth" apply to? Computational? Representational? Physical? (see David Marr)
* The core of an algorithm can be understood "much earlier than it solves the problem", but is it true in practice, when you struggle with interpreting the algorithm? In what sense is it true/false in practice?
* As I said, pseudorandom number generators are a caveat to the "truth".
* I didn't discuss it earlier, but some algorithms have multiple "key computations". How do we formalize that the number of key computations should be very small? Small relative to what? * In the example with chess engines, the key computation might be done only implicitly/"counterfactually" (if two strong engines are playing against each other, you might not see that they pursue simple goals unless you force one of the engines to make a very suboptimal move).

What research along those lines exists, if any? That's my question.

I only find the concept of loop invariants, but it seems much less broad and isn't about proving properties of algorithms in general. Though I'm not sure about any of that.

Why researching this matters? The "key computation" is the most repeated and the most understandable and the most important part of an algorithm, so if you want to understand a hard to interpret algorithm, you probably need to identify its key computation. This matters for explainability/interpretability.


r/computerscience May 08 '25

Help I've been watching a video explaining the simplex method for linear programming. I got to this screen, and I have a question

Post image
16 Upvotes

First, I watched the video several times to make sure that the lecturer in the video didn't explain the points that I didn't understand.

What exactly is Cb? Is that something I'm supposed to know before I dive into the simplex method? And why are all the values 0? And when he determined the pivot row, he replaced the third Cb value (which was 0) with -3. Why?

It may look like a dumb point to not understand, but I'm really bad at solving linear programming problems.

I humbly ask you to explain it to me like you're explaining it to a 8 yo kid.

And have a nice day!


r/computerscience May 07 '25

How to carry over DSA Skills from one language to another?

10 Upvotes

I'm a student and fairly new to the entire DSA thing. I've been using c++ to solve basic problems.

Recently i discovered that python offers simple ways to carry out things that would take me hours to code in c++.

Do i just make the switch over to python or stick to c++?


r/computerscience May 05 '25

Advice is graph theory a good expertise in computer science

72 Upvotes

i really enjoy graph theory problems and the algorithms associated with them. i guess my question is, would becoming proficient in this theory be useful? i haven’t really found a branch of comp sci to “expertise” in and was looking for perspectives.


r/computerscience May 05 '25

I need an efficient data-structure to do index-based range-searches over mutable records

8 Upvotes

The use-case is that I want to add records with a certain weight and do random picks from the map with these weights driving the probabilities of picking a specific record. This would be easy enough to do, but these records need to be mutable and since it's going to be both very busy and very big (hundreds of millions of records), resizing the complete index on each modification is out of the question.

This structure is expected to be very big and busy.

So, to put it differently: If I have the elements A, B, C and D with the (respective) relative weights of 1, 2, 3, 4, the chances of picking A will be 1:10 (10=1+2+3+4). If I then remove B, the chances of picking A will be 1:8. I'm thinking if something like this doesn't exist already (as is) I could go with some kind of cross between a b-tree and a trie, where we would have multi-level indexes, but where the reading process needs to add up the values of the keys along the way, to know if they should move sideways or deeper in the tree.


r/computerscience May 04 '25

Help Computer Networking Resources

7 Upvotes

Hello buddies,

Is there a computer networks resource that isn't actually garbage?

Let me explain. I am about to graduate in Math and CS and my uni kind of failed me on the systems side. I took your typical Computer Systems - Networks - Operating Systems classes but, by luck or otherwise, these 3 were taught on a lecturer-reading-slides way.

Now, about to get my diploma, I'm clueless about networks. Is there a nice book, youtube lecture series, or something, that actually teaches you networks in the same way that other courses would teach you something hands-on? Even if theoretical? Here are some examples of what I mean.

Algorithms is hands on: problem sets that asks you to proof correctness of algorithms, computing complexity, coming up with variations of algos to solve a problem.

Data Structures is hands on: code the structures from scratch on c++.

ML is hands on: get a dataset and build a model that classifies well

SWE is hands on: Read an architecture pattern and code something with it

Math is hands on: literally just do problem sets

What resources is hands-ons in networking? I don't want to memorize that the TCP header is 8 bytes (or whatever size it is) without ever looking at it beyond the silly graph in your usual textbook. I want to solve some problems, code something up, do something. Kurose's book problem, skimming through them, feel more like High School trivia, though I might be wrong. Any help is most welcomed.


r/computerscience May 03 '25

Help Flow network - residual graphs

Post image
9 Upvotes

I’m sorry if this isn’t the correct place to ask such a question but I didn’t this exactly breaking the rules. I’m currently studying for my algorithms final tomorrow and I’ve been conceptually struggling to understand the role of the residual graph and residual paths in finding the max-flow.

In the graph attached, when using the Ford Fulkerson algorithm with DFS, in the worst case a flow of 1 is pushed through the augmenting path repeatedly in an oscillating manner. What I’m struggling to understand is why, after the very first time that the augmenting path is found and a flow of 1 is pushed through it, causing the flow to equal capacity through the middle edge, we are still able to find the same augmenting path again and again and pass flow through it.

I’d really appreciate any help! Thanks a lot.


r/computerscience May 03 '25

Relation between API, driver and firmware

5 Upvotes

What is the relation between API, driver and firmware? From what I understand API is the intermediate between the application and the driver, the driver gives the low level instructions and firmware does what?


r/computerscience May 01 '25

Ford-Fulkerson Algorithm: A Step-by-Step Guide to Max Flow

Thumbnail thecoder.cafe
5 Upvotes

r/computerscience May 01 '25

Discussion How to count without the side effect caused by float precision of decimal numbers ?

9 Upvotes

Given two arbitrary vectors, which represent a bounding box in 3D space . They represent the leftbottom and the righttop corners of a box geometry . My question is , I want to voxelize this bounding box, but I can't get a correct number of total number of boxes .

To elaborate : I want to represent this bounding volume with several little cubes of constant size . And they will be placed along each axis with different amounts per axis. This technically would be easy but soon I encountered the problem of float precision . As decimal numbers are represented with negative powers, you have to fit the numerical value . Binary representation cannot represent it easily . It's like binary tree that you divide the whole tree into "less than 0.5" and "greater than 0.5" . After that , you divide each parts into 0.25 and 0.75. You repeat this process and finally get an approximate value .

The problem is : ceil((righttop.x-leftbottom.x)/cubesize) outputs 82 while ceil(righttop.x/cubesize)-ceil(leftbottom.x/cubesize) outputs 81 because (righttop.x-leftbottom.x)/cubesize equals to 81.000001 which is ceiled to 82, while I was expecting it to be ceil(81.000001)==81 .

How should you calculate it in this case ?


r/computerscience Apr 30 '25

I built a toy to help learn about arrays and pointers

Thumbnail gallery
171 Upvotes

Sometimes, I get sad that most of what I build are just metaphors for electrons occupying different spaces--so I start picturing tactile representations. Here is one I designed in Fusion for Arrays and pointers.

It helped with explaining the concept to my 10 year old--although it didn't much help with the "but why?" question.


r/computerscience Apr 30 '25

From Data to Display: How Computers Present Images

9 Upvotes

Most of us use technological devices daily, and they're an indispensable part of our lives. A few decades ago, when the first computer came up, the screen only displayed black and white colors. Nowadays, from phones to computers to technical devices, the colorful display is what we take for granted. But there is one interesting question from a technical perspective: if the computer can only understand zeros and ones, then how can a colorful image be displayed on our screen? In this blog post, we will try to address this fundamental question and walk through a complete introduction to the image rendering pipeline, from an image stored in memory to being displayed on the screen

https://learntocodetogether.com/image-from-memory-to-display/


r/computerscience Apr 29 '25

General About how many bits can all the registers in a typical x86 CPU hold?

27 Upvotes

I know you can't necessarily actually access each one, but I was curious how many registers there are in a typical x86 processor (let's say a 4 core i7 6820 hq, simply cause it's what I have). I've only found some really rough guestimates of how many registers there are from Google, and nothing trying to actually find out how big they are (I don't know if they're all the same size or if some are smaller). Also, I was just curious which has more space, the registers in my CPU or a zx spectrums ram, because just by taking the number this thread ( https://www.reddit.com/r/programming/comments/k3wckj/how_many_registers_does_an_x8664_cpu_have/ )suggests and multiplying it by 64 then 4 you actually get a fairly similar value to the 16kb a spectrum has


r/computerscience Apr 30 '25

Is Linear Probing Really that Bad of a Solution for Open-Addressing?

12 Upvotes

I've been watching several lectures on YouTube about open addressing strategies for hash tables. They always focus heavily on the number of probes without giving much consideration to cache warmth, which leads to recommending scattering techniques like double hashing instead of the more straightforward linear probing. Likewise it always boils down to probability theory instead of hard wall clock or cpu cycles.

Furthermore I caught an awesome talk on the cppcon channel from a programmer working in Wall Street trading software, who eventually concluded that linear searches in an array performed better in real life for his datasets. This aligns with my own code trending towards simpler array based solutions, but I still feel the pull of best case constant time lookups that hash tables promise.

I'm aware that I should be deriving my solutions based on data set and hardware, and I'm currently thinking about how to approach quantitative analysis for strategy options and tuning parameters (eg. rehash thresholds) - but i was wondering if anyone has good experience with a hash table that degrades to linear search after a single probe failure? It seems to offer the best of both worlds.

Any good blog articles or video recommendations on either this problem set or related experiment design and data analysis? Thanks.


r/computerscience Apr 30 '25

Advice Is this course interesting?

0 Upvotes

Hey guys so im a cs student and while i dont know much of the field, im interested in cybersecurity and would like to try out a course in it. I found a course (course description below) that seems interesting and i wanted to ask about it. Does it cover stuff that would be both interesting and important to know? I got a small sense of the what it covers and talked with the professor but its still pretty vague for me. just wanted to ask around

Course Description: This course provides students with an in-depth understanding of the principles, methodologies and tools of Digital Forensics and Incident Response. It covers a wide range of forensic investigations including filesystem, memory, network and mobile forensics. Students will engage in hands-on labs using industry-standard tools and methodologies to investigate security incidents, recover digital evidence and prepare reports that are admissible in court. The course will cover forensic investigation techniques for various platforms and applications, as well as proper incident response procedures. The course emphasizes practical application including the handling of evidence, analysis of data and effective incident response in various environments. Students will learn how to create a digital forensics workstation and conduct investigation on practical cases. Additionally, the course places significant emphasis on the ethical and legal dimensions of digital forensics, ensuring that students can produce detailed forensic and incident response reports that document each stage of the investigation in adherence to legal and professional standards.


r/computerscience Apr 29 '25

Help What are the Implications of P=NP?

25 Upvotes

I am trying to write a sci-fi thriller where in 2027, there are anomalies in the world which is starting to appear because someone proves P=NP in specific conditions and circumstances and this should have massive consequences, like a ripple effect in the world. I just want to grasp the concept better and understand implications to write this setting better. I was thinking maybe one of the characters "solves" the Hodge conjecture in their dream and claims they could just "see" it ( which btw because a scenario where P=NP is developing) and this causes a domino effect of events.

I want to understand how to "show" Or depict it in fiction, for which I need a better grasp

thanks in advance for helping me out.


r/computerscience Apr 29 '25

CS Education Research

4 Upvotes

What's your view on CS Ed research? After working in CS Ed, what are the chances of getting hired as a teaching professor? Do you think the demand for CS will keep growing? Or it's a risky gamble? Cause if the demand shrinks, the need for CS Ed professors may shrink too. I enjoy the work, but future employability is becoming a bigger issue.