Questions tagged [computer-science]
Computer science or computing science (abbreviated CS or CompSci) is the scientific approach to computation and its applications.
198 questions
0
votes
1
answer
111
views
Concatenating strings given a BNF grammar
<Definition> ::= <Name> <LeftPar> <param> <RightPar>
<Name> ::= <Letter><LetterTail>
<LetterTail> ::= <Letter><LetterTail> | ‘’
A ...
0
votes
1
answer
240
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-...
6
votes
2
answers
1k
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 ...
0
votes
3
answers
221
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 ...
-1
votes
1
answer
255
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 ...
0
votes
3
answers
464
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 ...
-2
votes
2
answers
155
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?
1
vote
1
answer
453
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 ...
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=...
-2
votes
1
answer
130
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-r-...
-1
votes
1
answer
215
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 ...
1
vote
3
answers
239
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(...
1
vote
1
answer
168
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 ...
1
vote
3
answers
164
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 ...
-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 ...
2
votes
1
answer
487
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)...
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?
4
votes
1
answer
405
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 ...
3
votes
2
answers
210
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.
...
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 ...
1
vote
1
answer
229
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 = ...
3
votes
3
answers
191
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 ...
1
vote
3
answers
652
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 ...
2
votes
2
answers
997
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 ...
1
vote
3
answers
782
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
?
...