instruction
stringlengths
35
29.1k
Problem Description Given an array $A$ of $n$ integers, find the minimum number of operations to turn it into a new array $\widehat{A}$ with a (weakly) descending order: we require that $\hat{a}_i \geq \hat{a}_j$ for all $1\leq i<j\leq n$. Here an operation means either increasing or decreasing an element by $1$. For e...
I stumbled upon a statement like the following, in the context of prediction (classification) with a neural network: "If we predict the class of a given data point $x$ with random weights, the output will be random and thus the classification will be wrong in most cases." This is true, no doubt about that. But what wou...
Does someone know how to solve the below? $$T(n)=2T(n-1)-T(n-2)+5n+7$$ $$T(n)=2T(sqrt(n))+(logn/(log(logn))$$ $$T(n)=T(sqrt(n)[5])+log(log[3]n)$$
Can someone explain to me (perhaps with an example) why $AF (\phi \lor \varphi)$ is not equivalent to $AF \phi \lor AF \varphi$. This seems counter-intuitive, because in any path where $\phi$ (or $\varphi$) is true, $\phi \lor \varphi$ is true as well. Or is my reasoning wrong? Thanks
Are there reductions from SETH (Strong Exponential Time Hypothesis) to lowerbounds against threshold circuits? (maybe for computing Boolean functions of the form OR-of-AND-of-OR) In threshold circuits I am allowing for circuits which end with a summing gate and hence these circuits are computing real valued functions...
Some definitions, just to not create confusion: A sparse graph is a graph that contains a number of edges less or equal than the number of vertices. In $k$-clique problem we are given a graph and an integer $k$, and the task is to decide whether the graph contains a $k$-clique. I think that even if we have a sparse g...
i don't know if right answer is 4 or 5 ! what did you understand from this question if it was a QCM ? thanks
Here is my question: Given a compressed suffix tree of string S and a substring T. I need to return all substrings of S that begins with the substring T sorted by lexicographic order. My approach: I can traverse the suffix tree and find the edge / node which last letter of T is written on it. The subtree of this edge b...
I learned that when you have a binary heap represented as a vector / list / array with indicies [0, 1, 2, 3, 4, 5, 6, 7, 8, ...] the indicies of the children of element at index n can be found with $leftchild = 2n + 1$ $rightchild = 2n + 2$ I can see that this formula works and have played around with it for a little b...
Given a set $S$ with a finite number of elements, where each $s_i\in S$ is itself a set with a finite number of elements, how do you partition $S$ using as few partitions as possible, such that all elements of $S$ in each partition are disjoint? For example, given $$S = \{\{1,2\},\{2,3\},\{1,4\},\{1,2,4,5\},\{2,5\},\{2...
I have a distance matrix which is created through a predefined pattern (or formula) and I want to find elements with minimum distance "d" from each other, in order to do that I search for the maximum clique in the graph which is created with distance matrix. Knowing that there exists a pattern in the distance matrix ca...
Can Lamport's Bakery algorithm be used for controlling concurrency in soft real time database system (case study of stock trading)?
$L$ is the language accepted by the above PDA : $L = \{a^n\mid n\geq 0\}\cup\{a^n b^n\mid n\geq 0\}$ and is deterministic context-free is the language accepted by the PDA how can we accept $a^n$? As it doesn't contain an epsilon transition at the end right ? Is acceptance by both the final state and empty stack possib...
I try to understand and apply nested Monte Carlo Research. Yet, after reading its designer's paper I didn't understood why he added an if after an if-else condition. Shouldn't the last if be always skipped ? Indeed, in nested(position, level) we can find at line 3 and 5 if and else conditions. When would the second if ...
We say that the language $L$ is Cook Levin deterministic reducible to xor satisfiability in polynomial time if and only if for each word $w\in\Sigma^*:w\in L\iff f(w)\in XORSAT$ where $\Sigma=\{0,1\}$ and $f:\Sigma^*\rightarrow\Sigma^*$ is the function in the Cook Levin reduction that was introduced in 1971. In other w...
Given a string, I have to return the smallest possible value of $k$ such that all of its sub-strings of length $k$ have at least one common character. Each sub-string must have the same common character. Examples: y d c b f Answer = $3$ (common character is 'c') n n n n n n n n n Answer = $1$ (common character is '...
I have to demonstrate Prim's algorithm for an assignment and I'm surprised that I found two different solutions, with different MSTs as an outcome. Now I now that shouldn't happen, so I wonder what I did wrong ? Here is the exercise: The first solution (using Prim's) is visiting the nodes in the following order: v0,v...
I have a problem where I am asked to explain why the language that has words made of $a$ and $b$ such that the number of $a$'s is equal to the number of $b$'s, can be generated by a context free grammar. I am not sure of what is asked here, will finding such a grammar work? What should I do?
Suppose I have a tree $T=(V,E,w)$ with vertex weights $w(v)\ge 0$ for all $v\in V$. I want to partition this tree into $k+1$ trees by cutting $k$ edges such that the deviation from the mean of the sum of vertex weights in each partition is minimized. Is there an algorithm to get a good approximation in polynomial time...
In the textbook by Arora and Barak in Chapter 1 and section 1.7 they have proved how a UTM can do simulation in $O(T \log T)$ time. I have read it and understood everything except that how the $k$th shift can cost just $O(2^k)$ time. One can read the proof for complete details but I can explain my doubt as the followin...
When converting NFA to DFA, do I always get the minimal DFA or not?
I was talking to a professor who made a comment to my question. Me: So much of quality literature around this topic ( IP Protection for Neural Weights) emanated in 1990-1991, I'm truly at loss to understand what went wrong. Why did everyone suddenly stop worrying about this topic? Prof: I think AI was starved o...
Words synchronous and asynchronous can be met several times, in different contexts, when studying computer science. As an example : Synchronous and asynchronous circuits. Synchronous and asynchronous calls. Synchronous and asynchronous messages. I never really understood the real meaning of those terms, and also the ...
For given array $A$ of size $N$, note that the array is going to be permutation of the numbers from 1 to N, each number will be there exactly once, we want to obtain data structure being able to perform two types of operations. A. Update operation: Reverse the elements in the range $A[l_i \dots r_i]$ B. Query operation...
I understand how to use linked lists, and build algorithm using them. But I don't understand how can we prove their correctness, even of simplest algorithm. I haven't even found a good tutorial reference. Googling suggested that Cormen's book should be a good starting point. His discussion about linked-list (section 10...
I'm new to computer vision and am looking for advice. I'd like to perform computer vision on a spiral system, in this system a down flowing liquid separates into different regions based on density: The regions can be visually distinguished based on colour. What I'm hoping to do is automatically detect changes in the a...
There is a list of objects. Each object cannot be in a bin with some other objects. How can I find the minimum number of bins required to hold all the objects (and the objects in them)? My current algorithm: For each object in the list, see if any of the currently existing bins will hold it. If yes, stick it in the fir...
PROBLEM Given a set of features $A = \{a_1, a_2, \ldots, a_m\}$. You have a set of objects $X = \{x_1, x_2, \ldots, x_n\}$ such that each object has certain combination of features. Some objects can have no features at all. Some other objects may have all of them. Two different objects may have same sets of features. I...
In trying to design an algorithm, I needed a datastructure to implement a restricted kind of set partition refinement, where the sets $X$ to split on are subtrees. Specifically, given an arbitrary tree $T$ (computed earlier in the algorithm), and an initial partition where everything is in the same set, I need to do tw...
I am reading this example of FSA from book Martin & Jurafsky "Speech and Language Processing". As per definition of FSA you can only transition to one state after consuming one input. In this example if the input is say "twenty" to which state it will transition q2 or q1 ? Say if the input was "twenty one". After cons...
I do not understand how a program such as an interpreter can run and create code "on the fly" to run. Can someone help me understand what such a program would have to do in order to function? I'm familiar with the process that a compiler takes the input file, creates the AST, produces the machine code, then the result ...
I know being a decidable language doesn't necessarily mean that every subset is of it is decidable, but does every undecidable language contain a decidable subset?
The problem is, we are given points $p_1,\ldots,p_n$ on positions of a length-$n$ binary sequence $x_1,\ldots, x_n$, and if the $i_{th}$ position of a sequence is $1$, then we "earn" $p_i$ points. So the total points is $\sum_{i=1}^{n}x_ip_i$. Our rule is that we cannot have three consecutive $1$'s, and we want to know...
I need to learn about accumulator machines, but there is next to nothing written about them. Computer architecture channels seem to be flooded with general-purpose register ISAs (like MIPS, x86, etc). I know that accumulator machines only have one register (called the Accumulator Register) that is implicit and not spe...
I encountered the following interesting problem on stackoverflow: Given numbers $a(1)<\cdots<a(n)$, find a permutation $\pi$ that maximizes $$\sum_{i=1}^{n-1} a(\pi(i)) a(\pi(i+1)).$$ The answers there claim that the answer doesn't depend on the numbers themselves, and is always given by the order $$\ldots,a(n-5),a(n...
I was trying to understand the definition of countable set (again!!!). Wikipedia has a very great explanation: A set $S$ is countable if there exists an $\color{red}{\text{injective}}$ function $f$ from $S$ to the natural numbers $\mathbb N$. If such an $f$ can be found that is also surjective (and therefore $\color{...
To prove that the set $\mathrm{DIAG} = \{\langle M\rangle \mid \langle M\rangle \notin L(M)\}$ is not decidable, we can assume, to the contrary, that there is a Turing Machine $M$ such that $L(M) = \mathrm{DIAG}$. Consider the string $\langle M\rangle$. By definition of $\mathrm{DIAG}$, $\langle M\rangle \in \mathrm{DI...
I am interested in solving a variant of the coin exchange problem. Recall the formal definition of the coin exchange problem: Given a value N, if we want to make change for N cents, and we have infinite supply of each of S = {S1, S2, .. , Sm} integral-valued coins, how many ways can we make the change? The order of coi...
Obviously it always depends on the specific case. However, my question is how to label data efficiently without writing a source code from scratch which solves the final problem itself? For example, suppose that I want to use the $k$-Nearest Neighbours algorithm to classify tables from images according to their shape (...
So this is how i solve it but someone told me its wrong: $B-C = B\cap \overline C $ and since $B\cap \overline C $ is r.e and B is recursive recursive sets are closed under intersection then $\overline C $ is not Recursive(because if both of them were recursive then the intersection would be recursive), also since r.e ...
As I teach myself dynamic programming, I have learned about the coin exchange problems. Specially this site: https://www.geeksforgeeks.org/dynamic-programming-set-7-coin-change/ provides great insight about it. Specifically, the following implementation of a tabulated-DP-based solution for this problems is presented as...
In the paper "Simrank++:Query Rewriting through Link Analysis of the Click Graph"(http://www.vldb.org/pvldb/1/1453903.pdf), the formula to compute the similarity between $q$ and $q'$ is as follows: \begin{align} s_\mathrm{weighted}(q,q') =&\ \mathrm{evidence}(q,q')\cdot C_1\cdot\\ &\sum_{i\in E(q)}\sum_{i\in E(q')} W(q...
I was reading about the differences standards and specifications for C. I understood that programming languages are usually stadardized and I learnt that there are different approches to stadardization. Anyway I did not understand yet what this terms refer to. If I think to C, I believe it refers to a standard API, th...
I was recently watching a video on the classes of P and NP, in which it was claimed that there have been 'several' problems that were presumed to be in the class of NP, which have since been shown to be in the class of P. Unfortunately, no examples of such problems were given. Could anyone verify this statement by prov...
We know that std::vector in C++ is implemented as a dynamic array with specific pattern of reallocation (multiplying capacity by a constant), which allows it to reach O(1) amortized push_back time. But changing capacity of a vector is essentially allocation of new memory block and copying old data into it. That means w...
I´m looking for an efficient algorithm that will find reverse cartesian products. Mathematically, given $S \subseteq T^n$, I want to express $S$ as a union of sets $A_{i,1} \times A_{i,2} \times \dots \times A_{i,n}$, for $i=1,2,\dots,k$; and I want to minimize the number $k$. Is there an efficient algorithm to solve ...
how can i prove Demorgan's law (X+Y)'=X'. Y'?I already tried studying book but doesn't understand the first step so plz answer in detail.(beginner here)
Introduction I'm trying to formalize (generalized) Turing machines in Mizar (Wikipedia) and I'm looking for the optimal way to formalize the (generalized) tape. Note that you don't need familiarity with the system to answer. I will present two ways for formalization and I ask you to think of different approaches that m...
Is it possible to do an edge detection using ONLY opening and closing operations? Where: opening- $X\bullet B = (X \ominus B) \oplus B$ closing- $X\circ B = (X \oplus B) \ominus B$ (I know we can do it with erosion dilation)
I have to find an evaluation function in which we evaluate the state of the game in each round. The game is like " roborally " , it is 2 player-Game in which there are a board and cards that decides my movements on each cards there is number of translations , number or rotations.The goal of the game is ...
While asking this question on "what exactly is standardization", I remebered that another related term that always came up while reading about C libraries was the term "specification". To avoid asking more than one question in a single post, I decided to open another post that I hope will clarify what is the difference...
I'm learning about CRC and Hamming distance and I have three questions. Lets say we have binary code described by ($+$ refers to sum modulo $2$): \begin{alignat*}{1} a_1 &+ a_2 &+ a_3 &+ a_4 &+ a_5 &= 0\\ a_6 &+ a_7 &+ a_8 &+ a_9 &+ a_{10} &= 0\\ a_1 &+ a_6 &+ a_{11} &&&= 0\\ a_2 &+ a_7 &+ a_{12} &&&= 0\\ a_3 &+ a_8 &+...
I need to draw a combinatorial circuit that when an integer is greater than 7 and is an odd number, the output will be 1. There are 4 inputs representing 4 bits and 1 output wire. The output wire is only 1 if an integer is greater than 7 and is an odd number. My attempt: If I segment the 4-bit input as r x y z where if...
I want to learn Artificial Intelligence techniques by writing a game (or maybe any fun project). Can you suggest any games? Consider that I'm a beginner in AI, but have basic knowledge Algorithms and Data structures (graph algorithms and stuff like that). I'm going to use Python.
Perfect partition problem (PPP): given $x_1,...,x_n\in \mathbb{N}$ we want to know if there's a set $S\subset \{1,2,...,n\}$ such that $$\sum_{i\in S}x_i=\sum_{j\notin S}x_j.$$ Single machine task schedule problem (SMP): a machine can perform only one task $T_i$ with duration $d_i$ at a time and we want to know if all ...
I'm studying for an exam on Advanced Computer Architecture and in an exam question the question above is asked. I know that branch prediction is crucial in superscalar processors in order to exploit ILP as much as possible, but I was wondering what could be the precise reason why superscalar processors use dynamic bran...
Does there exist a general algorithm which can output a finite and complete description of the (programming) language in which it is written, if it is given the permission to execute programs in that language? The description should be sufficient to associate a correct output for any given program in that language.
L = {< M > $\mid$ L(M) = M halts on all inputs in atleast 100 steps }. Answer to this question is given undecidable in my book without any explanation but I think it is decidable. $\overline{L}$ = {< M > $\mid$ L(M) = M halts on some input in atmost 100 steps } For the above language, we can feed strings of length r...
Suppose I derive my application problem as the following type of optimization problem: $$\min_X ||X||_{2,1}+||X^\top||_{2,1}+||X-A||_F,$$ where $X$ is a (square) matrix, $A$ is a constant matrix. I am wondering is there any current optimization algorithm can solve this optimization problem (better with some convergenc...
So I'm currently taking discrete math II at my university and I came across a somewhat philosophical question (so I apologize if this is question is hard to answer precisely) of whether mathematicians and computer scientists view computation in the same way. We computer scientists define computation with the Turing mac...
A language $L$ is PSpace-complete, if it meets two conditions: It is in PSpace. Every other PSpace-complete language reduces to it in polynomial time. Question: suppose we change the second condition to polynomial space (instead of time)? Why is it so that then SAT would be PSpace-complete?
How many automorphism does a clique with 6 vertices have, when we take two edges from it (two edges that don't have the same vertex)? I thought the answer is 6*(n-2)! Number of automorphism for a full graph Kn is n!. Clique can be seen as a full graph since all of the vertices must be connected to each other. Since we ...
Number of different paths (length N) between vertices x and y inside of a clique Kn or a bipartite graph Kn,n? I am looking for simple paths. Therefore, in case I have n vertices N can be maximum n-1. For example, if n=4, we have maximum M = 3. For 3 we have 8 different paths, for 2 also 8 and for 1 only 6. I have done...
$INFINITE_{DFA}\equiv \{(A)\mid A \text{ is a DFA and } L(A) \text{ is an infinite language}\}$ Here $ (A) $ denotes the encoding of DFA Is above language regular, CFL or recursive ? I know that above language is recursive for sure. I am not able to decide whether it's regular or not. For regular, we know that regul...
Let's say we have a graph $G$. We pick one edge from it (any edge). Will there always be such a spanning tree that contains that very edge? I think the answer is yes, because no matter what we do we can always create such a spanning tree so that the very edge we picked is included. Of course, a more formal proof would ...
I occasionally see these terms used and I'm not really sure what is meant by all of them. Is it possible for an asymptotic bound that is not Big $\Theta$ bound to be "tight"? What does it mean for bounds that are not Big $\Theta$ to be tight? Is there a difference between a tight Big $O$ bound and a Big $\Theta$ bound?...
How can it be proved that any minimum edge cover is a forest? As far as I understand an edge cover could be one connected component therefore a spanning tree). If it's the case then it wouldn't be a forest.
How can it be proved that if there's an algorithm which in polynomial time determines whether a graph has a Hamiltonian cycle then there's an algorithm which can find such Hamiltonian cycle in polynomial time as well? Note: there's no need to devise the actual algorithm I just need to prove that one causes the other ...
I want to analyze a clustering algorithm that clusters data stream. Since the stream can be unbounded, I cannot write O(N^2), or explicitly denote the size of the stream. How can I use the arrival rate of the data for the computation complexity? Do you have any other idea for correct analysis of stream computation (for...
How come $REC$ languages are included in $NRE$. The definition of a language in $REC$ is . $L \in REC$ if there is a turing machine $M$ that recognizes the language $L$ and that stops on any given input. It makes sense that $REC$ is included in $RE$; $L \in RE$ if there is a turing machine $M$ that recognizes the lang...
I'm going through a video of EDX course which talks about Big O notation. At the end of the video they have some questions but the $O(n^2)$ answer is confusing me. It feels like a mistake, but I just want to make sure. The question is : Imagine that we have a data set of 10 items. We run an algorithm on that data set,...
I'm starting to learn machine learning, and have honed in on a problem to get my hands dirty with: how to detect a trend reversal in a time series. I've asked this question on stats.SE more than a year ago, but now I'm looking for a machine learning approach. How would I go about this specific problem vs. generally id...
Given two Turing machines $M,M'$, is it possible to check whether $M$ invokes $M'$? In other words, is the following problem computable/decidable? Inputs: Turing machines $M,M'$ Question: Does $M$ ever invoke $M'$? Perhaps we can look whether $M$ includes the code of $M'$ in it? In a C program we can check whether a f...
Let $T$ be a (possibly improper) binary tree with $n$ nodes, and let $E(T)$ be the sum of the depths of all the external nodes of $T$. (In a proper binary tree each node have 0 or 2 children. An external node is a leaf, i.e., any node that is not an internal node.) Is there a configuration for $T$ such that $E(T)$ is...
It seems intuitive to solve a 2D dot-to-dot travelling salesman problem by eye using a greedy strategy. However we can only solve the TSP by eye if the graph is topographically accurate e.g. if A to B is 10 and A to C is 10 then B to C can't be 1000. Is the greedy strategy still sub-optimal when we obey 2D scaling, ie ...
I am new to Context Free Grammars and am having trouble wrapping my head around how to approach writing a CFG for the following language: L = {a^n b^m+n c^m | n>=0, m>=1} I have a basic understanding of how this should work, but the examples we went over in class usually only had either 2 symbols dependent on each oth...
I've tried a few tricky languages such as D = { w | w has an equal number of occurences of 01 and 10 as substrings} but I don't have the means to prove this one as being not regular (and I cannot confirm if it is or not). I know of the pumping lemma, which I have used on very basic languages to prove they are not regu...
Came across this question : State whether True or False A prime attribute can be transitively dependent on a key in 3NF Answer: True How could this be true? Because as far as I know, A relation initially in 1NF is said to be in 3NF when partial and transitive dependencies have been eliminated. Correct me if I'm wrong...
What is the possible biggest and the smallest number of edges in a graph with N vertices and K components? I think that the smallest is (N-1)K. The biggest one is NK. Is this correct? I think it also may depend on whether we have and even or an odd number of vertices?
Given a set of n jobs with [arriving time, service duration time, penalty per unit of time] find a schedule with lowest total penalty. Notes: Arriving time is the time when objects aarivies to processing system. All objects can arrive at the same time Processor is able to process only one object at the same time S...
I am trying to find the best poker hand in a connected grid, where order matters. An illustration is the best way of explaining the situation. This grid has 12 random cards, in random positions. Each card is connected to the vertically, horizontally and diagonally adjacent cards. The hands are standard poker hands but...
Given a set of Voronoi edges. Each edge consists of (indices of, pointers to) 4 points: $\mathrm{left}$ and $\mathrm{right}$ are sites, $\mathrm{begin}$ and $\mathrm{end}$ are vertices (one of them or even both (in case if all the sites lies on a straight line) may point to infinity). $\angle \Big(\overrightarrow{(\mat...
Right now I am trying to learn how to work with automata and regular grammar, and I encountered the following exercise: $(1^*01)11$ I found the following solution, but I am not really sure if it's right. What I didn't understand it's from where exactly I should continue after I close the parenthesis or start a new one...
Definition : An abelian group is a group in which the result of applying the group operation to two group elements does not depend on the order in which they are written Input : Two finite abelian groups $|G| =n$ and $|H|=n$ by their table representation Find : Is $G \cong H$? There is an $O(n)$ running time algorithm...
When I'm working on a algorithm problem, I can usually find a top-down solution that works with recursion. Then for optimization purpose I try to do a bottom-up approach (dynamic programming) to remove the recursion stack, and I struggle. I have a really hard time initializing the array with the correct value, and then...
I keep stumbling upon this term in my lecture notes tutorials and assignments, but I have no clue what it means, google doesnt give me anything usable at all. Here is an example how this term is used (material in german, but self explanatory really) So my question is: is this a regional dialect or some important techn...
This may be a known problem, with known approaches, but I can't find the right way to search for it. I would like to name points along a line of unknown final length such that their name reflects their relative position to all other named points on that line. One should be able to insert an arbitrary number of names a...
Given $n>0$, $k>0$, and a prime number $p$, compute: $$n^k\mod p$$ in $O(\log k)$ time. Here $x \mod y$ means the remainder for $x$ being divided by $y$. For example, $2^3\mod 7 = 1$. You assume that all of $n$, $k$, and $p$ can fit in a single word in your computer. Moreover, if $x$ and $y$ are numbers with sizes bou...
Basically, you have $n$ integers. The data structure is for your choice, it is ok to do polynomial time preprocessing on them. Then you have multiple questions "Is an integer $k$ in the set?" My question is about the best way we know in terms of time/space to answer this query. Ultimately, the time should be guaranteed...
Suppose an edge $e$ is in a minimum spanning tree $T$ of a graph $G$. If the weight of $e$ decreases by some positive number, how to prove the the MST is unchanged (still $T$) ? It seems obvious by Kruskal's algorithm if the weight of all edges are different, if the weights are same, or some of them are same, how to pr...
Suppose we have an undirected graph $G=(V,E)$ with $n$ vertices and with max degree of $d>0$. I need to prove that number of connected subgraphs of $G$ with at most $n\geq k>0$ vertices is $M\leq n\cdot d^{2k}$ My approach was by induction. For $k=1$ it is true Suppose we want to prove it for $k=n$ . let's take any ver...
I am trying to understand randomized AND-OR Game Tree Evaluation. I am stuck with proving the most basic case, namely, an OR node with two leaves (AND node with two leaves is similar). (OR) = 1 / \ / \ Possible inputs: 1 1 ...
I am working in grasshopper and need a formula that can divide any surface into equal points. I need an algorithm that can give me equidistributed points on the surface Chebyshev
Say we have some BNF rules for example: $$A ::= B C$$ $$Dx ::= ExFx$$ $$x ::= y$$ So we might start with $Dx$ and apply rule 2 to get $Ex Fx$ and then apply rule 3 to get $Ey Fy$. But starting with $Dy$ we can't get anything. Unless... What if we extend the BNF rules to let the rules apply to other rules. Then we could...
Show that the following graph is planar or not. My first assumption is that this graph is not planar, but could not find a reasonable prove (except saying that I tried drawing it in different ways in plane, but couldn't). We know that a graph is non-planar if it contains either K5 or K3,3 as minors. I tried getting I ...
Assume we have a sorted list of n numbers, I want to map those numbers to m buckets or clusters. For each bucket the average of all numbers in that bucket will be computed. The task is to find a mapping, so that the difference between those cluster averages and the original numbers is minimal. Example: List: [1, 2, 3...
I am looking for an example where the optimal solution for the LP problem is equal to the optimal solution of the ILP problem, but the solutions are different. All I managed to think of was the example of the knapsack problem, when the sum of all the weights were less than W (max weight). However, in this solution x=x'...
I've got a basic doubt for such I'm not getting convicting argument. See, We say a TM $M$ is Turing recognizer if it accepts a string belonging to the language $L(M)$ & says $yes$ if the string belongs to it. But how it will know when it should stop to arrive at decision? For e.g, suppose there is a string $w$ which be...
So I found a solution to this problem here http://marcodiiga.github.io/number-of-even-sum-subarrays but I am unsure of exactly how it works. I get the premise that in order to have an even sum it must be even or even + even or odd + odd. However, I am not sure how this person manages to take into account the fact that ...
Notations : AUT$(X)$ (where $X$ is a graph) is the group of automorphisms of the graph $X$ $G=\langle A \rangle $ means group $G$ is generated by set $A$. $G_{\{\Delta\}}$ is the set-wise stabiliser of $\Delta$ STAB Input : $A \subseteq \text{Sym}(\Omega)$ and $\Delta \subseteq \Omega$ Find : Generator of $\langle A \...