Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [computer-science]

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

7
votes
3answers
390 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 ...
2
votes
1answer
75 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 ...
7
votes
2answers
573 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 ...
1
vote
3answers
37 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 ...
0
votes
0answers
74 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 ...
0
votes
0answers
94 views

What is the rationale behind unidemensional vectors in scientific languages?

In MATLAB a vector is a matrix of shape n×1 and length n. In Julia (which has been influenced by MATLAB) and Python's NumPy, on the contrary, there exist pure unidimensional vectors that have shape n ...
-4
votes
1answer
375 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 ...
-3
votes
1answer
69 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 ...
1
vote
1answer
130 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)...
1
vote
1answer
179 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 ...
18
votes
1answer
2k 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
2answers
313 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 ...
2
votes
1answer
131 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 ...
1
vote
1answer
100 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 ...
3
votes
2answers
152 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. ...
2
votes
1answer
294 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?
0
votes
2answers
222 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 ...
5
votes
4answers
324 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 ...
1
vote
1answer
113 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 = ...
0
votes
4answers
499 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 ...
3
votes
3answers
157 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 ...
3
votes
3answers
109 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 ...
1
vote
3answers
170 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 ...
4
votes
2answers
1k 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 ...
2
votes
2answers
654 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
1answer
136 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 ...
1
vote
3answers
365 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 ? ...
1
vote
1answer
306 views

Relation and difference between recursively enumerable languages and Turing complete languages?

From https://en.wikipedia.org/wiki/Recursively_enumerable_language a formal language is called recursively enumerable (also recognizable, partially decidable, semidecidable, Turing-acceptable or ...
0
votes
2answers
338 views

How to Create a Parser that Operates in Reverse

I've got my answer to this in the comment of the one I checked. Which Algorithm Approach Should I Take to Generate Lambda Expressions in Java? but I don't exactly know where to look in terms of ...
0
votes
1answer
200 views

Computational limits for huge k-th permutation?

Would it be feasible to calculate directly a k-permutation like k = 10^200000000? If not, What would be the computational limit to calculate huge k-th permutation in a today computer? How can I ...
1
vote
2answers
434 views

Having trouble with AP computer science sample test problem

I am currently taking AP Computer Science at my high school and while looking at some sample AP test problems I came across one that really confused me. Sample Problem The answer to the problem is ...
-1
votes
1answer
128 views

Why do we use 'assert not' in this example?

My code takes 2 dates and finds the age of those dates in days. In my daysBetweenDates method the instructor uses an assert statement: assert not dateIsBefore(year2, month2, day2, year1, month1, day1)...
7
votes
2answers
2k views

How does sleeping a thread work?

When you sleep a thread, what is actually going on? I see that sleeping a thread "pauses the current thread for a given period of time". But just how does it work? According to How Thread.sleep() ...
12
votes
3answers
1k views

Why did Ruby creator had to use the concept of Symbols?

tl;dr: Would there be a language-agnostic definition of Symbols and a reason to have them in other languages? So, why did the Ruby creators use the concept of symbols in the language? I ask this ...
3
votes
3answers
389 views

Is it faster to make a dedicated variable instead of calling deeply nested object several times?

In a JavaScript app, suppose I have a nested object like this: var myObject = { someProp: { someOtherProp: { anotherOne: { yetAnother: { ...
0
votes
1answer
103 views

Cyclomatic complexity - what exactly does the word “cyclomatic” mean?

I understand what cyclomatic complexity is, but I was trying to find the origin/meaning behind the word "cyclomatic" and could not find anything that wasn't about cyclomatic complexity. Does this ...
0
votes
1answer
30 views

What relationship describes two different abstractions of the same dataset

I am wondering if there is a specific term for when multiple representations are data equivalent. Meaning that you can transfer the data from one representation to the other without any loss of data. ...
1
vote
2answers
87 views

Language interaction

How does a program composed of several languages work? How do the languages work together or interact with each other? How do they understand stand each other? How do you know when to use any given ...
-1
votes
1answer
201 views

Floating point absorption phenomena and ULP

Numerical analysis text books talks about the absorption phenomena (Introduction to Numerical Analysis and Scientific Computing; Nabil Nassif; Dolly Khoueiri Fayyad; CRC Press; 2014) when adding ...
30
votes
13answers
4k views

Help in understanding computer science, programming and abstraction [duplicate]

Until now, I always believed that you should learn programming languages that make you do low-level stuff (e.g. C) to understand what's really happening under the hood and how the computer really ...
2
votes
2answers
344 views

Why are semantics and type systems are so important?

I heard that semantics and type systems are very important for all programmers! But I why are they so important? I don't understand. Maybe they are imortant only for theoreticians and compiler ...
0
votes
0answers
220 views

avoid nan and inf in floating point multiplication and division

I have the following hypothesis: It is better to reorder mult and div operation in such a way that we can do our best effort to avoid nan, inf and operating with subnormals. The reorder should follow ...
0
votes
1answer
94 views

Foundations of computation, and relation to modern computers [closed]

I want to understand how the theoretical foundations of computation relate to real-world computers. As far as my knowledge goes, Turing machines, recursive functions, finite state machines, lambda ...
2
votes
2answers
115 views

From a set of rules, derive the implications? [closed]

I've only just become interested in this domain, so sorry if I'm not using the correct terminologies. What I want is the following: Say I have a set of rules (or constraints), I want to derive some ...
3
votes
2answers
3k views

How do Symbol Tables, Lexers and Parsers work together in a modern design? [closed]

I'm working on creating my own scripting language for learning purposes. I've been reading through the Dragon Book and some things are a little unclear to me regarding the Symbol Table as well as ...
0
votes
0answers
209 views

What is this compression algorithm? (Similar to RLE)

In Run Length Encoding (RLE), a large set of information is encoded by storing the quantity of consecutive sequences. A canonical example is: ...
33
votes
2answers
2k views

What is the meaning of “doesn't compose”?

I see a lot of texts, especially functional programming texts, claim that certain CS concepts "don't compose". Examples are: locks don't compose, monads don't compose. I've been having a hard time ...
7
votes
4answers
1k views

How is a state machine different from any other computer program?

I have seen several implementations of "State Machines" on github. As far as I understand, a state machine takes input that may or may not transform its state into one of a finite set of other states. ...
1
vote
2answers
2k views

Is studying algorithms important for game development? [closed]

I am fairly new in the programming world, I have a 1-year experience and I learned by watching online courses, and I made few iOS apps. Now I am moving into game development and I already ...
2
votes
1answer
181 views

Find all factors(prime and composite) of a number

We can find all the prime factors using a Sieve of Erastothenes. But how do we find ALL the factors of a number? For instance, 24 = 2x2x2x3 But the complete factor list is - 1,2,3,4,6,8,12,24. I am ...