instruction
stringlengths
0
29.8k
⌀
I got confused while solving the following problem... ###Question## A *d*-ary heap is like a binary heap, but(with one possible exception) non-leaf nodes have *d* children instead of 2 children. 1. How would you represent a *d*-ary heap in an array? 2. What is the height of a *d*-ary heap of *n* elements in...
null
1. Your solution is valid and follows definition of *d*-ary heap. But as you pointed out your notation is a bit sophisticated. You might use those two following functions to retrieve parent of *i*-th element and *j*-th child of *i*-th element. $\text{d-ary-parent}({\it i}) \\ \ \ \ \ {\bf return}\ \lfloor (i...
null
Here's a pair **monotonic** functions that are not asymptotically comparable. This is relevant because most complexities arising in practice are in fact monotonic. $$ f(x) = \Gamma( \lfloor x \rfloor + 1 ) = \lfloor x \rfloor ! $$ $$ g(x) = \Gamma( \lfloor x-1/2 \rfloor + 3/2 ) $$ Here, $ \Gamma $ is the [gamma ...
null
As the title suggests. Also, such a language must satisfy that neither it nor its complement are semi-decidable. I already know that $All_{TM}, EQ_{TM}, T$ (that is the set of all deciders) satisfy this property. But I tried reducing these to their complements directly, and via some sort of intermediate language, but t...
Find an undecidable language that is mapping-reducible to its complement
|computability|reductions|
Try the following construction. Given a language $L$, use $$ \{0x : x \notin L\} \cup \{1x : x \in L\}. $$
Let $\mathcal{L}$ be the class of functions obtained from the identity function and constants using the following operations: addition, subtraction, multiplication, division, logarithm and exponential. For example, $\exp(2\sqrt{\log x + \log\log x})/x^2$. Hardy proved that for every two functions $f,g \in \mathcal{L}$ ...
I have to design an NFA that will take the string "token" with or without quotes. I mean, use lambda or " to the first state, but then how do I know on the final state if it should have end quotes or not?
How to make NFA surrounded by quotes
|finite-automata|
null
Your question about problems that are in NP, not in P, but not NP-complete follows from a result called *Ladner's theorem.* No problems in NP are known to not be in P, since their existence proves that P ≠ NP, and that question is currently open. Next, it is true that if there is a polynomial-time algorithm for ...
|automata|finite-automata|
NFAs have finite "memory", and you need to store one bit of information: whether the first symbol was `"`. >! Copy the automaton for tokens. If your string starts with `"`, move to one copy; if not, to the other. The first copy then requires a trailing `"` to accept, the second one does not. >! >! In general, ...
I have to design an NFA that will take the strings `"token"` and `token`. I can use $\lambda$ or `"` to the first state, but then how do I know on the final state if it should have end quotes or not?
How to make NFA remember its first step?
|asymptotics|mathematical-analysis|landau-notation|
Consider a fixed point representation which can be regarded as a degenerate case of a floating number. It is entirely possible to use 2's complement for negative numbers. But why is a sign bit necessary for floating point numbers, shouldn't mantissa bits be using 2's complements? Also why do the exponent bits use a ...
Why floating point representation uses a sign bit instead of 2's complement to indicate negative numbers
> But why is a sign bit necessary for floating point numbers False assumption. It isn't necessary. I'm pretty sure I've met floating point formats which used 2's complement for the mantissa, but I'd have to dig out for names. I'm far from being a specialist in numerical analysis, but I get that having signed zero...
i was going through the wiki definition of Context Sensitive Language and i found this out "Each category of languages is a proper subset of the category directly above it. Any automaton and any grammar in each category has an equivalent automaton or grammar in the category directly above it." I could see that ...
Are all Context Sensitive Language's decidable?
|context-sensitive|
|formal-grammars|turing-machines|undecidability|context-sensitive|
null
I was going through the [Wikipedia definition of *context-sensitive language*](http://en.wikipedia.org/wiki/Context-sensitive_language) and I found this: > Each category of languages is a proper subset of the category directly above it. Any automaton and any grammar in each category has an equivalent automaton or g...
Are all context-sensitive languages decidable?
First, all context-sensitive languages are decidable, since they can be accepted by a LBA (as you said), and a Turing machine is more powerful than a LBA. However, you were asking about something else. Can there be LBA that cycles? The answer is yes. You gave an example. However, you can modify every LBA $M$ to a T...
I would say you should consider a number of factors first. It depends on $I$ length and $R_s$ (sensing range of sensors) - because if $\cup _{s \in S} R_s < I$ - then it there is no way to cover each point. It also depends on the initial configuration of the sensors. Assume that they are all at one endpoint of t...
{"Voters":[{"Id":867,"DisplayName":"AJed"}]}
Recall, how [*expected value*](http://mathworld.wolfram.com/ExpectationValue.html) is defined. You count the for every element $X$ in the tree the number of comparisons it takes to locate it, say $C(X)$. Then $$E[\text{# of comparisons}]=\sum_{X\in\{A,\ldots,H\}} p_X \cdot C(X),$$ where $p_x$ denotes the probability ...
null
null
What you can do is the following. Suppose you NEA $N$ that accepts all ``token`` is the tuple $(Q,\Sigma,\delta,q_0,F)$. You build a new NEA $N'$ where you introduce for every state $q\in Q$ a copy. This can be encoded by defining as new state space as $Q':=Q\times\{\text{orig},\text{copy}\}$. We interpret the new s...
maybe this is a simple reduction for the most in this website but i have some trouble to get this reduction but i will to reduce the subset sum problem (NP-Complete) to a partition problem (NP-Complete) but at this time i don't see the relation! Thanks you! if you don't understand write for clarification!
How can i reduce a Subset sum Problem to a partition problem?
|complexity-theory|np-complete|reductions|
null
Maybe this is a simple, but I have some trouble to get this reduction. I want to reduce [Subset Sum](http://en.wikipedia.org/wiki/Subset_sum_problem) to [Partition](http://en.wikipedia.org/wiki/Partition_problem) but at this time I don't see the relation! If you don't understand write for clarification!
How can I reduce Subset Sum to Partition?
Maybe this is quite simple but I have some trouble to get this reduction. I want to reduce [Subset Sum](http://en.wikipedia.org/wiki/Subset_sum_problem) to [Partition](http://en.wikipedia.org/wiki/Partition_problem) but at this time I don't see the relation! Is it possible to reduce this problem using a Levin Reduc...
I may be wrong about this: I am also not very knowledgeable in this field (where are the experts!?), but I believe I have a reasonably fast algorithm for what you are asking. I am going to suppose, for simplicity, that all the roots are real. Find an interval bound on the root of $P$ with highest absolute value (i.e...
null
Let $(L,B)$ be an instance of subset sum, where $L$ is a list (multiset) of numbers, and $B$ is the target sum. Let $S = \sum L$. Let $L'$ be the list formed by adding $S+B,2S-B$ to $L$. (1) If there is a sublist $M \subseteq L$ summing to $B$, then $L'$ can be partitioned into two equal parts: $M \cup \{ 2S-B \}$ a...
If $S_1,S_2$ are set of strings, then $S_1S_2 = \{s_1s_2|s_1\in S_1, s_2\in S_2\}$. $S^0=\{\epsilon\}$, $\epsilon$ is the empty string. $S^n = S^{n-1}S$. Two related problems about represent string as concatenation of other strings. 1. Given a set $S$ of strings, how to decide if there exist a string can be wri...
Represent string as concatinations
|algorithms|strings|
Given an adjacency matrix $A_G$ of an undirected graph $G$, it is easy and straightforward to compute the characteristic polynomial $\chi_G(\lambda)$. What about the other way around? That is, given $\chi_G(\lambda)$, what is an efficient algorithm to decide whether there is an $A_G$ corresponding to that particular $\...
What's a fast algorithm to decide whether there is an $A_G$ corresponding to a given $\chi_G(\lambda)$?
|algorithms|graphs|discrete-mathematics|matrices|
I got confused while solving the following problem... ###Question## A *d*-ary heap is like a binary heap, but(with one possible exception) non-leaf nodes have *d* children instead of 2 children. 1. How would you represent a *d*-ary heap in an array? 2. What is the height of a *d*-ary heap of *n* elements in...
i'm trying to work out a problem that can be summarized as follow: I have to prove some formula F, but i have got a lying witness that pretends there exists an assignment such that F evaluates to False. I start interrogating the witness asking to assign F. To force the witness to a contradiction means to ask him to ...
how do i formalize a winning strategy?
|complexity-theory|computability|np-complete|closure-properties|decision-problem|
null
I'm trying to work out a problem that can be summarized as follow: I have to prove some formula $F$, but I have a lying witness that pretends there exists an assignment such that $F$ evaluates to False. I start interrogating the witness asking to assign $F$. To force the witness to a contradiction means to ask h...
How do I formalize a winning strategy?
null
{"Voters":[{"Id":867,"DisplayName":"AJed"}]}
Just observations that do not fit on the comments: I made a little research, and here are what I found + some of my observations: 1) You can use exhaustive search to find whether a solution exist. [so it is decidable] 2) In case $\delta$ is not restricted, all you need to check is the sum of all ranges and compar...
Does there exist a procedure that determines if a polytime machine prints a certain string, and always does so in less time than the machine itself takes to run? Define a machine a that analyzes another machine b, input i, and string r: a(b,i,r) = true iff b(i) prints r [b(i) = O(n^k); k >= 2] Does the...
determine if a machine prints a certain string in less time than it takes to run the machine itself?
|complexity-theory|time-complexity|turing-machines|
Does there exist a procedure that determines if a polytime machine prints a certain string, and does so in less time than the machine itself takes to run? Define a machine a that analyzes another machine b, input i, and string r: a(b,i,r) = true iff b(i) prints r [b(i) = O(n^k); k >= 2] Is there an a w...
Does there exist a procedure that determines if a polytime machine prints a certain string, and does so in less time than the machine itself takes to run? Define a machine $a$ that analyzes another machine $b$, input $i$, and string $r$: $a(b,i,r) = b(i) \text{ prints } r$ $[b(i) = O(n^k), k >= 2]$ Is there an...
Represent string as concatenations
Does there exist a procedure that determines if a polytime machine prints a certain string, and does so in less time than the machine itself takes to run? Define a machine $a$ that analyzes another machine $b$, input $i$, and string $r$: $a(b,i,r) = b(i) \text{ prints } r$ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs...
Does there exist a procedure that determines if a polytime machine prints a certain string, and does so in less time than the machine itself takes to run? Define a machine $a$ that analyzes another machine $b$, input $i$, and string $r$: $a(b,i,r) = b(i) \text{ prints } r$ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs...
No **NP**-complete problems are known to be in **P**. If there is a polynomial-time algorithm for any **NP**-complete problem, then **P** = **NP**, because any problem in **NP** has a polynomial-time reduction to each **NP**-complete problem. (That's actually how "**NP**-complete" is defined.) And obviously, if ever...
null
I'm trying to work out a problem that can be summarized as follow: I have to prove some formula $F$, but I have a lying witness that pretends there exists an assignment such that $F$ evaluates to False. I start interrogating the witness asking to assign $F$. To force the witness to a contradiction means to ask h...
I have a truth table c(F1,…, Fn) and i want to find a contraddiction to a lying witness, by constructing a formulae F. I want to define the problem as a set that contains all formulae $F$ such that I have a winning strategy so that i bring the liar to contraddict himself. Furthermore, I will have to find the com...
I want to know how can i find number of cpu cores/processor supported given i have the MIPS value? For e.g I want to know the number of matching cores/processor to process speed of 18 triilion instructions / sec.
How to convert process / cpu core based upon MIPS?
|software-engineering|cpu-cache|image-processing|
Parallel processes interfere with each other in many ways, by competing for shared resources such as shared caches, memory, disks, etc. Would it be possible to determine latent factors just with a runtime analysis, by means of comparing the runtime of the respective applications while running them many times in diff...
Determine interference factors in parallel computing
|parallel-computing|cpu-cache|performance|
For a modern CPU there is no exact MIPS rating since it depends on the specific instruction stream, power saving mode, and other factors. As a reference number you may look at the [BogoMIPS](http://en.wikipedia.org/wiki/BogoMips) rating that is calculated by the Linux kernel. A desktop CPU core at 3GHz would have ab...
null
Automatic parallelization in the most general terms is extracting a dependency graph from the execution sequence of the program and executing distinct paths in this graph in parallel with synchronization introduced at the nodes of the graph where the paths merge. Our ability to extract the dependency information var...
[{"Id":98,"DisplayName":"Raphael"}]
[{"Id":98,"DisplayName":"Raphael"}]
> Let > > $$f(x)=\begin{cases} x \quad \text{if Goldbach's conjecture is true }\\ 0 \quad \text{otherwise}\end{cases}$$ > > Show that f(x) is primitive recursive. I know a primitive recursive function is obtained by composition or recursion, but I don't know what should I do about this problem.
How to show that f(x) is primitive recursive
|computability|recursion|
How to show that f(x) is primitive recursive?
Goldbach's conjecture is either true or false. Do a case analysis on the two possibilities. In one case, $f(x)=x$, which is primitive recursive. In the other case, $f(x)=0$, which is also primitive recursive. Therefore $f$ is primitive recursive.
{"Voters":[{"Id":268,"DisplayName":"Guy Coder"},{"Id":2205,"DisplayName":"A.Schulz"},{"Id":31,"DisplayName":"Dave Clarke"},{"Id":39,"DisplayName":"Gilles"}]}
Validity of predicate logic formulas
I have studied bfs, dfs and best first search, but i don't know when bfs is better than best first search. I know the same for bfs and dfs, but have no idea for comparison of best first search with bfs & dfs. So, my question is "When would best first search be worse than breadth first search ?" (bfs - breadth...
When would best first search be worse than breadth first search?
|graphs|artificial-intelligence|search-algorithms|