instruction
stringlengths
35
29.1k
I'm trying to solve the problem for finding majority element of given array. I made two attempts to solve the problem, but seems that both have something wrong in them. First one relies on the logic that : 1) If $A$ is array with $n$ elements then $A$ has majority element $\Leftrightarrow A_{1} = A[1,...,\frac{n}{2}],...
Problem statement: Given an array of N integers, find its number of negative subarrays (i.e sub arrays having negative summation). E.g: for an array $[1,-2, 4, -5, 1]$ there are 9 subarrays whose sum is negative. Subarray means sequential array within an array. My code: It's complexity is $\theta(n^{2})$ as we can see....
My understanding is that "page replacement" entails replacing the contents of a frame to bring in a new frame in it's place corresponding to a new page. Since it is not the page, but the frame that changes, shouldn't this process be called "frame replacement"?
Given a set of $n$ points $P$ and a set of $n$ points $Q$ in 3 dimensional space, what's the fastest algorithm to uniquely pair points in $P$ with points in $Q$ so that the sum of the square of the distance between points in $P$ and their corresponding point in $Q$ is minimized? Each point in $P$ must be matched with o...
I'm trying to represent a directed acyclic graph using a structure similar to an adjacency list. The difference is, for a given vertex v, I need to know precisely which nodes are inwardly adjacent to v, and which nodes are outwardly adjacent to v. To get around this, my idea was to use a list of pairs, where each pair ...
From the link below I understand the behaviour of different kinds of registers. However that raises few more queries in my mind. https://stackoverflow.com/questions/8871633/whats-the-difference-between-safe-regular-and-atomic-registers What is behaviour of Regular registers when there are overlapping writes? Why do we...
Every example of a total, computable but non-primitive recursive function seems to be explicitly constructed for proof theory, or in Godelian proofs of "what is the name of this book?" kind. But is there a non-primitive recursive function or algorithm that occurs naturally, like in physics or number theory or even in i...
The algorithm works as follows: For each clause, the algorithm turns the middle disjunction into conjunction, i.e. if an arbitrary clause is of the form: (l1 ∨ l2) ∨ (l3 ∨ l4) Then after turning the middle disjunction into conjunction the 4CNF clause becomes conjunction of two 2CNF clauses: (l1 ∨ l2) ∧ (l3 ∨ l4) After ...
I propose a simple polynomial algorithm for the following problem. Given $m$ integers each one stored on $n$ bits, output the integer that appears the most often. Reserve a memory area with $2^n$ slots/registers/locations/cells, each cell being long enough to store the number $m$. This requires constant time because w...
Given a set of elements $N$, a set $S$ of subsets of $N$, and a function $v:S \to \mathbb R$, determine a set $R\subseteq S$ of non-overlapping subsets that maximizes the total value. Has this problem already been studied somewhere, or is it linked to some well-known optimization problem?
Given a weighted directed acyclic graph (DAG), I need to find all maximum weighted paths between the start node(s), i.e. zero incoming edges, and the end node(s), i.e. zero outgoing edges. My current approach is doing the followings. Add an extra node $S$ (source) and put directed edges to all starting nodes with zero...
If someone compiled a program with all optimization settings enabled, would it be possible to create source code that, if it was compiled with all optimizations disabled, produced an identical binary? We'll assume that inline assembly and similar features are not used. If this is not always possible, (and I suspect it ...
if i have an equation like $$f_n = x + y + z + a + b$$ and each variable has a discrete answer like $a = 0, 1 , 3$ . $b = 2 ,4,5$ etc. i want to find the global optimum minimization point. I used Ant colony optimization (ACO) to solve the equation but i am stuck in the heuristic information and how to comp...
I've seen a numerous interesting abstract machines (i.e. CESK) and evaluators (diverse meta-circular S-expression evaluators, i.e. vau, COLA) and other models (concatenative, SK/Lambda calculus) which implement some novel(?) computational ideas, but almost every time each model boils down to: Executing a stream of pr...
I'm studying for my theory of computation exam and came accross the following question: Construct an appropriate Turing machine for the following language and prove or disprove it's semi-decidability: $A := \{w \in \{0, 1\}^*\ |\ \exists x \in \{0, 1\}^* .f_w(x) = |x| \}$ The way I interpret this is that $A$ consists...
I have implemented my own CSP solver using a Backtracking algorithm. Within the Backtracking algorithm I apply a Forward Checking algorithm (reducing domains of connected, unnasigned variables) that only works with Binary constraints. The problem I have is that the CSP I try to solve has lots of n-ary constraints, maki...
I have a propositional formula $F$ and an assignment of truth variables $A$. The assignment $A$ assigns a truth value to each variable in $F$ and then it can be evaluated. I have a function which for a given formula $F$ and a given assignment $A$ checks if both $A$ and $\overline A$ evaluate to the same truth value. It...
I am trying to solve this question on Sedgewick's and Wayne's Algorithms book: Suppose that a linear-probing table of size 10^6 is half full, with occupied positions chosen at random. Estimate the probability that all positions with indices divisible by 100 are occupied. So we had 500.000 inserts on the hash table an...
Like this one, for example, but for computer science. Maybe some survey of that kind was conducted for CS as well?
Given a positive integer n, find the list of positive integers whose product is the largest among all the list whose sum is n. For example, if n is 4 the desired list is 2, 2 because 2x2 = 4 is larger than 1x1x1x1 = 1, 2x1x1 = 2 and 3x1 = 3, if n is 5, the desired list is 2, 3. What is the desired list if n = 2001? Act...
I am trying to detect patterns in huge code bases. I managed to filter the entire codebase into a tagged string, as in: ABACBABAABBCBABA The result should be: ABA *3 CBA *2 I'm trying to build / use an algorithm which will find ANY unknown repeating pattern inside the string. The length of the pattern, it's composition...
I've around $500$ binary (black and white) images, of which I attach $2$ samples. I'm working on a machine learning problem of classifying images like them. I'd like to know what image features I can use that'd be very distinct for distinct images of this type. I tried HOG features, but the difficulty is they're very...
How to design a DFA of all strings over (0,1) such that every block of 5 consecutive symbols contains at least 2 0's?
A lot of times, I’ve needed to split a given set of people into a given number of teams but with some complications, like: Alice and Bob CANNOT be on the same team. Carol and David just HAVE TO BE on the same team. I feel like this is already a thing. There's gotta already be work in this problem. Where would I even ...
Just out of curiosity, What problems are believed to have an efficient algorithm, yet haven't been found such an algorithm for them? This question came up to my mind after reading about PRIMES problem. I hope this question is appropriate for this forum Thanks!
I have a number $n$ and an integer $x$ which ends on $1, 3, 7 \ or\ 9$, meaning that the last digit (rightmost digit) of $x$ is one of those 4 numbers. Now if $z = x * y$, what number do I have to choose for $y$ such that the $n$ last (rightmost) digits of $z$ are equal to $1$ (I mean the numerical value of the rightm...
I think that consensus number of mem-to-mem-swap(a,b) operation which atomically swaps the values between shared locations a and b (shared R/W memory) is infinite , but I'm having trouble proving it. I thought about implementing CAS with mem-to-mem-swap but comparing atomically is problematic, I think there is straight...
I often meet such kind of the definition of the set of trees, as: The set of unranked $\Sigma$-trees, denoted by $T$, is the smallest set of strings over $\Sigma$ and the parenthesis symbols ‘)’ and ‘(’ such that for each $a\in\Sigma$ and $w\in T^*$, $a(w)$ is in $T$. (http://dl.acm.org/citation.cfm?id=2101368) One que...
I'm designing a web app to host e-sports tournaments and want to create an algorithm that generates tournament brackets. Given a list of participants' user ID's (minimum 4, maximum let's say 64), I want to generate a bracket in the form of a list of pairings, where each element of the pair represents a match participan...
I've a test in a few days and I've a few issues with some of the subjects. Let's start with kernels, basically I understood that a kernel needs to be positive semi-definite and symmetric in order to be valid. Is that enough? For example the following kernel, $\mathrm{kernel}(x,y) = 2 k(x,y)$ for some $k$ which is a val...
Which families of the error correcting codes have an efficient decoding algorithm? I know that decoding a general linear code is NP hard (the general decoding problem). I also know that Goppa codes and alternate codes have such algorithms due to Patterson. Hamming codes also belong to this category. If someone can prov...
Definitions: positive CNF is a conjunctive normal form formula, where all literals are positive, i.e. the unary connective ¬ does not exist in the formula. negative CNF is a conjunctive normal form formula, where all literals are negative, i.e. the unary connective ¬ appears next to each literal. My question is: Given ...
I'm interested in finding the minimum number of words needed to define some fraction (perhaps 95%) of the words occurring in an English dictionary (while ignoring the challenges of disambiguating conjugations & contractions, questions about what is and is not a word, etc). My approach to this problem was to program a v...
Consider the binary search problem on a sorted array containing $n$ integers on 16 bits. Everybody agrees that the binary search needs $O(\log(n))$ time, because it makes at worst $O(\log(n))$ steps. But: at each step it needs to calculate a midpoint. The first midpoint is $[n/2]$. The next midpoint could be $[n/2]+[n/...
What is the complexity of the problem of computing the cardinality of the union of many (finite) and small sets? What is both the time and space complexity of the naive algorithm that does this computation? An inefficient recursive algorithm to do this task is: Where This results in Θ(2n) exponential blow up time com...
In parallel programming, what is the practical use for pack/unpack and gather/scatter? I searched for practical examples and didn't find any use of those.
i'm in trouble trying to prove the following proposition: Proposition If $\ C$ is a class closed under reductions and a $\ C$-Complete problem belongs to $\ coC$, then $C=coC$. Note: $C$ can be any class. To prove that proposition i thought to split the proof in two ways: (*): $C \subseteq coC$ I suppose it exists such...
I am trying to solve a Constraint Satisfaction Problem that involves lots of n-ary constraints. But the solver I have implemented only works with algorithms for binary constraints. I've been reading into the topic of the biniraztion of constraints (http://ktiml.mff.cuni.cz/~bartak/constraints/binary.html) but I am stil...
I've been trying to understand type inference for Hindley-Milner-based languages, and I'm struggling to understand how generalization works. Let's say I have the following program in Haskell: x :: Int x = id 1 y :: Char y = id 'a' id :: a -> a id x = x If the type-checker traverses the program from top to bottom, th...
I have two sets $A$ and $B$, I want to reduce $A$ to $B$ and $B$ to $A$. Formulas consist of a finite set of variables $\mathcal{V}$. An assignment $\sigma$ assigns truth values to each variable in $F$. When writing $F(\sigma)$ for an assignment $\sigma : \mathcal{V} \rightarrow \{0, 1\}$ I refer to the application of ...
Today I had an insight into an alternative deterministic algorithm for testing the primality of a number. I want to know if this algorithm is useful, and worth pursuing. I'll describe the idea behind the algorithm below: Let the fastest gcd algorithm we know be $g^*(a, b)$. $g^*$ takes in two numbers and finds th...
One of the hyperparameters for LSTM networks is temperature. What is it?
Is computing the cardinality of sum of regular expressions without kleene star closure is EXPTIME problem? Note that sum of regular expressions is union of regular expressions. The alphabet of each regular expression is Σ={0,1}, and each regular expression in the sum is concatenation of 0, 1 and (0+1). There is no klee...
Does the time complexity of the following pseudo-algorithm simplify as $O(n^2 log(n)) = O(n^2)$? SOME ALGORITHM GET n FOR (i=1; i<=n; i++) { calculationOfN[i] // some polylogarithmic time calculation FOR (j=1; j<=n; j++) { // some linear calculation } ...
Given two strings of the same length, determine if they are permutations of each other. I can come up with two solutions, one in O(n log n) time with O(1) extra space, and one in O(n) time with O(n) extra space, but I'm wondering if there are more efficient algorithms. If we sort the strings in-place and compare them, ...
Is there an efficient algorithm for the following problem? Input: Set of holes and pegs. Each hole/peg is an interval $[\ell,u]$ with integer endpoints. Question: Can all the holes be filled using the pegs given, satisfying the following conditions? Each peg is assigned to at most one hole. No hole is assigned more...
$$L_1= \{\langle M \rangle \mid \text{\(M\) takes at least 2016 steps on all inputs} \}$$ Is this language decidable? I will write my way of understanding it. Please answer it in the way I understand & tell if my understanding is wrong. It means L1 is a language, which includes all such Turing machines, which takes at...
I have a bounded sequence of integers, and for each element, I want to know if the sequence next goes some distance above that element, below that element, or neither. This is straightforward in quadratic time; is there a more efficient solution? More formally, I have $N$ integers $a_i \in [0, R)$, upper and lower off...
So I have been asked this question during my comprehensive and I have a few answers to it, I just wanted to check with the community whether I'm on track with them. Is the following statement true? $\forall A,B \subseteq \Sigma^{*}, \exists\ f : \Sigma^{*} \rightarrow \Sigma^{*}, s.t. \forall x \in A \implies f(x) \in ...
I'm trying to solve pretty complex problem with combinatorics. Namely, we have given three numbers N, K, M. Now we want to count how many different arrays of integers are there with length N, sum K and all the elements in the range [1, M] Constraints: 1 <= N <= 100 1 <= K <= 100 1 <= M <= 100 Example Let's say N = 2,...
I have problems with the basics of mapping reductions. I can understand how to do reductions using a Turing machine, but without it, I get a little bit confused. For example: How do I do a mapping reduction from $a$ to $b$, where $a$ is $\{0,1\}$ and $b$ is $\{0\}$ over the alphabet of $\{0,1\}$? Does every language h...
Given two integers $a$ and $b$, determine if $a$ and $b$ are equivalent modulo any $k \, (k: 1 \lt k \lt |a - b|)$. If $\exists$ an integer $ (k: 1 \lt k \lt |a - b|) \text{ and }a \equiv b \mod k$, then the algorithm would return true, otherwise it would return false. I thought of this problem today. B...
I have found a polynomial time solution of an NPC problem. My algorithm give exact result in most cases. For example if I run my algorithm for 20000 problem instances, then it fails 10 times to give correct result. But, I am unable to prove the approximation ratio mathematically. Is it feasible to show it with the expe...
I often see DFS is used interchangeably with backtracking specially in many permutation, combinations and subset problems. But usually DFS has implicit tree and does backtracking at leaf nodes whereas backtracking is on an implicit tree and does use pruning each branch. My question is how to systematically think about...
According to Shannon (in his 1949 paper) the game of chess has too much complexity to be solved by a brute-force search of the game tree: A machine... would require over $10^{90}$ years to calculate the first move! But his paper ends with a section entitled "Another Type of Strategy" and provides vague guidance on ot...
I am looking at the following: Costruct a composite turing machine, that reverses the words $w_1$ and $w_2$ over the alphabet $\{\_, x_2, \ldots , x_m\}$ as follows: $$\ldots \_ w_1\_ w_2\underline{\_} \ldots \mapsto \ldots \_ w_2^R\_ w_1\underline{\_} \ldots$$ The first symbol of $w_2^R$ is on the position where th...
I'm trying to solve this problem (https://open.kattis.com/problems/exponial) by using fast-exponentiation but I'm getting time limit exicted. How can I compute it efficiently?
I've read up on Finite State Automata in a lot of different books on compiler construction (two of which are actually called Compiler Construction) and I'm kind of at a loss. I understand the idea of moving from state to state and having a state that is accepted. What I don't understand is why in the world this theory ...
I'm looking for an algorithm that will let me plug in a heuristic for scoring a subtree, and as the algorithm does a depth-first search, it stops when the score has: Already hit a threshold (minimum score) only changed a very small amount from child to parent So this algorithm would be doing a fuzzy search for a "pay...
I have a following problem: Given $n$ and graph of size $2^n$, and circuit with $2n$ input gates. Directed edge between $k$ and $l$ exists iff only and only we encode $k$ and $l$ as bits and launch circuit on this input and get result $0$. Problem: Is there exists path from vertex $k$ to vertex $l$ ? I can reduce ...
Let $S = \{ [x_1, y_1], [x_2, y_2], \dots, [x_n, y_n] \}$ be a set of not necessarily disjoint intervals on $\mathbb{R}$. Is there an efficient way to compute the lebesgue measure of the union $\displaystyle \bigcup_{i = 1}^n [x_i, y_i]$ ? I present my ideas and approaches as following. If all intervals of $S$ are disj...
I think the number of cliques in a graph is generally exponential in the of vertices of that graph. Does anyone know any reference for that?
I have $4$ variables $n_1, n_2, n_3, n_4 \in \mathbb N$ that sum to $N$. $4$ positive real constants $c_1 < c_2 < c_3 < c_4$. Given a particular tuple $(k_1,k_2,k_3,k_4)$, how do I find the partial sum of the ordered (w.r.t. the sum $c_1 n_1 + c_2 n_2 + c_3 n_3 + c_4 n_4$ in an increasing manner) sequence $$\sum_...
There is a matrix of size (M x N) in which the cells are marked by one of the three letters (either 'a','b' or 'c'). Now given that there is only one cell that is marked with value 'a' but more than one cells can be marked with value 'b' or 'c'. There is 8 ways in which one can move form one cell to another, considerin...
The halting-after-$n$ steps problem may be defined as the question if a given turing machine halts after a maximum of $n\in\mathbb{N}$ steps. Is it theoretically possible to solve this problem in general in less than $n$ execution steps (just execution the program) or can't this be done? If not, why not? Thank you
Magenta's melody_rnn_generate method includes a parameter beam_size. What is it and how does affect the melody?
Binary tree with external leaves is a 5-balanced tree if the path from the root to the farthest external leaf is no more than 5 times as long as the path from the root to the nearest external leaf, and if his right and left subtrees are 5-balanced too. Show that the height of such a tree is O(logn). I was trying to pro...
TensorFlow's Magenta melody generation module has a parameter for branch_factor1. What is it?
I have the following problem: A large number $N$ of (finite length) line segments in the plane (if it helps, we can assume non-intersecting except at end points, and forming a graph with a small number of components); and a smaller number $n$ of points. For each point, I wish to find the closest line segment. Given on...
Here's the question: Do more baby names start with "A" or "B"? Write code to count and print those two counts ("A" count, then "B" count). I then write this code down: table = new SimpleTable("baby-2010.csv"); count1 = 0; count2 = 0; for (row: table) { // your code here if (row.getField("name").startsWith("A")) { count...
I don't understand a way of proving PSPACE-completness. The way was used by my lecturer. I can use reduction, however following method confuse me: We consider sequence (of polynomial length) of configurations and check if transitions betweens configurations in sequence are legal. We also check if machine accept word ...
Let's say an algorithm has an asymptotic time complexity of $\Theta(N)$. However in practice, $N$ is bound by a small upper limit (e.g. the size of a character set). Can we then say the complexity is $\Theta(1)$? Or is there a better way of describing the performance of an algorithm in a particular real-life situation?...
I was told that we would use a list if the graph is sparse and a matrix if the graph is dense. For me, it's just a raw definition. I don't see much beyond it. Can you clarify when would it be the natural choice to make? Thanks in advance!
unique numbers $1 - n$ combinations (sets) of size $k$ $k < n$ do not re-use an $n$ in a set [1, 1, 1] is not valid How to generate all unique sets of size $k$? [1,2,3] = [3,2,1] order does not matter the number of sets will be ${\binom{n}{k}}$ input $n = 4, k = 2$ output [1, 2] [1, 3] [1, 4] [2, 3] [2, 4] [3, 4] ...
I am currently studying for a test on data structures. I have to find the lower and upper bounds for the following problem: Input: an array with $n$ numbers. Output: boolean answer for the question if there exist $1\le i\le j\le n$ so that: All the elements in the array between $1$ and $i$ are in ascending order. Al...
In my work, I had to essentially compute the following quantity. Given a sequence of positive floating point numbers $\{a_i\}_{i=1}^n$, such that $$6000 \leq a_i \leq 7000$$ I needed to compute the following quantity (for some $n>1$, but for now can assume $n=1000$): $$\log_2\left(\frac{\sum_{i=1}^n 2^{a_i}}{n}\right)$...
Natural language semantics (in computational linguistics) uses lambda terms for expressing the semantics of natural language sentences. There is vast literature about combinatorial categorial grammars and lambda semantics of natural language, e.g. tutorial about framework http://yoavartzi.com/tutorial/ The question is ...
Let $\chi$ be a degree 2 equation over $\mathbb{Z}_2$ of the form: $$x_{i_1}x_{j_1} + x_{i_{2}}x_{j_1} + \cdots + x_{i_m}x_{j_m} + x_{k_1} + \cdots + x_{k_l} = b $$ for $ k_i \in \{1, \dots, n\}, b \in \{0,1\}$ for some $m, l \in \mathbb{N}$ Prove that deciding whether a system of such equations has a solution is ...
I am currently studying for a test on data structures. I have to find the lower and upper bounds for the following problem: An array is called a zigzag array if there are $1 \leq i \leq j \leq n$ so that the array increases from $1$ to $i$, decreases from $i$ to $j$, and increases from $j$ to $n$. Input: a zigzag arra...
Imagine you have two systems of delimiting. One with paired delimiters, [ and ]: [abc] Then another system which uses a single interstitial delimiter, /: a/b/c It's easy to see how to encode structure in the first case, as they nest cleanly: [ab[cd[e]f]] But let's say you are looking to encode arbitrary nested st...
In the HRRN scheduling, priority formula is P = (W+E)/E , where W: waiting time and E: estimated run time. CPU finds the job that has highest priority value and does that job. However, the formula is equivalent to P = 1 + W/E. If we just "minus 1" and make a new formula P' = W/E, the order of jobs does not change. So t...
I am learning a bit about machine learning, and I frequently see things labeled "linear function" or "nonlinear function." For example when discussing a neural network created by combining individual logistic regression nodes, a book I read noted that logistic regression is a linear function, and that the entire networ...
Can polynomial number of bits always encode the number of accepting paths of an $NP$ machine? Can polynomial number of bits always encode the number of accepting paths of any machine in the polynomial hierarchy?
The definition of the class $UP$ is here. It is of course easy to see that $P\subseteq UP$. I have a problem of proving that there is an oracle $O$ and a language $L$ such that $L\in UP^{\ O}$ but $L\notin P^{\ O}$, i.e. $UP^{\ O}\neq P^{\ O}$. I find a lot of struggle of finding an explicit $O$, and more struggle to...
There is an equivalent definition for the class $\mathsf{NL}$ with verifier. Those verifiers are deterministic Turing machines that can read the witness tape only once in one way from left to right. Given a function $f:\mathbb{N}\to\mathbb{N}$ we say that $\mathsf{NL}[f(n)]$ is the class obtained by the above definiti...
I have a situation where in a group of people, every person is trading with multiple people and giving them some money. It can be visualised as a directed bipartite graph with L and R as the total set of people. A directed edge from l to r means l gave r some money with weight w which is the weight of the edge. Now I'm...
I have an application that needs to compute billions of levenshtein distance between pairs of strings. The strings are short (70 in length) DNA sequences, consisting only of 4 characters. Also it can be assumed that one of the strings is fixed, i.e., we are comparing one fixed string to a billion other strings. I know...
A logical formula is unsatisfiable if and only if for the formula to be true, at least one of its variables must be both true and false. I discovered SAT today, and wanted to try my hands at solving it. I arrived at the above statement as a general principle for any attempt I want to make at solving SAT. Is the...
I know that 3SAT is npc but i wonder why my little algorithm won't solve this problem: given positive 3SAT - meaning: each of the m clauses is a disjunction of 3 literals over the variables $x_1,\dots,x_n$ ($n$ variables) and each literal is a positive appearance of a variable (no $~x_i$). for example: $(x_1 \lor x_3 \...
Definition: A maximal 3CNF formula is satisfiable 3CNF formula, but if you conjuct it with another any new different 3 disjuctive literals clause, then the formula becomes unsatisfiable. Please don't confuse with the definition of minimal 3CNF formula from my previous question What is the set of all minimal 3CNF formul...
I'm talking about functions such as Python's math.frexp() : math.frexp(x) Return the mantissa and exponent of x as the pair (m, e). m is a float and e is an integer such that x == m * 2**e exactly. If x is zero, returns (0.0, 0), otherwise 0.5 <= abs(m) < 1. This is used to “pick apart” the internal representat...
Given a sum of regular expressions, where each regular expression in the sum is n-1 concatenations of 0, 1 and (0+1). There is need to show that the sum of all regular expressions is either equal to or not equal to the regular expression, which is n-1 concatenations of (0+1). I want to know what is the complexity to sh...
I seem to remember seeing somewhere (many years ago) a writeup of the math behind calculating the outline of Metafont glyphs. The basic idea is you have a "pen" that is a circle or oval, that you then trace along a cubic spline. The question then is can you define the curve that is the outline of that stroked glyph. ...
I'm not sure the best way to name this problem, but basically I need to construct a complete $k$-ary tree for $k \geq 2$ which has this nice property as $k=1$ tree that we can create a ring out of it. For example, to construct $k=1$ suppose $N$ is the number of nodes. If for each node $x$ ($\in 0..N-1$), we pick the ch...
Every conjunctive normal form (CNF) formula can be converted to nonlinear system of equations, where each clause becomes an equation in the system and: If A and B are logical/boolean variables and defined as A∈{T,F} ∧ B∈{T,F} or (A,B)∈{T,F}2 where {T,F}2={T,F}⨯{T,F} = {(T,T),(T,F),(F,T),(FF)} Then: A=x, ¬A=1-x, B=y, ¬B...
We have two processes. One process produces F and the other process consumes F Initialization: Consuming = false Produced = false F = EMPTY The first thread (we can think of it as some kind of producer): P1: loop_for_ever: Produce(F) Consuming = true Produced = true while(Consuming) {Busy Wait) And h...
I am master student, and I work on project with camera tracking based on sphered Infrared (IR) markers. Now I have to implement multi-camera calibration system with a wand like this one: And I want to find out the details of each step, understand it. My cameras has IR filter, and it helps to discard another informatio...
What does this sentence mean? For all $ε > 0$, it is NP-hard to approximate MAX CLIQUE to within $n^{1 − ε}$. Is the fact that complexity of approximation depends on $\epsilon$ hidden in the statement? I mean, if not, I guess we can make $\epsilon$ arbitrarily small, (like $\epsilon = 0.9999$), and get a very good appr...
If I have a probability density function, some f(x) which is >= 0 everywhere and integrates to 1, is there a method to generate random numbers using that PDF? I know there is the box-muller transform to convert uniform random numbers to gaussian, but is there anything for the general case, or at least a more general ca...
Why is $P^{NP}\not\subseteq NP$ possible? After all we have a $P$ machine which uses an $NP$ oracle and since $P\subseteq NP$ why cannot the $P$ machine with $NP$ oracle just be replaced by an $NP$ machine? Similarly why is not the case $P^{coNP}\subseteq coNP$?