instruction stringlengths 35 11.4k |
|---|
We know that 0-1 integer linear programming is NP-Hard. What about 0-1 integer linear programming with only equality constraints? If so, how to prove it
$$\min c^T x \text{ s.t. } Ax = b \quad x_i \in \{0,1\}\quad (i=1,2,...,n)$$
|
The theorem says: If $R(x,y)$ is a recursive relation, then there exists $y\leq2$ such that $R(x,y)$ is recursive.
Here is my attempt of proof:
Since $R(x,y)$ is recursive, we can construct a partial recursive function $f:\mathbb{N}^2\rightarrow\mathbb{N}$ be such that $f(x,y)=1$ if $(x,y)\in R$ and $f(x,y)=0$ if $(x,... |
Here's a naïve algorithm that computes $ \binom{n}k $ (or "n choose k"), with either $k=0$ or $1\le k \le n$:
def coefficient(n, k):
if k == 0 or k == n:
return 1
return coefficient(n-1, k-1) + coefficient(n-1, k)
Now the time complexity has to be bounded by $2^n$, however we have to take $k$ into acco... |
Eigenvector centrality can be calculated for graphs with non-negative weights for the edges. Is there any version of it which can be used for graphs with negative weights?
|
Following question was asked in a online hackathon that has been concluded.
Given arrays $A_1,\ldots,A_n$ of length $\ell_1,\ldots,\ell_n$, we want to find cyclically rotate each array in a way which maximizes $$ \sum_{i=1}^{n-1} i|A_i[\ell_i] - A_{i+1}[1]|. $$
For example, on input $2,3,1 \mid 3,2 \mid 4,5$ the best ... |
Black box of $f(x)$ means I can evaluate the polynomial $f(x)$ at any point.
Input: A black box of monic polynomial $f(x) \in\mathbb{Z}^+[x]$ of degree $d$.
Output: The $d$ coefficients of polynomial $f(x)$.
My algorithm: let
$$f(x) = x^{d} + a_{d-1} x^{d-1} + \cdots + a_1 x + a_0$$
Evaluate polynomial $\mathcal{f(x... |
I want to compute the median in an array of size $m$ which consists of distinct integers from $\{0, 1, ..., n-1\}$, I have $m<n$. By median I mean the middle element (rounding up/down if the array size is even) in the sorted version of the array.
Ideally, the expected number of passes over the array should be $\mathcal... |
I did some searching before I decided to ask this question and there was nothing similar to my question that helped me. So I came to CS stack-exchange for hints.
So, I am currently working on a proof to show that if $L$ is regular then $OP(L)$ is also regular without the use of pumping lemma. For the sake of this ques... |
I've been thinking about embedded languages (domain-specific or otherwise), and in particular the approach where we define a datatype to represent terms of the embedded language, e.g. (in Haskell):
data Expr = Numeral Int
| Apply Expr Expr
| Lambda String Expr
| Var String
| ...
... |
I'm trying to prove some statements about execution in Java programs under some heavy restrictions (basically I have a conjecture that if two methods satisfy a set of constraints for a given input then the are they equivalent - i.e., that return value and state after execution are identical). To prove this I'm looking ... |
Would it be possible to use the master theorem to solve the following recurrence?
T(n) = 9 T(n/2) + n^3 lg n
This recurrence hasn't been mentioned before in any of the questions on StackOverflow.
Best,
|
I am a statistician by training, so am not too familiar with the computer science literature. One of the engineers at the firm I work at told me about problems with A/B testing in Canary releases.
I am well versed with the literature on A/B testing, but in the case of canary release, I am not quite sure what is being t... |
When we write a mathematical formula, the rule $a=42$ (when we say let $a=42$) and testing them (when we write something like $\ldots \mathrm{if} x=42$) is written in a same equal sign. I think that both of them are representing some relation. However, while programming, we write = for the first circumstance and == for... |
We have give positive integer $n$, and we want to find all the pairs $(i, j), i\leq j$ such that: $$i + (i+1) +(i+2)+(i+3)+ \dots + j = n$$
Clearly we can try all possible pairs in $O(N^2)$, but that is pretty slow. Here is my observation.
We already know that the sum of numbers from $1$ to $n$ equals $\frac{n\cdot(n+1... |
1.10 Let A be an algorithm for minimization NP-optimization problem such that the expected cost of the solution produced by A is at most $\alpha OPT$, for a constant $\alpha>1$. What is the best approximation guarantee you can establish for this problem using algorithm A?
Hint: A guarantee of $2\alpha-1$ follows easi... |
I'm looking for a reference to an algorithm that does the following. Given n, and a range [min, max], generate a random ascending stream of n integers i_1, i_2 .. i_n such that min <= i_1 < i_2 < ... < i_n <= max. And this should be done in constant space.
(So I'm looking for a more efficient alternative to the followi... |
Is there any efficient algorithm to find shortest distance between all pairs of vertices?
The graph is:
Cyclic
Sparse (each vertex has either 2 or 3 edge)
undirected(bidirectional)
weighted
non-negative
Since Floyd-Warshall algorithm and Johnson's algorithm are best for finding shortest path for every pairs but:
Jo... |
I was doing a problem about Amdahl's Law when I noticed that $s,(local$ $ speed-up)$ was incalculable. The wording:
A computer takes 100 seconds to execute a program. The multiplication operations
take the 80% of the time. By how much we have to improve the speed of the multiplier
in such a way that the program runs 5 ... |
I am struggling with the following dynamic programming problem:
Given a complete $N$ vertex digraph and a list of vertices $List$, find a way for two players who start at vertices 1 and 2 respectively to visit each vertex from $List$ (order matters, i.e. $List_{i + 1}$ should be the vertex visited after $List_i$). S... |
I am creating a program which searches for particular types of strings. The alphabet of these strings are in $\{a, b, c\}$, for which every sub string of length 3 contains exactly $c$. Some strings that follow these constraints are:
$cabcbbca$, $cbb$ and $acaacb$
And strings that don't follow the constraints are:
$aaa... |
Show that the following formula is a law of
LTL, i. e. the formula is satisfied on all paths in all models
G(p → X q) ∧ G(q → F p) ∧ p → G F p
I dont know how to go about that. Whats the standard procedure to go about checking the satisfiability of all paths in all models for a given LTL formulae?
|
f(n) = n/100 = Ω(n) . I am new at proving asymptotic notations , especially at big-Ω. That's why I even didnt start the beginning myself. I tried to prove myself as looking at other proofs and searched on the internet to find same question but I couldnt find. I dont think so this question is a duplicate of another whi... |
So, regarding Huffman Coding we know that the optimal way of "storing" it is using a full binary tree (where all nodes have either 0 or 2 children). All leaves are the symbols $i$ of the alphabet we want to encode (all $i$ have a frequency of appearance$f_i$) and if we consider the freq. $f_i$ of each leaf (freq. of th... |
Before asking my question, I have to give some background about myself. I live in Iraq and this made my education a total disaster. My middle/high school math skills are not that great and I never realized that until I got into college. I found out pretty late that great colleges cover a lot of maths materials in their... |
Suppose you want to read a book with $n$ chapters, and chapter $i$ has $a_i$ pages. Now you want to read the entire book in $d$ days. But there are two restrictions:
by the end of each day, you cannot be in the middle of a chapter.
You must read the chapters in order.
You also want to minimize the maximum number of p... |
I am trying to design an algorithm that would help me distribute in this example case, 'students' to different exam rooms.
All the constraints for this Theoretical problem would be:
[1]"One student can only be at the exam room at a specific time "... meaning that only one student can give an exam in one of the rooms. ... |
If a language L on Σ = {a, b, c}, such that L = {w | #a(w) is even and #b(w) is even and #c(w) is even and | w | is even}. Where #a(w) represents the quantity of a's in w and | w | is the length of the string w. How many states have the minimum DFA that recognizes L?
Help me please!
|
"Ad-hoc polymorphism is obtained when a function works, or appears to work, on several different types (which may not exhibit a common structure) and may behave in unrelated ways for each type." – Strachey 1967
Subtype polymorphism seems to fit this description, albeit usually with late binding on the type that dicta... |
In discussions about why most languages which implement inheritance only implement single-inheritance, the question of the precise semantics of overlaps often comes up, and having redundant data members is sometimes given as an example semantic that would be undesirable. Note that this semantic effectively implements i... |
I have the following homework question. (For a bit of context - the study unit is Formal Languages and Automata).
Define the predicate $\mathrm{pre}(s,t)$ over $s, t\in\Sigma^*$ by induction on the structure of $s$ such that it satisfies the following conditions:
$$\mathrm{pre}(s,t) = \begin{cases}
\mathsf{true} & ... |
Prerequisites
I've found out that photogrammetry methods allow us to fetch 3D model from set of images of a scene. I call this rigid reconstruction.
There are methods of finding correspondence between two 3D scans even though scanned object performed non-rigid transformations between scans like Global Correspondence Op... |
I came across to the code that convert 32-bit signed fixed-point number (16.16) to a float and it looks like (pseudocode)
floating = fixed / 65536.0
Could you please explain me what's the essence of dividing by this? Why does this dividing works when fixed-point and floating-point numbers have different internal struc... |
There are two nested for loops. I'm not sure but I think that it's geometric series, but I cannot get well solution for it. It seems n + n/2 + n/4 + .. + n/n^2, but how? What I tried is below up to now,
$$ \sum _{i=0}^{log\left(n-1\right)}\:\sum _{j=0}^{i-1}\:1 $$
$$ \sum _{i=0}^n\:\sum _{j=0}^n\:\left(\frac{1}{2}\righ... |
Question
Is Infinite Union of Recursive language is Recursive?
I know it is already posted here, but the i am not getting answer also i want to know if my approach is correct.
My Approach/Doubt
$\text{let}\,\,L_1=abcd \,\,\,L_2=a^2b^2c^2d^2=aabbccdd,L_3=a^3b^3c^3d^3=aaabbbcccddd$
here $L_{1},L_{2},L_{3}\,....\text{ar... |
In CLRS , under the section "Maximum sub array problem", there is a problem to maximize the profit in the stock exchange. The problem is.. given an array A[1..n] and we have to find i and j such that i < j and A[j] - A[i] should be maximum. the solution given is O(n^2) . But I have a solution which does it in O(n) . I ... |
I have seen various statements with negation( or complement) operators and when i try to negate them using De Morgan's law , i become confused about how to negate.
The main doubts are what variables to negate and what operators to negate.
Example:-
~(p^q)= ~p∨~q (according to De Morgan's)
Doubt1
but for ~(p=q) should i... |
I am reading some properties on the A* search algorithm on Wikipedia, specifically:
"If the heuristic function h is admissible, meaning that it never overestimates the actual minimal cost of reaching the goal, then A* is itself admissible (or optimal) if we do not use a closed set. If a closed set is used, then h must ... |
There are $n \in \mathbb{N}$ towers, each with a height and a value. Let the positive integers $h_1, h_2, \dots, h_n$ be the heights and $v_1, v_2, \dots, v_n$ be the values, respectively. Two players $A$ and $B$ take turns. Player $A$ may or may not select an arbitrary tower and reduce it's height by $a \in \mathbb{N}... |
Two arrays of natural numbers are given of length $n$ and $n - 1$:
e.g.
$A: [a_0, a_1,..., a_{n-1}, a_n]$
$B: [b_0, b_1, ..., b_{n-2}, b_{n-1}]$
All elements of $A$ are unique (can be in $B$), all elements of $B$ are unique (can be in $A$) and
every element of $B$ is smaller than the sum of all elements of $A$.
Find a ... |
I was tasked to order some functions in respect to the $\mathcal{O}$ notation, and have some problems with the following ones:
$n^{\ln(7)} = \mathcal{O}(n^{3})$: I can't find a more elegant proof for this other than using L'Hôpital's rule and a numerical approximation of $\ln(7)$:
$\lim_{n\to\infty} \frac{n^{\ln(7)}}{... |
One of the undergraduate degree requirements at my university is that all Letters and Science students must take a "breadth course" in each of seven categories. If a course has multiple associated categories, you have to pick one; you can't satisfy multiple breadth requirement categories with a single course.
For exam... |
In any introductory course on the theory of computing, one encounters the language
$$L_k = \{a_1^n \cdots a_k^n \mid n \geq 0\}$$
as a canonical (or at least pedagogical) counterexample for a language which is not regular ($k=2$) or context-free ($k=3$). The next jump is usually to the turing machine, where $L_k$ is in... |
I have been looking to implement a data structure for my project. I came across AVL tree and Hash Table. As I am a beginner so I'm in dilemma what data structure I use for large data. The main operation will be mostly searching through the database efficiently.
AVL Tree seems to be very good option to store around 1200... |
There are 4 DNA nucleotides, each represented by one of the letters A, C, G, or T.
Assume that they can be arranged in a string e.g. "GATTACA...". I want to figure out the minimum number of nucleotides I would have to encounter before I'm pigeonholed into seeing a duplicate substring of length 3.
Observe that a string ... |
I was studying Karatsuba multiplication where the complexity is reduced as compared to classical algorithm by splitting each number into two parts.
Now I'm trying to understand how the multiplication will take place when a number is divided into three parts instead of two.
I tried to solve the math but only came up wit... |
The typical way to compute the factorial would take $O(n)$ because it calls itself recursively. However, there are many other ways to compute the factorial function based off the gamma function, bessel functions and whatnot. So how would you prove factorial always takes at least $O(n)$ time, no matter how you choose to... |
The time required to send a frame is called frame time.
Vulnerable time is the time during which no transmission should be done to avoid any collision.
My question is what kind of problem will be created if vulnerable time was equal to frame time?
|
I'm studying a simple max flow problem:
Each type of object $a_1, a_2...$ can be stored in some of several stores $b_1,b_2...$. This is described by this graph:
There are $|a_i|$ objects of the type $a_i$. Store $b_j$ can contain at most $|b_j|$ objects. This shows as capacity constraints on the graph. The other edges... |
I wish to use a multi-bit trie structure for storing IPv4 forwarding information with a fixed stride width of 8 bits, I think this is also called a "radix of 8" (so for any IP prefix 4 levels will exist between root and leaf nodes inclusive: 8-8-8-8). This is just a basic multibit binary trie that doesn't use any form ... |
How to show that these two axioms are equivalent:
1: $\{G[v/e]\} v:=e \{G\}$
2: $\{F\} v:=e \{\exists v' (F[v/v'] \land v=e[v/v'])\}$
I've tried with $G = \exists v' (F[v/v'] \land v=e[v/v']) $and then I get $G[v/e] = F$, but when I try $F = G[v/e]$ then from $\exists v' (F[v/v'] \land v=e[v/v'])$ I can't obtain $G$.
I... |
Chess is usually considered a mostly "fair game" between White and Black because the opening position of pieces has mirror symmetry (between players). In practice it also appears to be a fair game because it is combinatorially complex, so if White has a first-move-advantage, it is hard to detect in actual play.
What ar... |
Prove or disprove the following statement: for arbitrary regular expressions $r_1$ and $r_2$ over an
alphabet $\Sigma$ such that $\epsilon$ belongs to $L(r_1)$, there exists a regular expression $r$ over $\Sigma$ such that $r = r_1r + r_2$.
My Solution: Let us consider $\Sigma =\{a\}$. $L_1$ is even number of symbols s... |
Let $C$ be the set of all available classes, $S$ be the set of all available students, $P$ be the set of all available phone numbers.
Each student many have zero to many phone numbers, but each phone number can only belong to zero or one student. There may have little chance that some phone numbers have no owners at al... |
Within a directed simple graph, are all vertices within a strongly connected component with 2 or more vertices part of a cycle?
|
Show that the following language $L$ is regular by describing it using a regular expression.
$$L = \{1^n w 1^n \mid n > 0 \text{ and }w ∈ \{0,1\}^*\} $$
My (apparently incorrect) answer:
Given $w ∈ \{0,1\}^*$ , we can rewrite $L$ as: $1^n(0\cup1)^*1^n\ for\ n ≥ 0$
However, since the language specifies that the nu... |
The wiki pages about chabots mention that statistical methods, keyword search and precompiled answers are used for the chatbots. But I feel that there should exist different - semantical approach for constructing chatbots. There are formal semantics of natural language (recent results in http://www.springer.com/gp/book... |
Given that
The channel is tiny, it has message size of 72 bits
Each bit is probabilistic, meaning that I have a value between 0 and 100 of how likely that bit is on/off1
Only 24 bits of acutal data are needed
Currently, BCH[63,24,7] is the closest thing I've found, but it doesn't capitalize on all aspects of the chan... |
I think they have the same order of growth because both are O(n^2), correct? And even though 2000n^2 has a higher coefficient, they're both the same complexity since O(n) < O(n^2) < O(n^3) is this thinking correct? If not, how can I understand their order of growth better?
|
What is the exact meaning of these terms? Very confusing. Most of the articles uses these terms interchangeably.
|
I have a CNN based object detector trained on WIDER Face dataset. It can successfully detect human faces in a given image.
Now, I am trying to detect abstract face and minimalistic face patterns in clouds or houses etc but having no success.
Initially, I thought I could lower the detection threshold to detect such p... |
So I've seen all these leaps in machine learning alorithms these past years and they've only gotten better and better at recognizing handwritten text. I remember reading once that some algorithms have 95% accuracy. So then, why when I use an OCR software, it spits out garbage? Even with printed text, which I feel shoul... |
As we all know there exist plenty of polynomial-time reductions from one NP-complete problem to another. Are there any NP-complete problems that have a rather large polynomial bound for reductions to other NP-complete problems, like a poly-time sub-hierarchy of NP-complete problems...?
E.g. lets assume I have NP-comple... |
I've been implementing a Fibonacci Heap in C this past week and today I just hit a mental roadblock that I can't figure out.
Decrease Key is a function that almost all min heaps have (vice versa with increase key with max heaps). However all of the decrease key functions declarations look like this:
// Big Theta 1 perf... |
I studied this algorithm. Link.
Is is about finding all possible binary trees with given inorder traversal.
I want to analyze this code with Big-O notation.
I think it is O(N^3). Below is my thought.
1) choose root node. let's say in[i]. (0 <= i < N). => O(N)
2) construct left subtree. in[0] ~ in[i-1]. => O(N)
3) const... |
1) (cited from "Introduction to the Theory of Computation" by Michael Sipser)
Let $M$ be a Turing machine, we say that $M$ decides a language $L$ if $M$ is a decider which recognizes $L$.
2) (cited from "Computational complexity: a modern approach" by Boaz Barak and Sanjeev Arora)
Let $f \colon \Sigma^{∗} \rightarro... |
I was reading the Sipser's book on the Theory of Computation, 3rd edition and came up with a question. "Does showing a problem and its complement are not Turing-decidable means that the language & its complement are not Turing-recognizable?" I believe that the answer is NO, however, the Theorem 5.30 states something di... |
NP is a class of decision problems for which one can present a "certificate" that can be verified in polynomial time.
Are there any decision problems that have such "certificates" that can be verified faster than solving the problem(*), but verifying still takes superpolynomial time(*)?
(*) using the best-known method
|
Given two finite sets $A, B \subseteq \mathbb{C} \times \mathbb{R}$, each stored as an array, define
$$
S = \{ (z_1 + z_2, x + y, z_1, z_2, x, y) : (z_1, x) \in A, (z_2, y) \in B \}
$$
and
$$
f(s) = \min_{t,z_1,z_2,x,y} \{ t : (s, t, z_1, z_2, x, y) \in S \}
$$
with $f(s) = \infty$ if the feasible set of the above min... |
So as you read in the title I want to know if it is possible in polynomial time to reduce a SAT problem to it's simplest version in CNF format with no assumed variables?
The simplest form is with minimal gates in the circuit, assumed variable is not important it was assuming the value of a variable.
An example, I have ... |
I want to formally prove that there are countably many disjoint enumerable sets such that any two of them cannot be separated by a decidable set.
I know that there exist a computable function $f$ that takes only values 0 and 1, and this can be used to define two sets (let's say $\mathcal{A}$ and $\mathcal{B}$, where $\... |
I have a linked list with n elements and my goal is to find the 'nth to last element' in the list. I would like to present my approach. Please provide your opinions on whether it is optimal or how may I improve it.
Sample linked list "4->5->6->8->2->9->1"
Suppose the question indicates find 3th to last element in the ... |
This is a question from CodeFights.com:
Given an array of equal-length strings, check if it is possible to rearrange the strings in such a way that after the rearrangement the strings at consecutive positions would differ by exactly one character.
Example
For inputArray = ["aba", "bbb", "bab"], the output should be
... |
Kolmogorov complexity is relative to a choice of Universal Turing Machine. Because of the Invariance Theorem, the difference in complexity assigned by two Universal Turing Machines is bounded by a constant that depends on the choice of that pair. They can't disagree too much because one can always switch over to emulat... |
I am new to programming language theory. I was watching some online lectures in which the instructor claimed that a function with polymorphic type forall t: Type, t->t be the identity, but did not explain why. Can someone explain to me why? Maybe a proof of the claim from first principles.
|
Hi guys I was given this question:
Prove or disprove that the following language is context-free: $$ L = \{ \alpha 2 \beta : \alpha,\beta \in 1(0+1)^*, [\alpha]_2 < [\beta]_2 \} $$ where $[x]_2$ is the numerical value of the string $x$ interpreted as a positive number in base 2. For example, $[1110]_2 = 8+4+2 = 14$, $... |
The problem is best illustrated with an example. Consider a trading system in which A sells to B who sells to C.
A -> B -> C
At some point in the future A needs to deliver the sold goods to B who in turn needs to deliver to C.
From this trivial example it can be seen that A could deliver directly to C without involvi... |
I was reading the other day about this problem, refreshing it, and on a couple of places over the internet I read somebody explaining something in the line of '..does not matter as long as is polynomial, a N^20 or N^30 will do it, we know that maybe the solution does not make the problem tractable but if we can produce... |
Let $S$ be a set (say positive integers $\leq$ N) and $f$ an involution ($f$ is bijective, $f\cdot f=id$, e.g. xor with a constant). $g$ is a idempotent mapping choosing an arbitrary representative element in each $f$ mapped pairs. For example $g(x)=\min (x,f(x))$ $$g: S \rightarrow \tilde S \subseteq S$$
I want to bui... |
Could for example the precedence ordering of addition, multiplication, exponentiation, boolean and/or and zip/cross product be inferred from a few rules?
|
What are the methods to deal with variations in cost in a dynamic graph when applying Dijkstra? For instance, I select the shortest path in a graph, however, the weight of this path changed after I selected (I made the selection using an estimate). How do I deal with this variation?
|
The rule 110 cellular automaton is known (or claimed) to be Turing complete. But what exactly does it mean?
I do know what Turing completeness mean. Roughly speaking a language is Turing complete if any program / algorithm can be expressed using this language.
However, the rule 110 is a fixed set of instructions of how... |
Consider the function : $\mathbb{Z}^{\geq 0} \rightarrow \{0,1\}$ given as $n \mapsto n \bmod 2$. Does this have an easy implementation using Linear Threshold Function gates?
I do not mean that the input is the infinite set of positive integers. Think of the input as coming on a single wire carrying a non-negative in... |
How can a Turing machine be constructed to recognize languages consisting of Turing machines that accept a certain set of strings?
An example: the language $L = \{\langle M\rangle\mid M \text{ accepts a string }0^n1^n2^n \text{ for some }n\geq 0\}$.
Does a TM recognizing such language exist or are these kinds of langua... |
In this cheat sheet, average time complexity for access to a hash table is listed as N/A.
I'm curious as to why. Since a hash table is mostly mathematical, I would assume it would be O(1) like the other operations ... Search, Insertion, Delete.
http://bigocheatsheet.com/
|
Do we know if all of $AC^0$ can be captured by polynomial sized depth $2$ LTF circuits? (with or without polynomially bounded weights).
For any vector $w \in \mathbb{R}^n$ and any number $c \in \mathbb{R}$ we define the LTF (x) gate as the function, $\{0,1\}^n \rightarrow \{0,1\}$ such that $LTF(x) =0$ if $c + \vec{w... |
I am struggling with the following problem:
Given a set of finite binary strings $S=\{s_1,\ldots,s_k\}$, we say that a string $u$ is a concatenation over $S$ if it is equal to $s_{i_{1}} s_{i_{2}} \cdots s_{i_{t}}$ for some indices $i_1,\ldots, i_t \in \{1,\ldots, k\}.$
Your friend is considering the following problem:... |
Many seem to believe that $P\ne NP$, but many also believe it to be very unlikely that this will ever be proven. Is there not some inconsistency to this? If you hold that such a proof is unlikely, then you should also believe that sound arguments for $P\ne NP$ are lacking. Or are there good arguments for $P\ne NP$ bein... |
In The Scientist and Engineer's Guide to
Digital Signal Processing
By Steven W. Smith, Ph.D. i have read something like that,
Single precision or 32-bit floating point forms the floating point number, $v$, by the following relation:
$$ v = (-1)^S \times M \times 2^{E-127} $$
The term: $(-1)^S$, simply means that the si... |
Can someone help me prove the correctness of this algorithm:
MUL(a,b)
x=a
y=b
WHILE x≥b DO
x=x-b
y=y+1
IF x=0 THEN
RETURN(true)
ELSE
RETURN(false)
I had to prove that $x_n + b\cdot y_n = a$ by induction, where $x_n$ and $y_n$ are the values of the variable x and y after the loop ... |
I have an input string similar to ABCDEFGHIJK from which a series of sequences has been generated into an array as following:
00: 'ABCD'
01: 'BCDE'
02: 'CDEF'
03: 'DEFG'
04: 'EFGH'
05: 'FGHI'
06: 'GHIJ'
07: 'HIJK'
08: 'ABC'
09: 'BCD'
10: 'CDE'
11: 'DEF'
12: 'EFG'
13: 'FGH'
14: 'GHI'
15: 'HIJ'
16: 'IJK'
17: 'AB'
18: 'BC... |
Let us have a finite set $S$ and a finite set of its subsets $S_1, S_2 \dots S_k$. For any $S_i$ we have two numbers: $l_i$ and $h_i$. We need to figure out if there is such a subset $T$ of $S$, that for any $i$ we have $l_i \leq |T \cap S_i| \leq h_i$.
Prove that this problem is in NP & NP-complete by reducing 3SAT to... |
The wikipedia page about comb sort claims that the average complexity of comb sort is Omega(n^2/2^p) where p is the number of increments. Take as example an uniform distributed array of 1000 elements, using the standard shrink factor of 1.3 the length of the gaps list is 23. Is this the p mentioned in the wikipedia art... |
This is from an old exam, the last Task no one could solve correctly and I'm curious how it's done :p
Show that the set of decimal representation (without leading zeroes) of the divisible numbers by 4 (natural numbers) is regular.
By this thread How to prove a language is regular? I know that one can make a DFA to Show... |
Given: $n$ tasks with accomplishment times $t_1, t_2, \ldots , t_n$. There is no such task that its accomplishment time is greater than the overall accomplishment time of other tasks.
Question: How to distribute these tasks between two workers in a such way that $|T_1 - T_2|$ is minimum ($T_i$ - the overall accompl. ti... |
I am struggling with the following problem
Let $f:\mathbb{N} \to \mathbb{N}$ be a function on natural numbers and
say $L$ is some language.
Define $L_f = \left \{ x \mid \exists y \in \Sigma^*: |y| = f(|x|) , x \cdot y \in L \right \}$
If $L$ is regular and $f$ is $x \mapsto x^2$ and $g$ is $x \mapsto 2^x$, show tha... |
That is, if h(n) = h*(n), then A* only expands nodes that lie on an optimal path to the goal. But does this imply that A* will always take a linear time in the solution length to find an optimal solution?
I suspect I may be overthinking this problem, but if h(n) = h*(n) then we are measuring the exact heuristic cost of... |
Is the following statement from [1] true?
"Since recursion is the main computational technique, a terminating pure Haskell program counts as an inductive proof of a theorem."
My intuition is that inductive proofs require a base case, assume the hypothesis case for k, prove induction step fork+1.
I am not clear on how t... |
Currently I'm learning about the Disjoint Sets data structure. I understand that, when we create a union of two disjoint sets, we create a kind of "backwards" tree for fast lookup. As Skiena says in his book:
To minimize the tree height, it is better to make the smaller tree the subtree of the bigger one. Why? The hei... |
Is mostly algo query. I use php. I use a local btc exchange and its API only publishes last 24h volume which changes every few minutes. I have logged this for past week.
I want to try to use it to derive into near real-time volume.
Is it possible to have such an algo?
Example:
Suppose i want to derive real volume from ... |
If I want to make N repeated (i.e. millions of) 2D nearest-neighbor queries on a pointset of size M, is traveling down into a KD-Tree most efficient or are there better ways to do this? (e.g. Voronoi?)
Right now I'm building a KD-Tree of size M, so with N queries on that I end up using N log M time. Can I do better?
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.