instruction
stringlengths
0
29.8k
⌀
File conversion to binary format to save storage space
|data-compression|binary|encoding-scheme|filesystems|storage|
Unfortunately, conversion to a binary format will barely yield compression by a factor 2. Because your decimal numbers currently occupy 7 bytes, while a float takes 4 bytes. You can discard all repeating strings, which are useless, and pack the 17 final 0/1 values to 3 bytes. The date/times can be encoded as integers o...
[![enter image description here][1]][1] [1]: https://i.stack.imgur.com/0nrqW.png I have multiple functions as shown in the image. For a fixed x value, I need to distribute it into f, g, and h functions for getting the maximum output (y). In other words, having a fixed x value, find a, b, and c in which these...
Maximum the result from multiple functions which share an input amount
|algorithms|optimization|
Your first statement is wrong: 3-SAT with at most 3 occurrences per variable is **not** NP-hard, in fact it is trivial in the sense that any instance of this problem is satisfiable (see [this paper][1]). [1]: http://cedric.cnam.fr/~bentzc/INITREC/Files/CB11.pdf
we say that a constructive axiom is an equality $axiom u = s$ : * whose left member $u$ is a pattern, * whose right member $s$ is any term whose variables are all appearing in $u$. and yet we say of $suc(i + j) = i + suc(j) $ is not constructive, Ok, and this $dump(push(e, s), t) = dump(e, push(s, t))$ is constru...
confusion with regard to constructive axiom
|formal-methods|software-verification|
For a given x, determine the largest among f(x), g(x), h(x), let f(x), and fully utilize this function (a = x, b = c = 0).
we say that a constructive axiom is an equality axiom $u = s$ : * whose left member $u$ is a pattern, * whose right member $s$ is any term whose variables are all appearing in $u$. and yet we say of $suc(i + j) = i + suc(j) $ is not constructive, Ok, and this $dump(push(e, s), t) = dump(e, push(s, t))$ is constru...
With the purpose of proving my problem NP-hard, I'd like to reduce from a SAT variant (which of course should remain NP-hard) in which not two parameters are present (typically $n$ clauses and $m$ variables) but only one, so $n$ clauses and $f(n)$ variables, for some function $f$. I've tried to look up 3-SAT (SAT w...
NP-hard (3-)SAT variant with $n$ clauses and $f(n)$ variables
As I have not enough reputation yet to comment I just wanted to point out @Yves Daoust's answer is wrong. See my answer on SO for a correct one https://stackoverflow.com/a/74139926/8923995. Otherwise, here is a counter example to the other answer : [![example][1]][1] Let f be the red function and g the green one....
General 3-SAT is reducible to 3-SAT with $n$ clauses and $3n$ variables, as more variables would mean one isn't even present in some clause and can be removed, which can be done linearly. Conversely it's also equivalent to 3-SAT with $m$ variables and $m(m+1)(m+1)/6$ clauses, as otherwise some clauses would be redun...
The first column (1591231.911710) seems to be the number of seconds since some specific time (about 18 days earlier). If you can preserve that time, " LoggingString := … 2021,02:38:57.0," becomes unnecessary, as it can be recalculated. The times in the first column could be reduced by subtracting the previous...
For the purpose of this post, let $k$-SAT be SAT with exactly $k$ literals per clause, as opposed to the more common meaning of at most $k$ literals per clause. With the purpose of proving some problem NP-hard, I'd like to reduce from a $k$-SAT variant (which of course should remain NP-hard) in which each variable o...
NP-hard $k$-SAT variant with exactly $\ell$ occurrences per variable
|reductions|np-hard|satisfiability|3-sat|
For example (and this is not my use case), imagine there is a set of 50 000 random natural numbers represented in decimal with 8 digits (in the range 00 000 000 to 99 999 999). We could index the list with an index for each digit position. Imagine we wanted to know what numbers are in the list with at most 2 digits dif...
How to index a table for fast intersection?
|data-structures|database-theory|
Bloom's filter has a high false positive rate because it only detects whether an element is in the set or not, without providing any information about the position of the element. However, despite its high false positive rate, Bloom's filter can be very useful in certain situations. For example, if you only need to ...
null
On the one hand it does not belong to NP problems because it simply is not solvable and is undecidable and on the other hand it is an NP problem because there are claims that it is NP-hard and therefore can be reduced to NP and is an NP problem. My question, does the halting problem belong to NP?
Does the halting problem belong to NP class of problems?
|computability|np-hard|np|decision-problem|halting-problem|
"NP" means: We could solve this problem in polynomial when the answer is "Yes" and we are given a hint how to solve it. Every problem in NP can be solved (in a very very very long time) by trying all possible hints. But that's not the case here. It is undecidable. No hint would allow you to prove that the answer is "Ye...
The binary expansion of a given real number can be encoded as an amplitude using the inverse QPE. Together with Amplitude Amplification, I wonder if this could indicate that the (some weakened?) trichotomy of the real numbers is physically effective.
Does quantum computing imply LPO?
|logic|quantum-computing|
The problem of deciding the satisfiability of 3CNFs in which each variable occurs exactly 5 times is NP-complete (and even NP-hard to approximate), see Uriel Feige, [A threshold of $\ln n$ for approximating Set Cover](https://courses.cs.duke.edu/spring07/cps296.2/papers/p634-feige.pdf).
No, this is not possible. It is known that Turing machines can simulate quantum machines (albeit very inefficiently). If there were a quantum machine that realized LPO then we could simulate it on a Turing machine – but a Turing machine cannot realize LPO, because doing so would give us the Halting Oracle.
null
I'm trying to randomly allocate N indistinguishable items over B indistinguishable bins with unlimited capacity. Each allocation should occur equal probability. At first, I thought that I could successively pick a random bin for each item. But this has two problems: 1. Even though the bins are indistinguishable,...
I'm trying to randomly allocate N indistinguishable items over B indistinguishable bins with unlimited capacity. Each allocation should occur with equal probability. An allocation identifies the number of balls in each bin, and two allocations are equivalent if you can obtain one by permuting the other. At first, I...
You haven't listed any constraints on the amount of space used, so a simple solution is to build ${8 \choose 2} = 28$ indices. Each index lets you find whether a number is in the set, based on the value of 6 of the 8 digits. Each index could be stored as a hashtable, that given a 6-digit number (the value of the digi...
{"Voters":[{"Id":755,"DisplayName":"D.W."}],"SiteSpecificCloseReasonIds":[]}
The binary expansion of a given real number can be encoded as an amplitude using the inverse QPE. Together with Amplitude Amplification, I wonder if this could indicate that the (some weakened?) trichotomy of the real numbers is physically effective. --- UPDATE: I think the crux of the question is that these assu...
null
The binary expansion of a given real number can be encoded as an amplitude using the inverse QPE. Together with Amplitude Amplification, I wonder if this could indicate that the (some weakened?) trichotomy of the real numbers is physically effective. --- I think the crux of the question is that these assumptions ...
The name that I normally use for this is "Hamming distance search". So... 50,000 numbers isn't that many, and probably the simplest solution is to store them in a trie. Hamming distance search on a trie is extremely easy: you conceptually traverse all paths in the trie, pruning when the Hamming distance between the ...
null
What is the asymptotic relationship between $\frac{1}{n}$ and $\frac{1}{2^n}$? The answer [here][1] mentions that both functions are $O(1)$ (because they are always $\leq 1$) but not $\Omega(1)$ (because the functions will not be always greater than any constant $c>0$, as both are eventually 0). Thinking of it us...
Asymptotic Relationship between 1/n and 1/2^n
|asymptotics|big-o-notation|
I am trying to recognize a particular language, L= {a^n b^k | n<=k<=2n} and according to me it should not be CFL, as i can see two comparision i.e. firstly number of a is compare to keep count less than equal to k, and secondly for count of b that should be less than twice n. My question then how it is still CF...
Context Free Language Twist
|context-free|pushdown-automata|
You are right in concluding it is $O(1)$ and not $\Omega(1)$ (talking purely about functions). However saying its $O(1)$ because they are always $\leq 1$ is slightly incorrect as it can be seen from the graph below. Since these functions are in the denominator they would approach $0$ very fast. In asymptotic analysis, ...
{"OriginalQuestionIds":[132940],"Voters":[{"Id":755,"DisplayName":"D.W."}]}
If you're using grammars, then this is easy to see: $$S\to aSb\mid aSbb\mid \epsilon$$ That is, each $a$ corresponds to either 1 or 2 $b$'s. If you're thinking about it from the automata perspective, then a PDA can push to the stack $n$ symbols while reading $a^n$, and then start popping those symbols upon reading...
null
You are right in concluding it is $O(1)$ and not $\Omega(1)$ (talking purely about functions). However saying its $O(1)$ because they are always $\leq 1$ is slightly incorrect as it can be seen from the graph below. Since these functions are in the denominator they would approach $0$ very fast. In asymptotic analysis, ...
You are right in concluding it is $O(1)$ and not $\Omega(1)$ (talking purely about functions). However saying its $O(1)$ because they are always $\leq 1$ is slightly incorrect as it can be seen from the graph below. Since these functions are in the denominator they would approach $0$ very fast. In asymptotic analysis, ...
With 8 digits you can probably use a 8-dimensional index where you assign one digit to every dimension. You also need a custom distance function. Let's assume you want all numbers with 3 differing digits. On the 8-dimensional index you can perform a nearest neighbor search. This will first return numbers with one...
null
[![enter image description here][1]][1]we say that a constructive axiom is an equality axiom $u = s$ : * whose left member $u$ is a pattern, * whose right member $s$ is any term whose variables are all appearing in $u$. and yet we say of $suc(i + j) = i + suc(j) $ is not constructive, Ok, and this $dump(push(e, s...
"NP" means: We could solve this problem in polynomial when the answer is "Yes" and we are given a hint how to solve it. Every problem in NP can be solved (in a very very very long time) by trying all possible hints. But that's not the case here. It is undecidable. No hint would allow you to prove that the answer is "Ye...
[![enter image description here][1]][1][![enter image description here][2]][2]we say that a constructive axiom is an equality axiom $u = s$ : * whose left member $u$ is a pattern, * whose right member $s$ is any term whose variables are all appearing in $u$. and yet we say of $suc(i + j) = i + suc(j) $ is not cons...
In "Introduction to Algorithms" by Cormen et al. the *Potential Method* is explained. For example, we have the following representation for the amortized cost of the i-th operation with respect to the potential function $\Phi$: $$\hat{c_i} = c_i + \Phi(D_i) - \Phi(D_{i-1})$$ The book also states that for each $i ...
What are the actual costs $c_i$ in the potential method?
|runtime-analysis|amortized-analysis|
In "Introduction to Algorithms" by Cormen et al. the *Potential Method* is explained. For example, we have the following representation for the amortized costs of the i-th operation with respect to the potential function $\Phi$: $$\hat{c_i} = c_i + \Phi(D_i) - \Phi(D_{i-1})$$ The book also states that for each $i...
null
Given a sentence like this, and i have the data structure (dictionary of lists): `{'cat': ['feline', 'kitten']}` A feline was recently spotted in the neighborhood protecting her little kitten How would I efficiently process these set of text to convert the word synonyms of the word cat to ...
Best Data Structure For Text Processing
|algorithms|data-structures|strings|
## Introduction ## This is a heavily updated question I have asked on this forum previously. I have understood and corrected the earlier errors and mistakes I made, and after doing that it still seems I have a problem. I would also like to state that I am not looking for a different proof of the halting problem, and...
Halting problem logic issues
|turing-machines|proof-techniques|halting-problem|
I'd like to know how a computer can determine the beginning and end of certain file components (attributes, headers, frame/packet/segment headers etc.) when these components can be omitted or added in optionally, *on top of being of variable length*, and how it can even recognise files and protocol packets within an oc...
How can computers tell where the beginning and end of file/packet/frame headers are?
|memory-hardware|memory-access|communication-protocols|filesystems|storage|
Halting problem disproof
The value of $c_i$ is the runtime cost of an operation. Understand that in doing analysis you can simplify the assignment of runtime cost by focusing only on important aspects. As for your stack example, they might have simplied things and assume that the cost of a push/pop is based on the number of elements processed,...
null
None of the guidelines are *generally* valid in the sense of providing strong guidance in the absence of other considerations. Presumably the intent of the exercise was to recognize that increasing block size is a crude form of prefetching which tends to reduce the number of misses at the cost of wasting memory band...
If you click on [the link you provided](https://en.wikipedia.org/wiki/Ethernet_frame#Structure) you'll see that the word 802.1Q is itself [a link](https://en.wikipedia.org/wiki/IEEE_802.1Q) and when you read that page you'll see that the field uses a special value, a magic number if you like for the first 16 bits. >...
null
For example (and this is not my use case), imagine there is a set of 50 000 random natural numbers represented in decimal with 8 digits (in the range 00 000 000 to 99 999 999). We could index the set with an index for each digit position (i.e. an array of pointers to all numbers ordered by their fist digit, another one...
For example (and this is not my use case), imagine there is a set of 50 000 random natural numbers represented in decimal with 8 digits (in the range 00 000 000 to 99 999 999). We could index the set with an index for each digit position (i.e. an array of pointers to all numbers ordered by their fist digit, another one...
I see that you've edited the question to ask about a more general case. There are two techniques worth knowing about: nearest neighbor search with the Hamming distance, and [locality sensitive hashing](https://en.wikipedia.org/wiki/Locality-sensitive_hashing). A locality-sensitive hash $H$ is one where, if $x,y$ ar...
You can't. At least not always. That's not a well-defined mapping. The notion of synonyms is subjective and a word might have many synonyms it can be mapped into. Even humans can't do that task (they won't always agree what the sentence should be mapped to), so it's not reasonable to expect computers to do it, eith...
> the original disproof seems not to care what the function $h(f,x)$ or the condition it evaluates to (Halt or no) actually is This statement looks to me like a misunderstanding. The original proof does "care": see the statement "Assume there exists a function $h(f,x)$, which returns $True$ iff $f(x)$ halts.". >...
> the original disproof seems not to care what the function $h(f,x)$ or the condition it evaluates to (Halt or no) actually is This statement looks to me like a misunderstanding. The original proof does "care": see the statement "Assume there exists a function $h(f,x)$, which returns $True$ iff $f(x)$ halts.". >...
## Introduction ## This is a heavily updated question I have asked on this forum previously. I have understood and corrected the earlier errors and mistakes I made, and after doing that it still seems I have a problem. I would also like to state that I am not looking for a different proof of the halting problem, and...
Your data structure is quite inappropriate to turn the first sentence into the second. Because you would have to look-up the entire dictionary in search of "feline". And if, hoping to fix, you would like to replace cat (rather than feline) by a synonym, you don't really know which to choose.
null
Suppose we have an undirected, connected graph $G$ where vertices have positive integer weights. Let $\bar{v}$ be a vertex in $G$. Take a spanning tree $T$ of $G$ rooted at $\bar{v}$ and define its cost as the maximum total weight among all proper subtrees. (Since weights are positive the proper subtree(s) with maximum...
Minimize max subtree weight among spanning trees
|algorithms|graphs|optimization|weighted-graphs|
> the original disproof seems not to care what the function $h(f,x)$ or the condition it evaluates to (Halt or no) actually is This statement looks to me like a misunderstanding. The original proof does "care": see the statement "Assume there exists a function $h(f,x)$, which returns $True$ iff $f(x)$ halts.". >...
Suppose we have an undirected, connected graph $G$ where vertices have positive integer weights. Let $\bar{v}$ be a vertex in $G$. Take a spanning tree $T$ of $G$ rooted at $\bar{v}$ and define its cost as the maximum total weight among all proper subtrees. (Since weights are positive the proper subtree(s) with maximum...
There must be a complexity class C that includes exactly the problems that can be solved in exponential time and having access to a truly random coin (which in turns implies that you will be able to use an exponential number of random bits). I searched for a class like like this in the Complexity Zoo but I only found P...
Given a complexity class C for problems which can be solved using exponential time and an exponential number of random bits. C ⊆ NEXP?
|complexity-theory|complexity-classes|randomized-algorithms|nondeterminism|randomness|
I was shown these diagrams in the context of search algorithms. The green tile shows the initial state, and the orange tile shows the goal state. I am told that each option shows a path each search method would take to reach the goal state. This one is apparently breadth-first search: [![enter image description ...
How do these search algorithm diagrams work? How am I supposed to interpret them? And what algorithms do those last three represent?