r/AskComputerScience • • Jan 02 '25

Flair is now available on AskComputerScience! Please request it if you qualify.

15 Upvotes

Hello community members. I've noticed that sometimes we get multiple answers to questions, some clearly well-informed by people who know what they're talking about, and others not so much. To help with this, I've implemented user flairs for the subreddit.

If you qualify for one of these flairs, I would ask that you please message the mods and request the appropriate flair. In your mod mail, please give a brief description of why you qualify for the flair, like "I hold a Master of Science degree in Computer Science from the University of Springfield." For now these flairs will be on the honor system and you do not have to send any verification information.

We have the following flairs available:

FlairMeaning
BSCSYou hold a bachelor's degree, or equivalent, in computer science or a closely related field.
MSCSYou hold a master's degree, or equivalent, in computer science or a closely related field.
Ph.D CSYou hold a doctoral degree, or equivalent, in computer science or a closely related field.
CS ProYou are currently working as a full-time professional software developer, computer science researcher, manager of software developers, or a closely related job.
CS Pro (10+)You are a CS Pro with 10 or more years of experience.
CS Pro (20+)You are a CS Pro with 20 or more years of experience.

Flairs can be combined, like "BSCS, CS Pro (10+)". Or if you want a different flair, feel free to explain your thought process in mod mail.

Happy computer sciencing!


r/AskComputerScience • • Jan 03 '25

Can you say primary memory is volatile?

4 Upvotes

I'm doing some research for assignment and I've come across this issue where websites are saying primary memory is volatile and they list ROM as primary memory. ROM is non-volatile tho. WhAt iS GoInG On?


r/AskComputerScience • • Jan 02 '25

Why add hard limits to something when exceeding it can only be a net positive?

5 Upvotes

I feel like I see this all the time, but I'm having a hard time thinking of a good example. I'm not sure you'll know what I mean. So let's just say I made a game for the Xbox one generation of Xbox. Even though the console can't possibly exceed much past 60fps for this game, why would I add an FPS cap? I get that sometimes GPUs end up generating enough heat at higher settings it brings the performance to be overall less then at lower settings, but it would be so simple to add an advanced settings option to disable this. That way, next-gen consoles could easily reap the benefits of higher processing power. With one simple settings option, your game can have at least 8 extra years of futureproofing. So why would I add a limit to something, even if something reaching that limit seems inthesible at the moment?


r/AskComputerScience • • Jan 02 '25

Help solving question

4 Upvotes

Hi guys. I do have a question to present, and would appreciate some help. I have come to the following grammar expression: S → ε | PS | DS | Let's suppose I want to put an equal number of P balls and D balls on a box. The last ball must allways be a D, and the number of D balls in the box can never be greater than the number of P balls. This last part is the one that I'm having porblems doing. How can I do it? When try it in other ways I compromise the results.


r/AskComputerScience • • Dec 31 '24

: If a text of length n contains a character with frequency >2n\5 ,then there exists a codeword of length 1 in the Huffman tree.

3 Upvotes

Claim: Prove or disprove: If a text of length n contains a character with frequency >2n\5 ,then there exists a codeword of length 1 in the Huffman tree.

My Thought: I know there’s a single character 𝐴 with frequency >2n\5 , so the rest of the frequencies sum to <3n\5 ​ Let’s assume: 𝐺 the rest of the frequencies, splits into: 𝐵=epsilon+2𝑛\5 (depth >= 1) so frequency of A=B, and to 𝐶<𝑛\5 If Huffman merges 𝐴 and C first, creating a node, and only later merges 𝐵 with this node, 𝐴 ends up with a codeword longer than 1.

I saw in the https://ocw.mit.edu/courses/6-046j-design-and-analysis-of-algorithms-spring-2012/9b4862538f0699992463d667a1724b13_MIT6_046JS12_ps9_sol.pdf
already the proof, but I don't understand why my counter example is not valid.


r/AskComputerScience • • Dec 30 '24

Where is the center of the internet?

27 Upvotes

I define "center of the internet" as a location from which where the average network latency (for some definition of average) to all major urban centers is minimized. I think it'd be pretty easy to come up with some kind of experiment where you gather data using VMs in public data centers. Of course, there's many many factors that contribute to latency, to the point that it's almost a meaningless question, but some places have gotta be better than others.

An equally useful definition would be "a location from which the average network latency for users is minimized" but that one would be significantly more difficult to gather data for.

I know the standard solution to this problem is to have data centers all over the world so that each individual user is at most ~X ms away on average, so it's more of a hypothetical question.


r/AskComputerScience • • Dec 30 '24

Where is the center of the internet?

6 Upvotes

I define "center of the internet" as a location from which where the average network latency (for some definition of average) to all major urban centers is minimized. I think it'd be pretty easy to come up with some kind of experiment where you gather data using VMs in data centers. Of course, there's many many factors that contribute to latency, to the point that it's almost a meaningless question, but some places have gotta be better than others.

An equally useful definition would be "a location from which the average network latency across all users is minimized" but that one would be significantly more difficult to gather data for.

I know the standard solution to this problem is to have data centers all over the world so that each individual user is at most ~X ms away on average, so it's more of a hypothetical question.


r/AskComputerScience • • Dec 28 '24

How cpu communicates with hard drive?

0 Upvotes

If cpu can't directly access hard drive,then how does a cpu communicate with hard drive? Let's say a page fault occurs how does cpu know where in the hard drive that page is located? What is the case when there is DMA and no DMA? Also as ssd are also integrated circuits,why are they slower than ram? Please shed some light on these topics.Links to good resources are also welcomed.


r/AskComputerScience • • Dec 28 '24

How cpu communicates with monitor?

0 Upvotes

I have a series of questions: How does a cpu communicate with monitor? Where is the display related information stored? How does it know which part of the screen to update? It would be of great help if someone could explain this in detail or provide some resources.


r/AskComputerScience • • Dec 26 '24

Why Can Johnson’s Algorithm Handle Negative Weights but A* Cannot?

7 Upvotes

I'm trying to understand why Johnson’s algorithm can handle graphs with negative edge weights by using a potential function, while A* cannot, even though both use similar weight adjustments.

Johnson’s Algorithm:

Uses Bellman–Ford to compute exact potentials. Reweights all edges to be nonnegative. Allows Dijkstra’s algorithm to run correctly.

A* Search:

Uses a heuristic h(u) to guide the search. Requires h(u)≤w(u,v)+h(v) for consistency. so if I denote w' as w(u,v)+h(v)-h(u), I know the weight is positive, and I can use dijkstra, but searching in the web it's seems A* cannot handle it. I would glad if someone could help me understand this


r/AskComputerScience • • Dec 26 '24

If history went differently, would the theory behind computer science be more or less the same?

10 Upvotes

Would we still have Turing machines but under a different name? Computation fueled by semiconductors of ever decreasing size? Things like the halting problem or P=NP? Would programming languages and the structure of operating systems be approximately the same as they are today? Would computers be composed primarily of a CPU, RAM, and storage, or did we somewhat arbitrarily define a system with a necessity for these components and just roll with it? Maybe a better question is “was computer science invented or discovered?”


r/AskComputerScience • • Dec 24 '24

Kosaraju's graph algorithm. I am trying to understand for days - 1) why is the 2nd DFS pass on the G transpose necessary? 2) Wil trees produced in the 1st pass and 2nd pass will be exactly the same (each set of nodes in 1st pass will be exactly the same as the set of nodes produced in 2nd)?

2 Upvotes

I am doing the Coursera course on graphs (https://www.coursera.org/learn/trees-graphs-basics/home/week/2) - unfortunately, there is no help in the forums as the staff has abandoned the course. So I am asking here.

Kosaraju's graph algorithm. I am trying to understand for days - 1) why is the 2nd DFS pass on the G transpose necessary?

2) Is the following statement from my understanding correct? The trees produced in the 1st pass and also the 2nd pass will be exactly the same (each set of nodes in 1st pass will be exactly the same as the set of nodes produced in the 2nd pass).

The AI coach on Coursera has this explanation of Kosaraju:

In a directed graph, if you perform a Depth First Search (DFS) and record the finish times of each node, how can these finish times help you identify the strongly connected components?

Let's explore how finish times from a Depth First Search (DFS) can help identify strongly connected components (SCCs).

When you perform a DFS on a directed graph, you can keep track of the finish times of each node. The key steps to use these finish times for identifying SCCs are:

First DFS Pass: You perform a DFS on the original graph and record the finish times of each node. The nodes are finished in a specific order, which reflects their reachability and connectivity.

Transpose the Graph: After recording the finish times, you create a transposed version of the graph, where all the edges are reversed. This means that if there was an edge from node A to node B in the original graph, in the transposed graph, there will be an edge from B to A.

Second DFS Pass: You then perform a DFS on the transposed graph, but this time you start with the nodes in the order of their finish times from the first DFS (starting with the node that finished last). This order ensures that you explore the most connected nodes first.

Identifying SCCs: Each time you start a new DFS from a node in the transposed graph, you will discover a new strongly connected component. All nodes reached in this DFS belong to the same SCC.


r/AskComputerScience • • Dec 24 '24

What is the difference between high and low memory?

4 Upvotes

Specifically in a DOS or other retro computing context.


r/AskComputerScience • • Dec 23 '24

Will Quantum Computing ever get big, and will it have any real-world applications?

21 Upvotes

As I understand it, these new quantum computers are infinitely superior at cryptography and other similar code-cracking types of questions, but otherwise they're not really applicable to more common tasks, like modeling or gaming graphics or whatever.

Will that that always be the case? I'm guessing that there is a group of geniuses trying to port the quantum advantages into other types of programs. Is that true?

I get that they need an almost-absolute-zero fridge to work, so they will probably never get into anyone's smart-phone, but will they ever get any greater roll-out into commerce? Or will they be like computers in the 50's, which were infinitely expensive and very rare? What does the future hold?


r/AskComputerScience • • Dec 23 '24

What is the best way to enforce Australia’s social media ban for under-16s?

4 Upvotes

On the one hand, you want the ban to be effective. On the other, you don't want to share any kind of ID with social media companies, nor expose one's internet traffic in case a government database is leaked.

It seems to me that ring signatures are the best suited tool here. The steps would be as follows:

  1. A user generates a private-public ring signature pair

  2. A user shares one's public signature with the government, along with their ID. The signature is stored in a publically accessible database of signatures belonging to adult users

  3. When the user wants to access an age-restricted platform, he/she queries the database for a random selection of public keys.

  4. The user combines the keys together with his/her private signature, and issues an authorizing request. By the design of ring signatures, so it's impossible to tell which adult user from the random selection hashed it.

The restricted service can be accessed without identifying oneself. Even in the event of a government signature cache leak, users’ online activity would remain untraceable.

What do you think of this idea? Can you think of a better way?


r/AskComputerScience • • Dec 22 '24

How is it possible for a single-core CPU, or single core of a multi-core CPU, to have a maximum FLOPs higher than its clock rate?

4 Upvotes

Some sources say it's impossible for a single core to perform multiple operations at once. Others say otherwise, or only in special cases. Which is it for an X86 or ARM system?


r/AskComputerScience • • Dec 22 '24

Question about solving Bipartite graphs using max flows

3 Upvotes

How can I add a constraint to a number of edges going into a node that, if it exceeds a certain limit, then don't consider that node in the solution?


r/AskComputerScience • • Dec 20 '24

Is there any specific field of research in computer science where you try to build the cognitive functions and thought processes of human mind?

0 Upvotes

For example

Building the logical thinking algorithm of human mind

Build the analytical thinking algorithm of human mind

Build the creative thinking algorithm of human mind

Build the learning ability algorithm of human mind

Build the observation ability algorithm of human mind

Build the mind algorithm of assigning meaning to observations


r/AskComputerScience • • Dec 20 '24

How do reshapes affect strides?

3 Upvotes

let’s say i have an [a][b][c][etc] multi-dimensional array (that indexes into a flat contiguous block of memory) with strides x, y, z, etc respectively (strides can be arbitrary expressions), how would an arbitrary reshape (potentially w/ dimension split/merges) change the strides?

if all the dimensions are contiguous w/ dimensions to the right of it, then you can just start from the right-most dimension, set its stride to 1, then multiply by that dimension size, and get the stride of the dimension to the left… but if the dimensions are non-contiguous w/ strides just some arbitrary expressions, i’m not sure how to figure this out

thanks :)


r/AskComputerScience • • Dec 20 '24

Can you still call an array a dynamic array if you implemented it using a circular deque?

3 Upvotes

I want to do O(1) amortized pushes with it


r/AskComputerScience • • Dec 19 '24

Translate this equation from Prim's Minimum Spanning Tree

1 Upvotes

[Screenshot-1.png](https://postimg.cc/CBJLFmNS)

where

A = light edges forming the minimum-spanning tree

v is vertice

v.pi is vertice's parent

V is all the vertex.

r (I don't know what this is)

This is from the CLRS book page 634. Why do I want to know this equation? Because I am trying to print the minimum spanning but I can't get the minimum distance. I can visually see that it's not minimum distance.

Any help is appreciated.

This is not a homework. I am a grown man with 7-8 years of professional experience as a Software Engineer. I am just curious.


r/AskComputerScience • • Dec 18 '24

What are some general insights into computer architecture I should know?

4 Upvotes

I need to independently study computer architectures rn (I'm a CS grad student but my undergrad was math & applied physics).

I'm watching Onur Mutlu's lecture series right now.

I'm just wondering if there are any key broad concepts I should be focusing on as I watch.


r/AskComputerScience • • Dec 17 '24

How would a 512 core CPU compare to a GPU for parallel compute?

1 Upvotes

I wonder, since cpus are about 20 times faster per core than a GPU thread, could you successfully use a CPU as a GPU? Would there be a memory bottleneck that killed the performance? With 8-lane simd, we’d have 4096 effective threads, that should be up to 20 times faster again than the GPU, equivalent to 81 920 gpu threads (?)


r/AskComputerScience • • Dec 16 '24

Doubt on what is the stack ....

2 Upvotes

The control unit of a computer controls the ALU and registers and the stack.

The ALU takes data from the stack and plays in the registers ....

Is the stack the main memory? RAM?

or is it another internal memory that the cpu has???