Skip to main content

Questions tagged [computer-science]

Computer science or computing science (abbreviated CS or CompSci) is the scientific approach to computation and its applications.

Filter by
Sorted by
Tagged with
0 votes
1 answer
75 views

Concatenating strings given a BNF grammar

<Definition> ::= <Name> <LeftPar> <param> <RightPar> <Name> ::= <Letter><LetterTail> <LetterTail> ::= <Letter><LetterTail> | ‘’ A ...
User's user avatar
  • 11
1 vote
9 answers
3k views

can every program still be written without recursion or cyclic calls?

I'm wondering if it was theoretically possible for a compiler to determine maximum stack depth at compile time if a limitation was placed on the program. The limitation being that you can't use ...
glades's user avatar
  • 419
0 votes
1 answer
189 views

What is meaning of "end-to-end" or "link-to-link" flow control?

I am reading the paper "Ethernet Goes Real-time: a Survey on Research and Technological Developments". In this paper, it says "Flow control can be implemented on a link-by-link or end-...
KSMoon's user avatar
  • 11
-3 votes
3 answers
172 views

NP-complete problem (subset sum) featured in Netflix series "Suits" S1 E8? [closed]

In the Netflix series Suits, Season 1, Episode 8 (Identity Crisis), the legal team, with the help of a hacker, is tasked with proving that a business magnate embezzled funds, splitting them and ...
Cade Bryant's user avatar
6 votes
2 answers
879 views

Object immutability and persistence

While I was learning functional programming I have encounterd two for me very similar terms: immutability and persistence. Also I have read simular questions from stackoverflow, but I am still ...
DimitrijeCiric's user avatar
2 votes
4 answers
381 views

How do we define a "step" when calculating big O notation in an algorithm?

I'm learning about Big O notation and how it relates to computer science and I understand the sentiment behind Big O, however I'm struggling at understanding how we define a "step". In the ...
Davis Kim's user avatar
0 votes
3 answers
192 views

Prove that an expression can create duplicate

Let's suppose we have this expression: (i % 1000000) * 1000 + ms where i is an always increasing number, and ms is the millisecond part of the current time ( ranging 0..999). So each time we are ...
Felice Pollano's user avatar
0 votes
3 answers
186 views

Writing a growing simulation that scales

Or ways to get better run time than a nested loop? How would you design this? I hope this is the place to ask semi-vague software engineering questions. My simple simulation is like this: There is a ...
Ben Alan's user avatar
  • 119
-1 votes
1 answer
222 views

Is it viable to use imprecise analog computers to simulate equally artificial intelligence?

I was searching about simulation of artificial intelligence, machine learning and subjects alike and saw the news that some startups around of the world are using analog computers to simulate ...
Fulano's user avatar
  • 117
-4 votes
1 answer
286 views

How can I tell if my C function is a computable function in computer science?

How can I tell if my C function is a computable function in computer science? I am trying to write C code that would be acceptable to computer scientists in the field of the theory of computation. It ...
polcott's user avatar
0 votes
3 answers
390 views

How to deal with forward references in a compiler?

I'm creating a very simple compiler PoC that only has Procedures Calls to procedures. The syntax of the language is really simple: Main { Call("Proc1"); } Proc1 { // Empty } I ...
SuperJMN's user avatar
  • 453
0 votes
3 answers
2k views

Can more than one memory address be accessed at one time?

Apologies if this isn't the correct place to ask the question. But, I'm stumped. Can multiple memory addresses be read/written at one time, or must one address be read then another, is it possible for ...
jdow's user avatar
  • 184
-2 votes
2 answers
137 views

Why does the cpu store the current instructions into a stack once a system interrupt happens? [closed]

I was reading about it and was thinking surely the queue first in first out system would make more sense than using a stack because the last instruction will become the first right because it's lifo?
frosssssbite's user avatar
2 votes
2 answers
491 views

Is sequential consistency equivalent to performing memory accesses by a processes in program order and performing each memory access atomically?

In Fundamentals of Parallel Multicore Architecture, by Yan Solihin, p304 defines sequential consistency memory model: Overall, we can express programmers’ implicit expectation of memory access ...
Tim's user avatar
  • 5,495
1 vote
1 answer
441 views

Does a safe state not lead to a starvation state?

In Operating System Concepts: 7.5.1 Safe State A state is safe if the system can allocate resources to each process (up to its maximum) in some order and still avoid a deadlock. More formally, a ...
Tim's user avatar
  • 5,495
-2 votes
3 answers
822 views

is python(cpython) code represented as c code by the interpreter?

what i know is , in cpython when we run a code then its first compiled into byte code and the cpython interpreter( which is written in c interprets it) interprets the byte code and converts it into ...
sagiraju aneesh's user avatar
0 votes
1 answer
2k views

Efficient way to find Xor of pairs with given target X in a range 0 to K

I came across a problem: given an array (can be huge 10^8) and an integer, K, find the count of pairs in the array whose Xor equal to each value in the range 0 to K. eg: Arr = 1 2 3 K = 2 since K=...
Kalpish Singhal's user avatar
-5 votes
1 answer
58 views

Choosing 2 or 3 values out 3 values after calculating their closeness

I want to find a specific algorithm to choose either 2 or 3 out of 3 given values. Like if I have a set of values 10,11,12 all three are close enough so I will calculate the mean of the value and ...
Utkarsh Ghadge's user avatar
1 vote
5 answers
3k views

What is the true meaning of "natural ordering"?

I've found two definitions – roughly: the order of things that feels natural or standard to humans (like alphabetic order) the order of things that is natural or intrinsic to the data type in ...
Wes's user avatar
  • 842
-2 votes
1 answer
120 views

Are jagged arrays lvalue or not?

When I was study lvalue i see that C expression can be lvalue if a subscript ([]) expression that does not evaluate to an array. (from https://docs.microsoft.com/en-us/cpp/c-language/l-value-and-...
Ulaş Sezgin's user avatar
-3 votes
1 answer
100 views

What exactly is HTTP/2 protocol

Saw below definition on https://http2.github.io/: What is HTTP/2? HTTP/2 is a replacement for how HTTP is expressed “on the wire.” It is not a ground-up rewrite of the protocol; HTTP methods, status ...
kulsin's user avatar
  • 275
-1 votes
1 answer
173 views

How can I efficiently find out if X is in any of N ranges of L-R numbers?

This is part of a bigger problem, which is to find out if point XYZ exists in any of n (XYZ -> XYZ) "boxes". I'm currently splitting up the problem into a smaller one, by focusing on one dimension ...
Shadowjonathan's user avatar
0 votes
1 answer
260 views

Fuse 3D-Points in Bundle Adjustment?

I'm actually implementing my own Pose-Estimation/- and -Refinement pipeline. For this purpose I use one moving mono-camera. Then I take the consecutive images to estimate the pose and triangulate the ...
MattDom's user avatar
  • 11
1 vote
3 answers
224 views

Big O Complexity when iterating in 3 dimensions

What time complexity would you classify the following as having? int n = 100; for(int x = 0; x < n; x++) for(int y = 0; y < n; y++) for(int z = 0; z < n; z++) DoWork(...
Eoin Campbell's user avatar
10 votes
5 answers
805 views

Is it possible to programmatically evaluate safety for arbitrary code?

I've been thinking a lot lately about safe code. Thread-safe. Memory-safe. Not-going-to-explode-in-your-face-with-a-segfault safe. But for the sake of clarity in the question, let's use Rust's safety ...
TheEnvironmentalist's user avatar
1 vote
1 answer
145 views

is it possible to increase the offset in a jm(jump command inside)?

This is my first post here and I'm glad to join this great community and I hope to learn a lot here and help if I can(though i am a very beginner). I have a theoretical question: I am trying to add ...
csnoobie's user avatar
7 votes
2 answers
772 views

How did heavy software in the early days managed to run on 4MB RAM computer? [duplicate]

It's no secret that in the early days of computers, they had only 1-4MB of RAM. I found an article stating you needed only 4MB of RAM to run Word, Excel and PowerPoint simultaneously. How was that ...
Gintas_'s user avatar
  • 195
1 vote
3 answers
146 views

Reading an external variable turn out an impure function?

I was reading about "Referential Transparency" that says how to program thinking about purity and determinism. It's said that a function that modifies an outside state is unpure. But what about a ...
Isaac Ferreira's user avatar
0 votes
0 answers
91 views

Do all operations in the modern software boil down to arithmetic operations and data movements [duplicate]

Is it fair to assume that all or most operations in modern software like mouse movements, keyboard events, working with a browser and its controls, playing a game etc. come down to arithmetic/logical ...
Max Koretskyi's user avatar
-4 votes
1 answer
2k views

Python variable in bytes

By theory please correct me if I am wrong, it says that an int can take upto max 4 bits in case of number 9. I haven't coded it low level languages but I assume that the datatype int in c and python ...
user avatar
-2 votes
1 answer
82 views

Proof that computer communication only exists of function calls and events

I am writing a paper about the use of a message broker for inter-process communication where I state that all computer communications can be broken down into two categories: Function calls Events My ...
Vinno97's user avatar
  • 111
2 votes
1 answer
463 views

Am I allowed to simplify terms while calculating Big O?

I want to calculate the runtime of the following function T(n) = (1+2+3+4+5+...+n)/n At first this doesnt seemed hard to me because it can be solved easily by transforming the formula T(n) = (n(n-1)...
BudBrot's user avatar
  • 131
1 vote
1 answer
224 views

What would be a mathematical rigorous definition of a memory address space?

What is the exact definition of a memory address space? Is it correct to name the set of all the numbers from 0 to the highest addressable byte the definition of an address space? EDIT: I would like ...
yoyo_fun's user avatar
  • 2,297
18 votes
1 answer
4k views

How does integer comparison work internally?

E.g. when comparing two integers as follows in a C-like language: if (3 > 2) { // do something } How is the judgement whether 3 is greater than 2 (true) or not (false) made internally?
Niek's user avatar
  • 307
4 votes
2 answers
483 views

Correct terminology for if-blocks

I am using lex/yacc to parse a simple language which allows 'if blocks': IF something something [ELSE IF something][ELSE] END IF and also other nested logic under a 'DEFINE' statement: DEFINE ...
jramm's user avatar
  • 165
4 votes
1 answer
375 views

Use more dynamic dispatch could reduce compile time?

In swift the compilation time is really slow the amount of code in your project increases. So i was looking for ways to reduce that time. One approach maybe is to use language keywords like final or ...
Mariano's user avatar
  • 57
1 vote
1 answer
246 views

Key indicators/determinants that an algorithm has a time complexity of factorial or exponential?

There seems to be significant amount of deep information on the lesser time complexities: linear, polynomial, logarithmic; But there isn't a good source of deep information on how to easily determine ...
perseverance's user avatar
3 votes
2 answers
199 views

three overlapping project - how to organize

At the moment I am developing three scientific software projects (computer vision) in parallel in Python and scratching my head about organization, clean code and easy extensible/to maintain code. ...
snowflake's user avatar
  • 153
2 votes
2 answers
675 views

What is the difference between code reuse and software product line engineering?

What is the difference between code reuse and software product line engineering? Why is simple code reuse not successful enough?
Soulmaster's user avatar
0 votes
2 answers
2k views

How to calculate how much of the CPU is used?

Say we have an interrupt that is generated once each time that 1024 bytes of network traffic arrives. Each interrupt takes 3.5 microseconds to process and the network speed is 100Mb.We want the ...
user63210's user avatar
5 votes
4 answers
521 views

Distributing Java code into packages using a clustering approach

Theory is, that classes which strongly know and use each other should be in the same package (using package visibility for functions that are not used by the rest of the application), thus forming a ...
Matthias Ronge's user avatar
1 vote
1 answer
213 views

Is there a name for infered strong typing?

In JavaScript, you can have a loosely typed language. So doing the following is acceptable: var iterator = new TokenIterator(this.session, cursor.row, cursor.column); var matchType; var found = ...
1.21 gigawatts's user avatar
0 votes
4 answers
1k views

When it is worth it to spend RAM for computational speed? [closed]

I am developing data analytics algorithms that are supposed to process large amounts of data. Thus I am aiming to develop my mathematics already in such a way that it is possible to distribute the ...
Make42's user avatar
  • 307
3 votes
3 answers
183 views

What is the general term for [function] names of which the value is fully known at compile time?

In certain programming languages, the meaning of certain names may be fully determined at compile-time (i.e. without running the program). Example: A function in C has global scope; when the name of ...
Klaas van Schelven's user avatar
3 votes
3 answers
446 views

How are namespaces used in the stack during scope lookups?

I'm taking a comparative programming languages course and have learned the bare basics of variable scopes with respect to stack frames -- e.g. static and dynamic links, offsets, etc. as in the image ...
Dave's user avatar
  • 139
1 vote
3 answers
608 views

Categorizing columns in a database table

I wanted to know how do people generically think of, in a data base table: Columns that people are expected to use mostly for grouping expectable of groupability. Columns that people are expected to ...
94239's user avatar
  • 6
4 votes
2 answers
4k views

constraints in developing software

According to this As opposed to the constraints in other kinds of engineering, where the constraints of what you can build are the constraints of physical systems, the constraints imposed in ...
lightning_missile's user avatar
2 votes
2 answers
940 views

Formats for Storing Sparse Matrices

For storing sparse matrices I know there are multiple formats that are common, like COO, CSR, DIA, ELL, HYB, etc. (Link to some storage formats), but I haven't found that any of these stores the ...
Veridian's user avatar
  • 123
4 votes
4 answers
1k views

How to manage code experiments meant to stay permanently with git?

I have an asm/C code which implements some image filters. The objective of this project is experimentation with different implementations, benchmarking, plotting and reporting data to write a paper ...
Damian Pereira's user avatar
1 vote
3 answers
758 views

Find if any pair exists in an unsorted array?

I have come across a programming question in which I have to determine : Does there exists at least one pair in a given unsorted array such that |i - j| <= K and |A[i] - A[j]| <= x ? ...
Tushar Gupta's user avatar