instruction stringlengths 0 29.8k ⌀ |
|---|
The complexity of the BFS and DFS algorithms depend heavily on the graph being analyzed, and the search strategy being used. If we have a method to consistently get "closer" to a solution, then the search can be much more efficient than if we blindly stumble everywhere hoping to find what we need. In this case, I'm goi... |
As a practical matter, how you treat data structures mathematically largely depends what you're trying to do.
For example, suppose that you're trying to reason about the correctness of programs that use stacks and/or queues. In that situation, you'd want to treat the stack/queue as an abstract object, and axiomatise... |
I'm looking for some machine learning algorithm to train on data that are sampled from some submodular set function and I want the learned model predictions also obey submodularity.
For example linear regression can do this (because it's linear hence it produce a model that obey both submodularity and supermodularity)... |
Machine Learning algorithm to learn submodular set functions |
|machine-learning| |
|machine-learning|kernel-functions| |
The number of swaps and the number of comparisons are two different measures.
The number of swaps in BubbleSort is always equal to the number of inversions in the original array. To see this, it suffices to notice that each swap decreases the number of inversions by exactly $1$ and that a sorted array has $0$ invers... |
I've recently been designing a simple 8-bit microprocessor, similar to the Intel 8008. It doesn't make use of anything advanced as pipelining, as my knowledge isn't at that level yet to know how to implement it.
The address length of 14 bits, and an instruction lengths ranging from 1 to 3 bytes.
I've been resear... |
How are processor instructions stored in RAM? |
|memory-management|cpu|memory-access|instruction-set| |
null |
The question is basically the title. If two NP-Complete problems reduce to each other, do we know that the reductions take equal amounts of time? What about space? Does this apply for all 'invertible' reductions? |
Assume we know that (1) $A$ reduces to $B$ in time $O(f(n))$ time and (2) $B$ reduces to $A$. What can we say about the time for $B$ -> $A$? |
|turing-machines|np-complete|reductions| |
I don't think you'll find a positive answer, since it would imply $\mathsf{P} \neq \mathsf{NP}$.
Indeed, assume that that $\mathsf{P}=\mathsf{NP}$. This means that all problems within $P$, except for $\emptyset$ and $\Sigma^*$, are $\mathsf{NP}$-complete and reduce to each other.
Consider now a finite language $... |
I don't think you'll find a positive answer, since it would imply $\mathsf{P} \neq \mathsf{NP}$.
Indeed you can show that $\mathsf{P}=\mathsf{NP}$ implies that the answer is "no" (and hence you have the contrapositive implication).
If $\mathsf{P}=\mathsf{NP}$ then all problems within $P$, except for $\emptyset$ an... |
null |
I am studying graph algorithms, and I know that in algorithm theory there has to be an invariant of sorts that stays the same during the algorithm run that makes the algorithm valid and right to use. But I can't seem to find the invariant in Kosaraju's algorithm for finding strongly connected components. What is it tha... |
Invariant in Kosaraju's algorithm for SCCs |
|algorithms|graphs|graph-traversal| |
The property you speak of is indeed true.
Denote $E = \{e_1, e_2, …, e_{k-1}\}$ and $F = \{f_1, f_2, …, f_k\}$.
I will prove that there exists $f\in F\setminus E$ such that $(V, E\cup\{f\})$ is acyclic. That would mean that $w(e_k) \leqslant w(f) \leqslant w(f_k)$.
Suppose that $(V, E\cup\{f\})$ contains a cyc... |
I think that there are several invariant, but the one that seems most important is the following:
« for any edge $(u, v)\in E$, if the SCC of $u$ has been visited, then the SCC of $v$ has been visited »
That means that you are visiting SCC's from sinks to sources. |
I have a list of companies with _n_ timeslots (number of slots may vary from company to company) and a list of students. Each student made a list of their top 3 companies they would like to talk to.
Is there an algorithm to efficiently match those students to timeslots, taking the student's preferences into consider... |
Matching students with companies based on preference |
|algorithms|graphs|matching|bipartite-matching| |
Matching students with companies based on their preference |
I have a list of companies with _n_ timeslots (number of slots may vary from company to company) and a list of students. Each student made a list of their top 3 companies they would like to talk to.
Is there an algorithm to efficiently match those students to timeslots, taking the student's preferences into account?... |
This is a bit of a theoretical question. I would like to know how to call the principle described below, in proper computer science terms, or math terms.
Let's say we have a database in which one entity is split into two tables: main and meta. The main table is a matrix where rows are instances (for instance each ro... |
Way to call and explain: "potentially infinite set of attributes" in databases |
|data-structures|sets|database-theory| |
On a **turing machine** and in the **lambda calculus** one can define transcendental numbers such as Pi, the golden ratio, etc.
These are computatible functions with 0-arity that never terminate.
In the theory of **general recursive functions** (which also defines the same class of functions as **turing machines** an... |
How does one define transcendental numbers (such as Pi) in theory of general recursive functions |
|turing-machines|computability|lambda-calculus|generating-functions| |
If you are only interested in transcendental (or at least only irrational) numbers, you can safely identify the number $x$ with the function $d_x : \mathbb{N} \to \mathbb{N}$ that on input $n$ outputs the $n$-th digit of the decimal expansion of $x$.
If you want all real numbers, that does not lead to a satisfactory... |
An [undecidable problem](https://en.wikipedia.org/wiki/Undecidable_problem) is a decision problem proven to be impossible to construct an algorithm that always leads to a correct yes-or-no answer. I wonder if there are examples of probabilistic approaches (in the following sense below) that solve such problems.
**By... |
Probabilistic methods for undecidable problem |
|complexity-theory|undecidability|nondeterminism|probabilistic-algorithms| |
The halting problem is **semi-decidable**.
Does that mean that:
- If a program *terminates* it can always be established/determined?
- If a program does *not terminate*
- It can sometimes be established/determined?
- It can sometimes not be established/determined?
When we write programs we can cle... |
Consequences of the Halting Problem |
|turing-machines|halting-problem|nondeterminism|semi-decidability|termination| |
I'm confused as to why the MIPS designers would include 5 bits dedicated to shifting and have separate opcode and function bits.
Because MIPS is so RISC I assume that only shifting would be done in a few instructions, so those 5 bits seem like they're wasting space when they could be put in the immediate. I assume ... |
null |
What do you mean by randomness on *nondeterministic* TM? I think such a NTM with correct probability $\geq 2/3$ should be in PH by Sipser-Lautemann, and with probability 50% it's like something related with #P and NP (maybe $\sf \#P^{NP}$?). I guess it cannot solve undecidable problems since nondeterminism and randomne... |
I think you are right.
If a program terminates, it can always be determined by running the universal TM to simulate the program trivially.
If a program does not terminate, it can be determined sometimes by recognizing some special structures like infinite loop; or cannot be determined when the input is something in... |
null |
One approach is to model this as a [weighted bipartite matching](https://en.wikipedia.org/wiki/Assignment_problem) problem, also known as the assignment problem. This is appropriate if the objective function you're trying to maximize is the sum of "goodness scores" associated with each timeslot that gets filled.
An... |
null |
So, we have a TM $M$ that can in addition flip a fair coin. We have the promise that for every input $M$ will eventually halt and give an answer, no matter what the coin results are. Moreover, we demand that the probability of getting the correct answer is greater than 0.5.
First let us observe that because $2^\omeg... |
The idea is to maintain a list of small elements as well as a list of other elements that may or may not be small. Most of time, we just pop an element from the list of small elements or append a new element to the list of other element. Once in a while, we will replace the elements in the list of small elements by the... |
null |
null |
Non-computer scientist here, trying to understand what SICP (_Structure and Interpretation of Computer Programs_) means by a ***procedure***, if it matches the dictionary definition, and also how a procedure relates to an algorithm (so maybe I should ask separate questions).
First, SICP defines a _process_:
>We a... |
What is a procedure? |
|algorithms|computer-architecture|definitions|instruction-set| |
Non-computer scientist here, trying to understand what SICP (_Structure and Interpretation of Computer Programs_) means by a ***procedure***, if it matches the dictionary definition, and also how a procedure relates to an algorithm (so maybe I should ask separate questions).
First, SICP defines a _process_:
>We a... |
[Co-operative Education | University of Waterloo](https://uwaterloo.ca/co-operative-education/about-co-op) pioneered this kind of thing in the 1960s.
I (and thousands of other students) were paired with all of our top-10 choices for interviews, I don't remember anyone having problems with it, and that was 50 years a... |
The most concrete concept mentioned in that definition is _a program_, which is created (notice: not usually written) by a programmer.
I _say not usually written_ because programs are usually written in high-level programming languages and then at some point translated into machine code instructions (often taking in... |
The most concrete concept mentioned in that definition is _a program_, which is created (notice: not usually written) by a programmer.
I _say not usually written_ because programs are usually written in high-level programming languages and then at some point translated into machine code instructions (often taking in... |
The most concrete concept mentioned in that definition is _a program_, which is created (notice: not usually written) by a programmer. Okay, maybe a programmer is a more concrete concept, but I digress.
I _say not usually written_ because programs are usually written in high-level programming languages and then at s... |
The most concrete concept mentioned in that definition is _a program_, which is created (notice: not usually written) by a programmer. Okay, maybe a programmer is a more concrete concept, but I digress.
I _say not usually written_ because programs are usually written in high-level programming languages and then at s... |
The most concrete concept mentioned in that definition is _a program_, which is created (notice: not usually written) by a programmer. Okay, maybe a programmer is a more concrete concept, but I digress.
I _say not usually written_ because programs are usually written in high-level programming languages and then at s... |
A lot of this comes down to specific semantics. There are some core ideas that are switched around depending mostly on the language, I'll share the version that I'm used to and how they're different in different languages.
- A **program** is a complete list of instructions detailing receiving input, processing it, a... |
null |
The accepted greedy solution doesn't work.
I don't think there is a greedy algorithm. There is a counterexample to the other solution, where they use the heuristic of adding the largest positive interval starting at the current positive integer.
Consider the counterexample:
```
[1, -10, 10, -8, 3, -6, 4, -10,... |
The basic idea is to maintain a list of small elements all elements in which are guaranteed to be lower than median. Also maintain a list of all other elements, which will accept all new elements.
A call to `extra_lowerthan_median` will be popping an element from the list of small elements most of the time. A call ... |
I wonder if there are "standard" models of computation that are less powerful than DFA that are still "mathematically interesting"? It is evident that restricting the set of DFAs in various conceivable ways easily yields examples, but would any of those generate considerably interesting mathematical questions? |
Models of computation less powerful than DFA |
|finite-automata|computation-models| |
One possible approach is to train a model that is guaranteed, by the design of its architecture, to represent a submodular function. The following research paper looks like it might be helpful for that:
[Deep submodular functions: Definitions and learning](https://proceedings.neurips.cc/paper/2016/file/7fea637fd6d0... |
You might be interested in [branching programs](https://en.wikipedia.org/wiki/NC_%28complexity%29#Barrington's_theorem), e.g., branching programs of bounded width (say, width 3, or width 5) and bounded length (say, linear length).
You might be interested in [probabilistically checkable proofs](https://en.wikipedia.o... |
In order to show that Lambda calculus and Turing machines are equivalent it is sufficient to show that you can simulate one in the other [both ways].
We can observe it in action. Can one do the same on general recursive functions [ie mathematical functions as defined by Godel]
Are there any reference reading ma... |
John's answer is probably correct, but I just wanted to present a simple version that demonstrates the idea (in particular, I ignore the cases when $n$ is small or when $4$ doesn't divide $n$; you can figure them out):
Let A be the original array
while true:
n := len(A)
Small := n/4 smalle... |
The basic idea is to maintain a list of small elements that are guaranteed to be lower than median. Also maintain a list of all other elements, which will accept all new elements.
A call to `extract_lowerthan_median` will be popping an element from the list of small elements most of the time. A call to `insert` wil... |
John's answer is probably correct, but I just want to present a simple version that demonstrates the idea (in particular, I ignore the cases when $n$ is small, when there are duplicates, or when $4$ doesn't divide $n$; you can figure them out):
Let A be the initial array
while true:
n := A.length
... |
#### The idea, amassing many elements significantly lower than median at once
The basic idea is to maintain a list of small elements that are guaranteed to be lower than median. Also maintain a list of all other elements, which will accept all new elements.
A call to `extract_lowerthan_median` will be popping an... |
The Halting Problem is semi-decidable, also called recognizable, and that means there is a Turing Machine $H$ that will, given a Turing Machine $M$ as input, accept $\langle M, s\rangle$ if and only if it halts in finite time on bounded input $s$ and otherwise will reject or fail to halt itself. This means, in a certai... |
Your "potentially infinite" (I would say: finite but unbounded) list of properties is known, depending on the programming language, as an *association list, property list, dictionary, associative array*, or *hash*. No doubt other terms are in use as well; I haven't used more than some 20-30 different languages. In math... |
Given a known strongly NP Complete problem $A$. If there is a polynomial time transformation from $A$ to another problem NP Complete problem $B$ does that imply anything about if $B$ is always/automatically strongly NP complete or not?
I don't think that it is necessary that $B$ is always/automatically strongly NP C... |
A query regarding Strongly NP Complete problem reduction/definition |
|np-complete| |
|complexity-theory|np-complete| |
The halting problem is **semi-decidable**, which means that if a program terminates then it will always be able to be determined.
Some programs can be proven to terminate without running them, with say:
- induction
- typed theories, such as typed lambda calculus.
Are there some programs for which there ... |
Are there some programs for which the only proof of termination, is running of the program, and waiting to see if it stops, no matter how long? |
|turing-machines|computability|halting-problem|semi-decidability| |
The halting problem is **semi-decidable**, which means that if a program terminates then it will always be able to be determined.
Some programs can be proven to terminate without running them, with say:
- induction
- typed theories, such as typed lambda calculus.
Are there some programs for which there ... |
Take any strongly NP Complete problem for A and any NP Complete B for which we know a pseudo-polynomial time algorithm. Is there a poly-time reduction from A to B? (remember that B is NPC)
That should answer your question. |
Non-computer scientist here, trying to understand what SICP (_Structure and Interpretation of Computer Programs_) means by a ***procedure***, whether it matches the dictionary definition, and also how a procedure relates to an algorithm (so maybe I should ask separate questions).
First, SICP defines a _process_:
... |
The most concrete concept mentioned in that definition is _a program_, which is created (notice: not usually written) by a programmer. Okay, maybe a programmer is a more concrete concept, but I digress.
I _say not usually written_ because programs are usually written in high-level programming languages and then at s... |
"Are there some programs for which there is no other proof system except for the computation itself, where no properties of the program is know in advanced?" No. For a Turing machine T and input X such that T(X) halts, there is a formal system consisting of the axiom "T(X) halts" that proves T(X) halts. While that seem... |
#### The idea, amassing many elements significantly lower than median at once
The basic idea is to maintain a list of small elements that are guaranteed to be lower than median. Also maintain a list of all other elements that may or may not be lower than median, which will accept all new elements.
A call to `ext... |
I have consulted the literature concerning graph isomorphism algorithms, and all papers I could find involve finding a *canonical representation* of a graph. So to decide whether two graphs are isomorphic, you just check if they have the same canonical representation (i.e. the same equivalence class).
There is, also... |
Constructive Graph Isomorphism Algorithm Literature |
|graphs|graph-isomorphism| |
I found a one question I wonder, but there is something to be clear about.
The link is <https://electronics.stackexchange.com/questions/56488/parallel-multiplication-hardware/56518#56518>
Q1. In his answer about the question, how can I make a 16 LSB bits by the time I get to the input of the fifth tier.
I thin... |
Understanding the faster multiplication hardware in riscv |
|computer-architecture|parallel-computing|multiplication| |
Almost every programming language has a way to specify sequences of instructions that can be reused (or used once). But programming languages don't agree on what these are called. Sometimes they are called procedures, or functions, or routines, or subroutines. I'm not aware of any languages which call them algorithms.
... |
The halting problem is **semi-decidable**, which means that if a program terminates then it will always be able to be determined.
Some programs can be proven to terminate without running them, with say:
- induction
- typed theories, such as typed lambda calculus.
- Ackermann function
Are there some p... |
Since for all programs with a set of possible inputs which is countably infinite [except 0-arry functions i.e. constant functions], it would not be possible even to run the program until it terminates for all inputs.
Therefor it would not even be possible to prove termination by simply running the program until it t... |
Some processors - generally, 32-bit RISC ones - make sure that all instructions fit in one location in memory. This works for them because 32 bits is enough to fit plenty of instructions, and it makes it easy for the processor to load instructions. All the instruction operands are included as part of the instruction. T... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.