instruction
stringlengths
35
29.1k
I am currently studying the concept of heuristics in search algorithms. I recently asked this question about the so-called "pathmax modification," $f(n^\prime) = \max(g(n^\prime) + h(n^\prime), f(n))$, and how it is useful. The user Pål GD commented with the following: The heuristic will be monotone, and furthermore t...
I have the language $L = \{ 0^{2l} 1^m | l,m >= 0 \} \ where \ \Sigma= \{0,1\} $ which I am trying to find the class of language for, e.g. not context-free, context-free, regular. By this notion I assume $L$ is context-free and has some pumping length $p$, and I will use the pumping lemma. $w = 0^{2p}1^p$ and can be s...
I am working on the decision version of an NP-complete problem. The problem is known to be fixed parameter tractable(FPT) with respect to the solution size $k$ as the parameter. If I consider another parameter (e.g. $p$), then which among the two following statements holds true? if $p \leq f(k)$, since the problem is ...
How to prove that for any words $w_1, ..., w_n$ on alphabet $\{0,1\}$ the regular expression $w_1^*w_2^*...w_n^*$ doesn't represent language $\{0,1\}^*$?
Consider an algorithm with the following recursion $$ T(n) \leq T(n/3) + T(2n/3) + \mathcal O(n)$$ for its running time. I understand that $T(n) = \mathcal O(n \log n)$ by drawing the recursion tree and seeing that every level takes time $n$, and that the depth of the tree is $\log_{3/2} n$. But, why is this upper boun...
I am studying term rewriting using Baader and Nipkow's book "Term Rewriting and All That". I am trying to solve the following exercise about word problems: 4.1 Give a trivial example of a finite set of identities $E$ such that the ground word problem for $E$ is decidable, but the word problem is not. My idea to solve...
There is a class exercise question asking about global sink in a directed graph. Finding normal sink is not difficult but the conditions of the question have made me stuck on this question. Let $G=(V,E)$ be a directed graph for which you have an adjacency list. A vertex $v$ is called a global sink if and only if it me...
***Climbing Stairs Problem: https://leetcode.com/problems/climbing-stairs/ 1) Take the "***Climbing Stairs" Problem for instance: If I was given a problem like this on a test after mastering "Fibbionacci Series" and "Factorial Implementation", I would not be able to solve it, despite the fact that "Climbing Stairs" pro...
We receive a stream of $n$ integer numbers: $x_1, x_2,\dots, x_n$. Assume that each $x_i$ is a constant and can be stored with $O(1)$ bits. Whenever a new number $x_i, i \geq 2$ is inputted, we need to evaluate and output the sum: $$ S_i := \sum_{j=1}^{i-1} |x_i - x_j|$$ After outputting it we receive $x_{i+1}$ etc. My...
I'm working on a game where there are several different entities represented by nodes. Each node has a starting balance, and directed edges show where money is owed from one account to another. One problem I'm trying to figure out is which order to process transactions in, take this example below: If you start by proc...
I am a research scholar working in parameterized algorithms. For more information on parameterized complexity please refer to this. Recently, I have come across a problem which is known to be NP-complete on split graphs. Now, it has come to my attention that the problem will not be tractable parameterized by the param...
In this paper, the author discusses colourings of the plane, or in other words, of the underlying graph. I suppose a finite colouring is a colouring using at most $k$ colours for some natural number $k$. However, what do countable and measurable colourings mean? Does the former perhaps mean that any vertex of the graph...
By using limits, show that log n! ∈ Θ(n logn). Using Stirling's approximation for n! I get the limit: $$\lim_{n \to ∞} \frac{log({\sqrt{2πn}}*(\frac{n}{e})^n)}{nlogn} = constant > 0$$ When I break this down separately: $$\lim_{n \to ∞} \frac{\sqrt{2πn}}{n^n} * \lim_{n \to ∞} (\frac{n}{e})^n = constant > 0$$ To me, the ...
I read that if $\alpha$ is the fraction of the code that cannot be made parallel then it is desirable that $\alpha < \frac 1 p$ where $p$ is the number of processors. Why is it the case? The speed-up is $S(p) = \frac{T_1}{T_p} = \frac{p}{1+(p-1)\alpha}$
I am stuck at the following exercise: Consider a directed graph $G = (V, A)$ with start vertex $s ∈ V$, target vertex $t \in V$ and weights $w_{ij} \in \mathbb{R}$ for each arc $(i, j)\in A$. For any $i \in V$ let further be $\pi_i \in \mathbb{R}$ be the so-called potential of $i$. The potential difference $\tau_{ij} ...
In the following algorithm $A[1..n]$ denotes an array $A$ of size $n$, of $n$ distinct integers. Func1() and Func2() are functions that run in $\mathcal O(\log n)$ and $\mathcal O(n)$ time, respectively. Foo(A[1..n]) if n == 1: return while (True) { Func1() i = random[1, 2, ..., n] ...
I want to sort the list of parameters (p1, p2, p3, p4, ..., pn) according to their importance. All parameters have to be compared with each other at best once, but not less than once. The person will be asked to select the winner of the comparison, so for every comparison, there is only 1 winner. The workflow should be...
How do we write an unrestricted grammar for $$L = \{a^n \ | \ n \ \text{is prime}\}$$ I know that $L$ is neither regular, nor context-free. Also, I know how to build a Turing Machine for $L$. The idea is to use two tapes, one having $n$ ones, and the other having $m$ ones. The TM checks if $m$ divides $n$. If it does, ...
D.E. Knuth, in his infamous The Art of Computer Programming, section 1.2.2, presents the following algorithm to efficiently calculate logarithms based on the method used by Henry Briggs: Suppose that we have a binary computer and a number $x$, $1\leqslant x < 2$. Show that the following algorithm, which uses only shif...
Recently i studied three theorems which says about Hamiltonian graph, they are as follows, Dirac's Theorem: Let G be some simple graph of order n >= 3, for all vertices of the graph G, its degree >= n/2 then we say given simple graph is actually an Hamiltonian graph. Ore's Theorem: Let G be a simple graph of order n...
I am wondering if anyone knows if there are any NP-complete problems that are also known to be in IP (interactive polynomial time). I know problems like Graph Isomorphism are in IP, but such problems are not known to be NP-complete. Moreover, if there were or were not an NP-complete problem in IP, what would be the co...
It is a well known fact, the throughput of a given compute pipeline (say, CPU instruction pipeline) is determined by its "slow" segment. All the resources I've seen so far, demonstrates this fact via describing a concrete pipeline with 2-3 stages. I'd love to see, more-or-less, some formal proof, the above holds for an...
The wikipedia article for #P states that if we have a polynomial-time algorithm for a #P-complete problem, P = NP is true. As #2SAT is #P-complete, this would mean that providing a polynomial-time algorithm for #2SAT implies P = NP. But why exactly is that? It means that there is at least one NP-complete problem that c...
In a 2015 Quanta article talking about a breakthrough in the graph isomorphism problem, it was mentioned that graph isomorphism has a unique property where we have an interactive proof protocol for it. That is a prover can convince a verifier that two graphs are not isomorphic in polynomial time. That is, for the grap...
Input There are three chairs (1,2,3) in the same row. We need to find a seat for three guests (a,b,c). Constraints The first guest does not want to be seated next to the third one (neither left nor right). The first guest does not want to be placed on the leftmost chair. The second guest does not want to be seated o...
Consider the max-flow problem with a set of additional constraints, each in the following form: the flow on edge $e$ must equal the flow on edge $e'$. My question is how to modify existng max-flow algo to solve this variant.
bool isPrime(int n) const { if(n<2)return false; if(n==2)return true; if(n%2==0)return false; for(int i=3;(i*i)<=n;i++){ if(n%i==0)return false; } return true; } this worst case procedure should produce an O (sqrt (N)) which would be the number of comparisons I am going to do in the ...
Why is it possible that this word can have 4 errors but not 2?
I am reading a proof of correctness for the MergeSort Algorithm. This is the code for the MergeSort and the Merge function: The correctness of the MergeSort function is easy to prove since the two MergeSort recursive calls decrease the size of the problem by half, which guarantees the convergence to the base case ($p ...
If we have the natural numbers defined as: Plus the following: $pred \space \_\_<\_\_ \space: Nat \times Nat$ $\forall i,j:Nat$ $0<suc(j)$ $\neg(i<0)$ $suc(i) < suc(j) \Longleftrightarrow i<j$ How to prove $0<i => 0 < i + j$ by induction? For the base case the premise fails when $i=0$, and thus the implication ho...
Let F be a function defined for all nonnegative integers by the following recursive definition. F(0) = 0, F(1)= 1 F(n + 2) = 2F(n) + F(n +1), n>0 Compute the first six values of F; that is, write the values of F(n) for n = 0,1,2,3,4,5
I am learning about context free languages. I understand how $\{a^nb^nc^n|n>0\}$ can be shown to be not context free using the pumping lemma for CFL's. Intuitively however it seems that a pushdown automata to recognize $\{a^nb^nc^n|n>0\}$ can be constructed. This PDA would initially push single a's into its stack whene...
Assuming a contiguous array implementation of a binary min heap with n elements, is it possible to remove the k-smallest elements in a faster time than $O(k \log n)$, as can be done via iteratively removing the minimum of the heap $k$ times? More formally, by removal of k smallest elements, I mean removing the k smalle...
I am fitting different 2D geometric transformations by least-squares. For instance quadratic, $$\begin{cases}a'x^2+b'xy+c'y^2+d'x+e'y+f'=X\\a''x^2+b''xy+c''y^2+d''x+e''y+f''=Y\end{cases}$$ which is linear in the unknowns $a',b',\cdots f''$. I also solve homographic transformations $$\begin{cases}\dfrac{a'x+b'y+c'}{dx+e...
There are a lot of work about bounds on the complementation of Streett automata (see e.g. this paper). They talk about the general setting of nondeterministic Streett automata. But what about deterministic ones? Streett automata are closed under determinisation although with an exponential blow-up. And complementation ...
There is a chess tournament planned. It is a single-elimination tournament, and for spectacle purposes, only one match at a time will take place, on a table in the middle of the stage. The winner of a match will have to stand offstage if they don't play the next match. The loser will be out of any further consideration...
I have an algorithm with running time that satisfies $$ T(n) \leq n + \frac{1}{n}\sum^{n-1}_{i=0}(T(i) + T(n-i)),$$ and $T(0) = 0$. I was able to show that $T(n) = \mathcal O(n\log n)$ with a leading constant $c > 4$. I modified this algorithm such that the recursion for $T(n)$ now satisfies $$ T(n) \leq 3 \log n + n +...
I am starting to learn online algorithms but am still stuck in determining the competitive ratio. I cannot understand how to find it. All the research papers are so difficult to understand. Please share a proper source from which I can start my journey.
I have an oriented and weighted graph, and I need to find the cheapest route from source to destination. Now I have a source node A and a destination node B the cheapest path is given to me by the sum of the weight of the arches to which I have to subtract the discount, the discount is given to me by the weight of the ...
A proof of $\mathsf{NP}$-completeness for a decision problem requires two things: $\mathsf{NP}$ membership; $\mathsf{NP}$-hardness. It is often the case that the $\mathsf{NP}$-hardness part is the most difficult to prove, and it is not rare that some papers completely omit the $\mathsf{NP}$ membership part. What I wo...
I trying to understand where, as a programmer in situations where it can be good to do a NP-complete reduction to prove that a problem is NP-complete, why is it good to do that as a programmer? I don't understand.
\begin{bmatrix} 1-\alpha & 3\alpha/4 & \alpha/4\\ \alpha/4 & 1-\alpha & 3\alpha/4\\ 3\alpha/4 & \alpha/4 & 1-\alpha\\ \end{bmatrix} I was told that the probability of error of this channel can not be $\alpha/4 $ or $3\alpha/4$. How do I know this? How can i find the probability of error?
Examples like swinging both of their hands squat walking around jump around etc Is it possible to perform this in real time under crowded scene without depth information? I can find out the "action level" if I knew what kind of action the person are doing, but can't find a fast solution to find out their action level...
I have tried to convert signed binary number, -11.875, to unsigned value. I am not sure about where to add the carry bit taking 2's complement of binary -11.875. The carry bit should be added with the decimal part or the RHS side of -11.875?
What happens if Operand Fetch and Write Back happen in same cycle?
Start with $N>3$ vectors $\vec{v}_I$ in $\mathbb{R}^3_+$, any $3$ of which are linearly independent. $I$ here ranges from $0$ to $N-1$. Let $v_{\left[abc\right]}$ be a matrix in $\mathbb{R}^{3 \times 3}_+$ that picks three of the (column) vectors $\vec{v}_a\, \vec{v}_b\, \vec{v}_c$ in order $a < b < c$, without duplica...
For an inverted page table, it's number of entries = number of frames in main memory. One frame in the main memory, could be shared by two (or more) processes, say process A and process B. Usually this is noted down in process A and process B individual page table. Like process A page 0 maps to frame 1 offset 1-50, pro...
How do I convert a graph to a search tree? Here's the question- The problem is that I don't know how to represent interconnections in a graph on a tree. In the diagram A is connected to D, and same goes for B and E, C and F. But in tree I think no interconnections should be there between sibling nodes. So how do I rep...
I have some basic information about the graph coloring problem, which is an NP-Complete problem. I am very new to genetic algorithms, and I have faced a problem in which we have to solve the graph coloring problem using genetic algorithms. I have seen this video, and also I have read the explanation which has been prov...
In some languages, e.g. Ruby, an expression like: val = call_fn() || DEFAULT_VAL; will set val to the results of call_fn() if it is truthy (non-zero, non-NULL, etc), or to DEFAULT_VAL otherwise. This can be really useful. In C, the result of the || operator is always a boolean value (1 or 0). Is there a strong argume...
Let's say I have a Operating System with 4KB page size, but I need to allocate 8kb of memory for all the variables. Does the Process get new page (second one) or does the current page table simply get bigger?
Consider a domain on a unit grid such that the grid nodes hold a point with probability $\frac12$. We construct a Euclidean minimum spanning tree on these points. How could we compute the probability that an edge of the tree is of unit length (so it joins two immediate grid neighbors) ? The probability that a point ha...
A quad-edge is a well-known data structure used to represent planar subdivisions or polyhedra. https://en.wikipedia.org/wiki/Quad-edge The procedure to enumerate the edges works by recursively visiting edges, and for every edge, the next edge starting from the same origin and the next edge after reversal. A flag is use...
In A Simple Yet Fast Algorithm for the Closest-Pair Problem Using Sorted Projections on Multi-Dimensions, Mehmet E. Dalkılıç and Serkan Ergun present algorithm QuickCP for finding the closest pair, discussing the planar case more often than other Multi-Dimensions. Algoritm 1 $\text{QuickCP}(P)$ // $P = \{P_1, P_2, \do...
I'm looking for implementations of approximation algorithms (or algorithms that would be meaningful to implement for use in practice) for the minimum-cost multicommodity flow problem as defined in e.g. Section 2.1 of Andrew V. Goldberg, Jeffrey D. Oldham, Serge Plotkin & Cliff Stein An Implementation of a Combinatoria...
I am trying to build a parser for lambda expressions. I have implemented a capture-avoiding substitution using the algorithm below ($e[d/x]$ means replace $x$ by $d$ in $e$) $x[d/x] = d$ $y[d/x] = y$ if $x\neq y$ $(e_1 e_2)[d/x] = (e_1[d/x) (e_2[d/x])$ $(\lambda x.e')[d/x] = \lambda x.e'$ $(\lambda y.e')[d/x] = \lambd...
I have found that when drawing two trees having different structures, we can get the same in-order sequence and pre-order sequence. But I haven't found if two different binary trees can have an identical post-order sequence. Is it possible?
This is probably a computer science history question. Is there an algorithm which was originally invented to solve a contrived problem but later found practical use?
Question Description I’m facing a problem asking me to construct a (deterministic) Turing Machine that can accept such a language: $L = \{ w \in \{a,b\}^* \mid \mbox{for any non-empty prefix $w'$ of $w$}, n_a(w') > n_b(w')\}$ The problem isn’t expressed in English originally. To make sure I’m translating correctly, I’l...
I am running a simulation on my computer. I tried to multiply two polynomials $g(x), h(x)\in GF(2)[x]$, with $degree(g(x))= 8165$, and $degree(h(x))=25$. This multiplication took almost $20$ minutes on my computer. Now, I have to multiply all $h(x)\in GF(2)[x]$ of $degree(h(x))\leq 25$ with $g(x)$. I estimated that it ...
Question: Given a language L, L = {⟨M, x⟩ | M(x) terminates with an empty tape}, show that Lu is m-reducible to L by finding a computable function f: Σ* -> Σ*, where for every w, w ∈ Lu if and only if f(w) ∈ L. (Recall Lu = {⟨M, x⟩ | x ∈ L(M)}) My general understanding of m-reducibility is that if you can assume there ...
Is it always possible to know if there's an equivalent Turing machine to a given machine such that it'll have a smaller number of states? (1-tape machine, minimizing it) My intuition says that finding such machine in the general case is not possible, but what about just knowing if there's a simpler machine? Is my quest...
To prove that a new language is Turing-complete the authors need to show that it can simulate any other (already known) Turing-complete language. I wonder what Turing-complete language is the simplest to simulate? Bitwise Cyclic Tag looks very easy. Are there better candidates?
I am looking for an algorithm to compute the furthest point Voronoi diagram and I don't seem to be able to find anything decent. The most complete one I have found are these slides and this terribly written wordpress site with a cool tool: But I am not finding any well written text explaining and proving an algorithm t...
I have a problem where I'm iterating through a series of tasks and each task requires that a specific file is loaded into memory. The files are not allowed to be unloaded until all of the tasks that use it are complete. E.g. say I have 6 tasks. I will represent each task as a Python dictionary where "files" indicates t...
Let's suppose we have language $Y = \{a^ib^j:i,j \in N^*\}$ defined over the alphabet $\Sigma^{}_{} = \{a, b\}$ If we want to define this language $\Sigma^{*}_{}$ \ $\ Y$ such that we don't have the case of $a$ preceding all occurances of $b$, one way I found it defined is like this: $ \Sigma^{*}_{}$ \ $\ Y = \{w_1baw_...
Imagine a Problem $A$ with input size $n$ for which you can get a proof certificate (polynomial number of bits). Next you try to use this string to verify if your problem is solved or not. You know that verification gets almost as good as if you'd try to verify an $NP$-problem in the sense that the verification process...
I've been working on this question for a few hours now and I've been trying to figure out the question above. My biggest problem is that I don't know what to do with the $>$ and $\geq$ symbols when determining the language. My current work is below. Also, if you have any resources on how to adequately learn pumping lem...
While working through the book Parameterized Complexity Theory of Flum and Grohe, I encountered exercise 1.42: Let $H = (V, E)$ be a hypergraph. A basis of $H$ is a set $S$ of subsets of $V$ with the property that for all $e \in E$ there are $s_1, \dots, s_\ell \in S$ such that $e = s_1 \cup \dots \cup s_\ell$. The par...
Given an array of N elements, I need to split it into k subarrays, where k can be between 2 <= k <= N. A sub-array's score is determined by: (left boundary point - right boundary point of the subarray)^2 + max(subarray). Left boundary point would be the index of the element and right boundary point would be the (index ...
I was solving a coding question which boiled down to this problem. Given a bipartite graph $G=\{V\cup U,E\}$. There is a positive value given for every node in $U$. Now we have to find the matching in which the sum of value of every node in $U$ which is also in the matching is maximum. Consider an example, Let valueAr...
Problem description: Given a P-time function(program) pchk:{0,1} ⃰ -> {0,1}. A function f, f:pchk×ℕ -> {0,1}: f can only simulate pchk with arbitrary argument x. And, f(pchk,n)==1 iff ∃x, |x|<=n, pchk(x)==1. Obviously, the time complexity of f is in O(2^N) (the length of pchk can be assumed a constant). f∈NP and f∉P....
We are running a restaurant. Unfortunately due to mysterious reasons, we cannot tell our chef what recipes to make, we can only prepare him the ingredients for the meals. Fortunately our chef has memorized all possible recipes, therefore if we carefully designate separate tables on which we put recipe ingredients (e.g....
I am solving a problem that involves finding a pow(x, n) without using a pow library function. Following is the algorithm that works (apart from negative n and some edge cases) but trying to understand the math logic behind it. 2^5 -> x = 2, n = 5 (101) The idea is to multiply the answer with 2 ^ (2 ^ i) such that i i...
According to O'Donnell's book ``Analysis of Boolean Functions", in order to determine the Fourier coefficient of a boolean function $f$ on a subset $S$, we take an inner product of $\chi_S$ and $f$ and then divide the result by $2^n$. In the paper by Beigel [1], a different formula is given. Specifically, $c_{S}^{fouri...
Given two disjoint rectangles $(a,b]\times (c,d]$ and $(e,f]\times (g,h]$ in $\mathbb{R}^2$ how can I check with a decision tree of least depth if a given point $(x,y)$ lies within the union of the rectangles? I think that I need 4 decisions to check if $x$ is within $(\min(a,e),\max(b,f)]$ and if $y$ is within $(\min(...
Why the following proof is invaid? Using C-like pseudo-program: Definition: bool S(Func, UInt): S(f,n)==true iff ∃x, x<=n, F(x)==true F is defined in ℙ as a certificate function, so S is in ℕℙ. Now, if S∈ℙ, then, there exists a function F∈ℙ: bool F(UInt n) { return !S(F,n); } Given an UInt m: If F(m)==true, t...
In the standard framing of the traveling salesman problem, we're given a complete graph, meaning every pair of vertices has an edge in between them. And this might be close to accurate when the salesman is flying between cities. If he's driving however, road networks tend not to be dense. You can drive from any city to...
In many computer architecture books (e.g. Computer Organization and Design), the memory layout that is seen by a program is as the following figure. But I wonder about multitask computers, in which many programs execute simultaneously, how the memory layout is. Is the layout actual or simulated for each program?
Given an ordered sequence of $n$ elements, you have to choose a family $A$ of subsets of consecutive elements, such that each subset of consecutive elements (not necessairly in $A$) can be represented as a disjoint union of at most $k$ elements of $A$. Let $A$ be the minimal set with this property, define the function ...
So, consider I have a toy imperative language which ofcourse supports assignment operations. I want to convert each statement of this language into an equivalent turing machine transition. So, the operation y:=x can where I have y and x spread out on a tape (with > marking the start and a trail if infinite $ marking th...
Given a list of intervals with integral endpoints, we want to find out if we can choose one integer from each interval so that no two chosen numbers are adjacent. Can we do this in polynomial time? My attempt is the following greedy strategy: Sort the intervals by the smaller left endpoint, breaking ties by the smaller...
During my self study for graphs, I'm currently learning about topological sorting and ran into a question I'm not sure how to solve. There are typically more than one order of a topological ordering for any given DAG. Some vertices will always be in the same index regardless of the ordering. Find a linear algorithm to ...
How clock rate is doubled in the Manchester encoding? clock cycle depends on bit interval time . In NRZ , Manchester encoding and every other Encoding the clock cycle time is same as bit interval is same. How it is doubled clock rate? ISRO | ISRO CS 2020 | Question 67 To send same bit sequence, NRZ encoding require (A)...
I'm trying to find a regular expression to describe the following language: $\{a^n xa^n | n≥1,x ∈ Σ^* \}$ where $Σ$ = {a,b} So far I've come up with $aa^* (aUb)^* aa^*$ but I don't think that accounts for $n$ being the same.
My Problem is having to work with real-time server in a DES model. I have the following situation: I want to build a discrete event simulation model (Using event scheduling world view). However, this model needs to be connected to another real-time program. Within this model, the event routines create next events based...
I've read that the number of distinct paths in a graph can be exponential in relation to the number of vertices, later I encountered a problem which I spent some time trying to solve on my own. The problem asks to find a family of undirected graphs in such a manner that every graph has a pair of vertices $s$ and $t$ su...
Today I am reading paper Unsatisfiable Linear k-CNFs Exist, for every k by Dominik Scheder, 2007. But I have some problem to understand the proof of Theorem $3.2$. I don't know how to understand the underlined part: How do we create variable-disjoint copies of $F$? Why is the number $2^m$? Theorem 3.2. For any $k\in...
I'm self studying complexity theory and want to prove that SAT is in NP, so I came up with this verifier for SAT: \begin{align*} V &= \text{"On input $w = \langle \phi, c \rangle$}:\\ & \quad \text{1. Test whether $c$ is an assignment for $\phi$} \\ & \quad \text{2. Test whether $c$ satisfies $\phi$}\\ & \quad \text{3....
We are learning about encryption (e.g. RSA) in class at the moment and our teacher told us about a paper he had read (and didn't remember the name) which presented an interesting encryption method. The premise was that the method didn't require the exchanging of any key (no public key of the recipient of a message requ...
Say I have a big matrix, ~50000 rows, ~80000 columns. I want to split it up and solve subproblems on different machines (horizontal scaling). But I need to make sure every column can be combined with every other column. Thinking about, I can't really think of an efficient algorithm that could split the matrix up and st...
Let $A$ be any unary language. Prove that if $A$ is NP-complete, then P=NP. Approach 1: We just have to prove that we can decide $A$ in polynomial time. Consider a Turing machine that on input $w$, scans all the symbols of $w$. If they are all 1s, accept; otherwise, reject. This TM runs in polynomial time, so $A$ is in...
Section 10.1.2 of Sanjeev Arora and Boaz Barak's Computational Complexity: A Modern Approach defines random self-reducibility and proves hardness of the discrete logarithm by reducing a worst case input to a series of random instances. The proof is rather straight forward, but I am having trouble replicating the final ...
I just got a small confusion here, I have a graph for which i need to get number of minimum spanning tree, So, in graph i have 3 edges with weight 2 and 4 edges with weight 3, in such a way that AE = AB = BE = 2 and ED = DC = EC = BC = 3. The solution provided is 3C2*(2+3C2). Initially taking any 2 edges from edges wi...
I am looking for answers creating 500 samples of non-stationary Time series based on its probability distribution preferably using monte-carlo simulation. DATA LINK Secondly, the most example available on any platform are considering normal distribution for creating the sample (like Monte Carlo) which sees fitting wit...
The multi-source shortest path problem for unweighted and undirected graph is as follows: Given an unweighted and undirected graph, find the length of the shortest path between any pair of vertexes. A straightforward method is to use BFS starting from each vertex, as the time complexity of BFS is O(V+E), the total time...
So, I have N sets of objects of various sizes. I want to put them in order, in a way that's as much "alternative" as possible. For example, if I have 5 A, and 6 b, that's easy: B A B A B A B A B A B If I have 5 A, 6 B, and 2 C, it could be something like that: B A B A C B A B C A B A B Any idea how I could compute that...
The problem is: split the given array with $L$ elements, $A$, into $K$ subsets such that maximum sum of all subsets is minimum. I have known that the problem that partitioning the multiset $S$ into two subsets $S_1$, $S_2$ such that the difference between the sum of elements in $S_1$ and the sum of elements in $S_2$ i...
Given a series of n numbers, I need an algorithm that runs in worst case O(n*k) to figure out how many arrangements of those n numbers will give me a score of exactly k. Note that the series does not contain duplicate elements. The score of a series of numbers is calculated by the number of smaller numbers an element i...
I would like to ask a very fundamental question regarding distance-regular graphs. Denote $d(u,v)$ as the distance between node $u$ and $v$. Distance-regular graphs are graphs such that for any pair of vertices $u,v$ with $d(u,v)=i$, there are always $b_i$ neighbors $w$ of $u$ with $d(w,v)=i+1$ and $c_i$ neighbors $w$ ...