r/AskComputerScience Jan 02 '25

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

14 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:

Flair Meaning
BSCS You hold a bachelor's degree, or equivalent, in computer science or a closely related field.
MSCS You hold a master's degree, or equivalent, in computer science or a closely related field.
Ph.D CS You hold a doctoral degree, or equivalent, in computer science or a closely related field.
CS Pro You 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 May 05 '19

Read Before Posting!

106 Upvotes

Hi all,

I just though I'd take some time to make clear what kind of posts are appropriate for this subreddit. Overall this is sub is mostly meant for asking questions about concepts and ideas in Computer Science.

  • Questions about what computer to buy can go to /r/suggestapc.
  • Questions about why a certain device or software isn't working can go to /r/techsupport
  • Any career related questions are going to be a better fit for /r/cscareerquestions.
  • Any University / School related questions will be a better fit for /r/csmajors.
  • Posting homework questions is generally low effort and probably will be removed. If you are stuck on a homework question, identify what concept you are struggling with and ask a question about that concept. Just don't post the HW question itself and ask us to solve it.
  • Low effort post asking people here for Senior Project / Graduate Level thesis ideas may be removed. Instead, think of an idea on your own, and we can provide feedback on that idea.
  • General program debugging problems can go to /r/learnprogramming. However if your question is about a CS concept that is ok. Just make sure to format your code (use 4 spaces to indicate a code block). Less code is better. An acceptable post would be like: How does the Singleton pattern ensure there is only ever one instance of itself? And you could list any relevant code that might help express your question.

Thanks!
Any questions or comments about this can be sent to u/supahambition


r/AskComputerScience 1h ago

What is defined as ‘one token’ exactly?

Upvotes

Every company says their model uses less tokens, my question what is the value of what they call a token, is it like a standard unit of measurement like a meter or does every company values 1 token differently? Or is it just a buzz word


r/AskComputerScience 3d ago

Advice on the structure of my JSON file?

1 Upvotes

Hello! I've been working on a modding framework that makes it easier to make mods for games written in C++. The main idea is that it's storing info about how to reverse engineer/discover game data like function addresses and field offsets.

I've got an example JSON file below that describes how to find the function for giving money to the player, and the field offset for the money variable. Each location style is not required and its just to demonstrate that multiple methods could be stored/used simultaneously. Also in this example, I'm trying to reuse property names ('kind', 'result', 'cached-location', etc) even though they're in slightly different contexts, in order to keep it more consistent and simple for less experienced programmers.

Example JSON:

{
    "header" : {
        "header-version": "1.0.0.0",
        "file-type": "data-locations",
        "module": "NMS.exe",
        "module-last-modified": "Friday, March 10, 2023, 2:04:54 AM",
    },
    "data" : [
        {
            "id": "cGcPlayerState.units",
            "locations" : [
                { "kind": "cached-location", "value": "0x1BC" },
                { "kind": "pattern", "value": "8B 83 ? ? ? ? 48 83 C4 ? 5B C3 CC CC CC CC CC CC CC CC CC 40 53", "result": "memory-displacement" },
                { "kind": "pattern", "value": "44 89 81 ? ? ? ? 4C 8B 15 ? ? ? ? 8B D6", "result": "memory-displacement" },
                {
                    "kind": "pattern",
                    "value": "44 8B 81 ? ? ? ? 48 8D 2D", 
                    "result": {
                        "kind": "memory-displacement",
                        "instruction-offset": 0,
                        "operand-index": 1
                    }
                }
            ]
        },
        {
            "id": "cGcPlayerState.AwardUnits",
            "locations" : [
                { "kind": "cached-location", "value": "0x1403CF8E0" },
                { "kind": "export", "value": "?AwardUnits@cGcPlayerState@@QEAAIH@Z" },
                { "kind": "pattern", "value": "48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 48 83 EC ? 44 8B 81 ? ? ? ? 48 8D 2D", "result-kind" : "matched-target-address" },
                { "kind": "pattern", "value": "E8 ? ? ? ? E9 ? ? ? ? 48 8B 0D ? ? ? ? 48 8D 54 24 ? 44 8B 44 24", "result-kind" : "relative-target-address" },
                { "kind": "pattern", "value": "E8 ? ? ? ? 4C 89 64 24 ? 48 8D 15 ? ? ? ? 0F 28 DE F3 0F 11 7C 24 ? 41 B8 ? ? ? ? 48 8D 0D ? ? ? ? E8 ? ? ? ? 84 C0 74 ? 48 8B 0D ? ? ? ? 8B D3", "result-kind" : "relative-target-address" },
                {
                    "kind": "search",
                    "identifiers": [
                        {
                            "target": "function",
                            "operation": "contains",
                            "values": [
                                { "kind": "string", "value": "MONEY" },
                                { "kind": "string", "value": "MONEY_EVER" }
                            ]
                        },
                        {
                            "target": "arg1",
                            "operation": "contains-offset",
                            "values": [
                                "cGcPlayerState.AwardUnits.arg1.offset1",
                                "cGcPlayerState.AwardUnits.arg1.offset2"
                            ]
                        },
                        {
                            "target": "arg2",
                            "operation": "offset-qty",
                            "value": "0"
                        },
                        {
                            "target": "cGcPlayerState.AwardUnits.arg1.offset1",
                            "operation": "add",
                            "value": "cGcPlayerState.AwardUnits.arg2"
                        },
                        {
                            "target": "cGcPlayerState.AwardUnits.arg1.offset2",
                            "operation": "add",
                            "value": "1"
                        },
                        {
                            "target": "function",
                            "operation": "return",
                            "value": "cGcPlayerState.AwardUnits.arg1.offset1"
                        }
                    ]
                }
            ]
        },
        {
            "id": "cGcPlayerState.AwardUnits.arg1.offset1",
            "locations" : [
                { "kind": "cached-location", "value": "0x1BC" },
                { "kind": "pattern", "value": "8B 83 ? ? ? ? 48 83 C4 ? 5B C3 CC CC CC CC CC CC CC CC CC 40 53", "result-kind" : "memory-displacement" }
            ]
        },
        {
            "id": "cGcPlayerState.AwardUnits.arg1.offset2",
            "locations" : [
                { "kind": "cached-location", "value": "0x148" },
                { "kind": "pattern", "value": "48 FF 83 ? ? ? ? 8B 83 ? ? ? ? 48 8B 5C 24 ? 48 8B 6C 24 ? 48 8B 74 24 ? 48 83 C4 ? 5F C3 CC CC CC CC CC", "result-kind" : "memory-displacement" }
            ]
        }
    ]
}

My main design goals are:

  1. Create a long-term solution for mod makers to use to store this kind of data. Must be flexible and capable of expanding to their needs.
  2. To keep the JSON format easy and intuitive for mod makers
  3. Provide multiple methods of locating the same thing. This will also be extensible so mod authors could make their own location kinds.
  4. The structure must be able to grow overtime without causing major breaking changes and is why I'm using a header.
  5. Be compatible with multiple JSON files simultaneously
  6. Allow the header to specify a "file-type" and then have different types of data objects.

I would love to hear any feedback on the structure of this. I've spent years on it, and I really want to make something that makes a difference for people. It's really important to me that its an appealing structure for people to use and is able to meet the technical requirements of the system. Some other things that would be nice to get feedback on are:

  1. Overall structure of the file
  2. Whether its okay to use the property name 'kind' over and over in slightly different contexts.
  3. Supporting multiple files with different 'file-type' values, so everything is very similar with the data object being the only thing that changes.
  4. Allowing properties like "result" to have both compact and expanded forms
  5. using dashes '-' for property-names instead of camelCase
  6. Any long-term concerns or unpleasantness you see

Thank you in advance!


r/AskComputerScience 4d ago

Question about Semantic Versioning

2 Upvotes

Under Semantic Versioning standard 2.0, if your package requires a dependency at "exact" version 1.0.0+X, is there any situation under which running a version update on all your packages should change the version that you specified as "exact" here?

Noting, SemVer 2.0 says:

Build metadata MUST be ignored when determining version precedence. Thus two versions that differ only in the build metadata, have the same precedence. Examples: 1.0.0-alpha+001, 1.0.0+20130313144700, 1.0.0-beta+exp.sha.5114f85, 1.0.0+21AF26D3----117B344092BD

Precedence refers to how versions are compared to each other when ordered


r/AskComputerScience 5d ago

Can you write a program to predict what living things would do?

0 Upvotes

This is from a comment on lesswrong, and I just wanted to know if what was said in it is accurate, sorry for the length:

Agreed!

No, Rice's theorem is really not applicable. I have a PhD in programming languages, and feel confident saying so.

Let's be specific. Say there's a mouse named Crumbs (this is a real mouse), and we want to predict whether Crumbs will walk into the humane mouse trap (they did). What does Rice's theorem say about this?

There are a couple ways we could try to apply it:

  • We could instantiate the semantic property P with "the program will output the string 'walks into trap'". Then Rice's theorem says that we can't write a program Q that takes as input a program R and says whether R outputs 'walks into trap'. For any Q we write, there will exist a program R that defeats it. However, this does not say anything about what the program R looks like! If R is simply print('walks into trap'), then it's pretty easy to tell! And if R is the Crumbs algorithm running in Crumb's brain, Rice's theorem likewise does not claim that we're unable tell if it outputs 'walks into trap'. All the theorem says is that there exists a program R that Q fails on. The proof of the theorem is constructive, and does give a specific program as a counter-example, but this program is unlikely to look anything like Crumb's algorithm. The counter-example program R runs Q on P and then does the opposite of it, while Crumbs does not know what we've written for Q and is probably not very good at emulating Python.
  • We could try to instantiate the counter-example program R with Crumb's algorithm. But that's illegal! It's under an existential, not a forall. We don't get to pick R, the theorem does.

Actually, even this kind of misses the point. When we're talking about Crumb's behavior, we aren'tasking what Crumbs would do in a hypothetical universe in which they lived forever, which is the world that Rice's theorem is talking about. We mean to ask what Crumbs (and other creatures) will do today (or perhaps this year). And that's decidable! You can easily write a program Q that takes a program R and checks if R outputs 'walks into trap' within the first N steps! Rice's theorem doesn't stand in your way even a little bit, if all you care about is behavior after a fixed finite amount of time!

Here's what Rice's theorem does say. It says that if you want to know whether an arbitrary critter will walk into a trap after an arbitrarily long time, including long after the heat death of the universe, and you think you have a program that can check that for any creature in finite time, then you're wrong. But creatures aren't arbitrary (they don't look like the very specific, very scattered counterexample programs that are constructed in the proof of Rice's theorem), and the duration of time we care about is finite.

If you care to have a theorem, you should try looking at Algorithmic Information Theory. It's able to make statements about "most programs" (or at least "most bitstrings"), in a way that Rice's theorem cannot. Though I don't think it's important you have a theorem for this, and I'm not even sure that there is one.

the comment is from this post: https://www.lesswrong.com/posts/7tNq4hiSWW9GdKjY8/intuitive-self-models-3-the-homunculus#3_5_4_Why_are_ego_dystonic_things__externalized__


r/AskComputerScience 5d ago

How are AI hallucinations different from human confirmation bias?

0 Upvotes

Confirmation bias can cause normal people to believe fallacious claims. Does AI not do the same thing?


r/AskComputerScience 5d ago

What is a project you're proud of?

0 Upvotes

What is a CS project that you're proud of? And which year did you make it (freshman-senior)


r/AskComputerScience 5d ago

How likely are we to develop AI super intelligence within the next 5 years?

0 Upvotes

What is your reasoning?


r/AskComputerScience 8d ago

What did Dennis Nedry do to the computer system in Jurassic Park?

4 Upvotes

What exactly did he do to manipulate the park systems and lock everyone else out? I’ve wondered this since childhood . Thanks.


r/AskComputerScience 10d ago

Is there much intersection between computational complexity theory and machine learning?

4 Upvotes

I’m a layman, but I’ve been reading some stuff about computational complexity theory in the course of learning about quantum information stuff, and I encounter a bit of machine learning theory here and there in the course of my reading about active inference in neuroscience.

Is there much interesting overlap between these two fields? Are there interesting things they “have to say” about one another?


r/AskComputerScience 10d ago

What should I study or are there projects I can make over the summer?

4 Upvotes

I just finished freshmen year of college and doesn't have an internship this summer. I don't really know what there is to do other than just leetcodes. I want to make a personal project but I don't know any topic that is still relevant in today's industry with AI like making a website can be done so easily with AI now.

I was thinking of making a personal website without the use of AI but I was wondering if there are some interesting project ideas or suggestions of what I should do this summer? I really want to work with some computer visions projects but also keep the budget down.

Any suggestions are appreciated thank you.


r/AskComputerScience 10d ago

Theoretical inquiry: Resource efficiency comparison of multi-state (Base-48) versus binary logic architectures in high-load systems.

0 Upvotes

I am currently investigating the theoretical limits of current data center architectures, specifically regarding the energy-per-operation costs of binary-gated processing when handling complex, non-linear data streams.

There appears to be an efficiency ceiling when binary systems attempt to categorize or "audit" high-density, multi-variate datasets, often resulting in significant computational overhead that does not scale efficiently. I am exploring a theoretical model using a 48-node state lattice as an alternative logic framework to reduce redundancy and bypass the standard binary-gate bottlenecks.

My questions for the community:

1. What existing literature or theoretical frameworks best address the transition from binary to higher-order logic systems, particularly for optimizing resource consumption in large-scale data auditing?

2. Are there established models for calculating "computational entropy" when a system operates on a non-binary state lattice versus a standard binary architecture?

3. In current high-load environments, what are the primary resource-draining factors in binary-loop redundancy, and have there been successful benchmarks in bypassing these via state-reduction?

I am interested in exploring whether state-based lattice logic offers a viable pathway for reducing the environmental and energy footprint of current data center operations.


r/AskComputerScience 10d ago

We have a responsibility to the environment

0 Upvotes

would anyone like to change the world overnight? I have discovered a modified base 12 to replace the old standard binary base 10


r/AskComputerScience 11d ago

When a computer or digital system decodes a digital audio format and converts it into a different digital format is the output always identical?

5 Upvotes

I'm not sure how to ask this question, or if the answer is obvious, but it occurred to me when thinking about MiniDisc.

Audio on an MD is stored digitally (ATRAC) and if you play it back the DAC converts it to an analogue signal. The quality of that output depends on the DAC and different ones will give differing quality. No problem with that idea.

My question is about the digital signal from the player. All my MD decks have TOSLINK optical outputs which is (I assume, linear PCM). My question is about whether the output from that connector is going to be identical if I play the same disk in different decks made by different manufacturers?

Is that PCM output signal predetermined by the input regardless of what machine processes it because it is a digital to digital transformation? In other words, is it some fixed mathematical function that always returns the same value?

I know that acoustically I would not be able to tell the difference, but would the device receiving that signal be able to tell the difference if you could capture and compare them?

Is this true/false for other digital to digital conversions too? For example, converting an mp3 file into a PCM stream?


r/AskComputerScience 11d ago

AI translation study advice

2 Upvotes

I work for an NGO and I've been tasked with putting together an internal study on AI reliability for translating letters. I'm probably not the ideal person for this. My background is in Political Science, this is my first permanent job, and my understanding of how AI actually works is limited. That said, I may still be the best-placed person we have available for it.

The brief is to assess the translation quality of 500 letters, looking specifically at precision and reproducibility (i.e. does the AI give consistent results if you run the same letter through it more than once?). The end goal is to inform a decision about whether to expand AI use for this kind of work more broadly.

Where I'm stuck is the grading methodology. I haven't decided how to actually score the 250 letters — whether that's human reviewers rating against a rubric, comparing outputs to existing human translations, using automated scoring metrics, or something else entirely. I'd really appreciate any advice on:

- What a sound, defensible methodology looks like for a non-technical person like me to run?

- How to test for "reproducibility" specifically (re-running the same letter multiple times? varying phrasing slightly?)

- Any pitfalls to avoid, given I have no formal AI/NLP background?


r/AskComputerScience 12d ago

LZ77 algorithm is making the compressed files bigger than original

1 Upvotes

I was recently toying around with some compression, just trying to understand it from the basics. I came to know about LZ77, LZ78, and LZW algorithms in the last couple of days, understood the algorithms, and when implementing LZ77, every time I try to compress a txt file, it is making the output file bigger. The compression is done right coz when I decompress the compressed file, I get the exact text.

Is there something I am missing to understand? Can anyone help me out and figure out what I am doing wrong?


r/AskComputerScience 13d ago

Why don’t we see high exponent polynomial algorithms?

16 Upvotes

Most polynomial time algorithms I’ve seen have, in practice, small exponents (like 2 to maybe 10). Is there some theoretical reason why this is? Or is it principally selection bias? And is there any rigorous way we could distinguish between those two possible explanations?


r/AskComputerScience 14d ago

Any CSE research experts help me...?

0 Upvotes

I have been working on implementation for my research. And it is taking too much time. I dont know why i keep on changing methodology and implementing stuff. Since im doing AI assisted coding it changes my direction. Is there any correct path to follow?


r/AskComputerScience 15d ago

I want AI at OS level and not application.

0 Upvotes

I mean ultimately there comes a time when we don't need applications at all. So why not integrate AI at OS level? Give a full context to it and make everything smart?
I don't want to play around thousands of applications and manage identities and memories. Does that make sense?


r/AskComputerScience 16d ago

Shor's Algorithm, continued fractions, and uniqueness

3 Upvotes

I've been going through David Mermin's Quantum Computer Science and just finished the section on Shor's Algorithm. The actual QC part all makes sense to me but I'm hung up on the post-processing. In particular, we suppose that our algorithm has conjured some number y which is (with probability >40%) within 1/2 of an integer (call it j) multiple of 2n/r, where n is twice the number of bits in our public key and r is the order of the message. We can write this as follows:

|y/2n - j/r| ≤ 1/2n+1 ≤ 1/2N2 < 1/2r2

We can then use a result of continued fractions from Hardy and Wright's An Introduction to the Theory of Numbers which states that, if |x - p/q| < 1/2q2, then p/q is a convergent of x. The numerators and denominators of the convergents of x are computed essentially using Euclid's algorithm, which, if x is a fraction, generates a number of terms logarithmic with respect to the denominator. In this case, that means we get on the order of n convergents as we perform the algorithm on y/2n. We can then check each convergent's denominator (and, perhaps small multiples in the case that j and r are not coprime) to see if it's the r we seek. Because the number of convergents is polynomial in our input length, this whole process remains polynomial. If we don't find our r, then y may not be properly bounded or the gcd of j and r may be too high; in either case we can simply run the whole algorithm again.

First, I guess I want to just make sure that my understanding of this post-processing step is correct, in particular the number of convergents generated. This is because my next question is that Mermin stresses that the specific convergent whose denominator is <N and who is within 1/2N2 of our estimate y/2n is unique. Why is this important? At best, I see that this could give us slight speedups in that we can check distances rather than doing modular exponentiation and stop computing convergents early, but from what I understand the algorithm is already polynomial.

I looked at the original Shor paper as well, which has this same point (some of the variable labels are different):
"Because q > n2, there is at most one fraction d/r with r < n that satisfies the above inequality. Thus, we can obtain the fraction d/r in lowest terms by rounding c/q to the nearest fraction having a denominator smaller than n. This fraction can be found in polynomial time by using a continued fraction expansion of c/q..."

but I'm still not seeing where the uniqueness becomes relevant. I'm curious if anyone has any insights here. To be entirely honest I've even tried asking AI a few times, and it agrees that the uniqueness is not important to the polynomial runtime, but of course I'm taking that with a grain of salt. Thanks!


r/AskComputerScience 17d ago

School computer science class

10 Upvotes

Does anyone in here have any high school computer science kids? I would like to know what they are teaching these days. I did computer science class back in the 80’s. Teacher taught us BASIC and Pascal.


r/AskComputerScience 20d ago

What's is the best way to solve graph and dp problems

7 Upvotes

Hi everyone,

I've been practicing Graphs and Dynamic Programming for the last six months, but the truth is that I still can't solve a single new problem completely on my own.

Everyone says that DSA is all about recognizing patterns, but I feel like I'm not actually learning those patterns. I've watched many tutorials and solved the questions explained in them. However, whenever I face a different problem that's based on the same pattern, I still can't figure out the approach myself.

This makes me wonder: am I just memorizing solutions instead of learning how to think?

Whenever I look at the solution, I understand the logic and why it works. But what's the point if I can only solve the problem after seeing the answer?

My usual process is to struggle with a problem for about an hour. If I still can't make progress, I use an AI tool to understand the solution. The problem is that this happens with almost every question. It makes me wonder how long I'll have to depend on AI before I can solve problems independently.

I'm feeling really frustrated. Has anyone been through the same situation? What strategy helped you develop problem-solving skills so that you could eventually solve questions on your own instead of relying on solutions?


r/AskComputerScience 21d ago

Discuss project idea

3 Upvotes

Hey everyone! 👋 As a final-year CS student specializing in data science, my team and I are looking to build a project. We're a bit light on computer network knowledge (think CCNA level), so we'd love some guidance! If you have expertise in this area, could you tell us if this project idea is feasible, what we should research, and the basic implementation needs?

Our project focuses on building an AI-powered predictive Content Delivery Network (CDN) that improves video streaming efficiency using intelligent networking and machine learning.

We will work on three main components:

AI Forecasting and Processing:

We will develop machine learning models to analyze network traffic data and predict congestion before it happens. This includes using time-series models to forecast bandwidth drops. Additionally, we will integrate AI-based video processing techniques such as super-resolution (using pre-trained models) to restore video quality after compression.

Network Architecture:

We will design and simulate a peer-to-peer (P2P) network where multiple nodes cooperate to deliver video content. The system will dynamically route data through the fastest available paths based on network conditions. We will also compare and optimize transmission protocols (such as TCP vs UDP) to reduce latency and improve performance. Network simulation tools like Mininet or NS3 will be used to test different scenarios.

Platform and User Interface:

We will build a simple video player that streams content through our system. This includes handling user requests, adaptive video quality, and playback. We will also develop a dashboard to monitor key metrics such as bandwidth usage, latency, and system performance, allowing us to demonstrate the effectiveness of our solution.

Overall, the system aims to reduce bandwidth consumption, improve streaming quality under poor network conditions, and provide a scalable solution for modern media delivery


r/AskComputerScience 21d ago

Should we bring back computer literacy classes? I want your opinions on the matter because programming has gone from initially easy and harder later to extremely hard but easier later so could this work or would it backfire?

11 Upvotes

Basic was a good starting point. I'm not saying go back to the days of the TRS-80 model 1, I am however asking if it would be realistic to reintroduce these types of classes into the curriculum.

Even if it was simply emulation? I'm asking because a lot of modern computer classes assume either c,c++ or python. I don't have a problem with either of those languages but the error system and Trace back could be problematic. There are other options, there's free basic, qb64 etc.

Programming doesn't have to be difficult to get into is what I'm saying. Would this be a good idea or a bad idea?