Most Popular

1500 questions
11
votes
1 answer

How does Stack Inspection work?

This is precursor to my other, more advanced question about Stack Inspection. Stack Inspection is a security mechanism introduced in the JVM to deal with running code originating from locations having different levels of trust. This is question aims…
Dave Clarke
  • 20,345
  • 4
  • 70
  • 114
11
votes
2 answers

Decidable properties of computable reals

Is "Rice's theorem for the computable reals" -- that is, no nontrivial property of the number represented by a given computable real is decidable -- true? Does this correspond in some direct way to the connectedness of the reals?
Shachaf
  • 213
  • 1
  • 5
11
votes
2 answers

modular multiplication

I was reading the Modular Multiplication page on wikipedia...and could not understand the algorithm to compute $a \cdot b \pmod{m}$. uint64_t mul_mod(uint64_t a, uint64_t b, uint64_t m) { long double x; uint64_t c; int64_t r; if (a >= m) a…
user -1
  • 111
  • 1
  • 5
11
votes
2 answers

Do there exist "O(1)-complete" problems?

Many complexity classes have "complete" problems. Do complete problems exist for the complexity class of problems that can be solved in $O(1)$ time? A complication is that this class depends on the model of computation; a problem can be solvable in…
Mike Battaglia
  • 1,071
  • 6
  • 19
11
votes
1 answer

I built a mechanical computer powered by marbles. What are its theoretical limitations?

Over the last couple years, I built a mechanical computer powered by marbles and made a game out of it. It's similar to the old Digi-Comp II, except for two key differences: Parts are repositionable on the board. You can connect multiple 'bits'…
11
votes
5 answers

How to determine if an automata (DFA) accepts an infinite or finite language?

Given an automata [DFA $A=(Q,Σ,δ,q_0,F)$], is there a way to determine whether it accepts an infinite or finite language?
Davis8988
  • 213
  • 1
  • 2
  • 5
11
votes
2 answers

Which kind of branch prediction is more important?

I have observed that there are two different types of states in branch prediction. In superscalar execution, where the branch prediction is very important, and it is mainly in execution delay rather than fetch delay. In the instruction pipeline,…
user123
11
votes
3 answers

Represent a 5 card poker hand

A deck of cards is 52. A hand is 5 cards from the 52 (cannot have a duplicate). What is the least amount of bits to represent a 5 card hand and how? A hand is NOT order dependent (KQ = QK). 64329 = 96432 Yes, can use 52 bits. That can represent a…
paparazzo
  • 431
  • 3
  • 13
11
votes
4 answers

Finding "fingerprint" sets

Let's say we have 10 people, each with a list of favorite books. For a given person X, I would like to find a special subset of X's books liked only by X, i.e. there is no other person that likes all of the books in X's special subset. I think of…
edron79
  • 176
  • 6
11
votes
3 answers

Why are most mutex implementations unfair?

My understanding is that most popular implementations of a mutex (e.g. std::mutex in C++) do not guarantee fairness -- that is, they do not guarantee that in instances of contention, the lock will be acquired by threads in the order that they called…
Jeremy Friesner
  • 267
  • 2
  • 7
11
votes
4 answers

Minimum number of shopping trips for a group of people to buy presents for each other

We have a group of $n$ people. We are given a list of who must buy presents for whom within the group. Each person might need to buy/receive any number of presents, or possibly none at all. In a shopping trip, a subset of the people travel together…
Riley
  • 280
  • 1
  • 11
11
votes
4 answers

Two-way Hash Functions

While I'm aware most (good) hash functions are one-way (or at least mostly so), I'm wondering if there's any construct (not necessarily called a hash function) which behaves in many ways like a hash function, but can be easily reversed. For example,…
Joe Horne
  • 165
  • 1
  • 2
  • 7
11
votes
2 answers

Finding k'th smallest element from a given sequence only with O(k) memory O(n) time

Suppose that we read a sequence of $n$ numbers, one by one. How to find $k$'th smallest element just with using $O(k)$ cell memory and in linear time ($O(n)$). I think we should save first $k$ terms of sequence and when get the $k+1$'th term, delete…
Shahab_HK
  • 147
  • 1
  • 8
11
votes
4 answers

Does it make sense to have both the concept of 'null' and 'Maybe'?

While creating a client for a web API in C#, I ran into a problem regarding null as a value where it would represent two different things: nothing, e.g. a foo may or may not have a bar unknown: by default the API response only includes a subset of…
Stijn
  • 213
  • 1
  • 8
11
votes
2 answers

Mathematical conjectures equivalent to the halting of a Turing machine

This question is about whether every mathematical theorem can be reduced to the question of whether a single Turing machine halts. In particular, I'm interested in conjectures that are currently unproven. For example: Wikipedia says that it's…
1 2 3
99
100