instruction
stringlengths
35
29.1k
so I need to prove the following: Prove that $n-1$ comparisons are sometimes necessary to test whether an array with $n$ distinct elements is sorted in increasing order, for any $n \geq 1$. The problem comes with the following hint: Assume an algorithm exists that always correctly tests if the array is sorted using at ...
Chiba and Nishizeki showed that it is possible to list all $k$-cliques (cliques on $k$ nodes) in time $O(m \cdot a^{k-2})$ where a is the arboricity of the graph and $m$ the number of edges in the graph. http://www.ecei.tohoku.ac.jp/alg/nishizeki/sub/j/DVD/PDF_J/J053.pdf We have designed an algorithm that can do it in ...
Fitch's algorithm solves the small parsimony problem - given tree topology and leaf labels, but not internal node labels, find best internal node labels (i.e. best score) for that tree. The score is the number of edges $u->v$ with different labels $L_u \neq L_v$. I need a variant on Fitch's algorithm when it is known t...
There is a method that I want to calculate its complexity in asymptotic notation. It calls additional methods(equals and substring) which complexity is $O(n)$. If it was $O(1)$, I could figure out complexity of the calling method. I have tried some operations; however, I'm stuck on calculation with the additional part....
I have a set of expressions $E_1 .. E_n$ over boolean variables and I'm looking for an assignment to the variables so that all expressions are satisfied. Normally this would be NP-complete, but I found two particular properties over the set and I'm looking to combine and exploit them. The idea I have is based on gaussi...
After the release of the AIGER library to handle and-inverter graphs sometime in 2006 (I think), some circuit SAT solvers were released in 2006-2008, and in a few SAT Races/Competitions there were AIG tracks. However since then it seems the focus has been entirely on either SMT or improving clausal SAT solvers. Intuiti...
I would like to know why the following statement The running time of algorithm $A$ is at least $O(n^2)$ which means the best-case running time of $A$ is $O(n^2)$ is meaningless (CLRS page 53). But the following is not The worst-case running time of algorithm $A$ is $\Omega(n^2)$ (used in CLRS page 160).
I'm doing my homework, but there's one task that I didn't get the idea. Task: Recall the alternative definition for the star of a language A that we gave just before Theorem 2.3.1. In Theorems 2.3.1 and 2.6.2 (which is about closure under union operation), we have shown that the class of regular languages is closed und...
Given an array, I need to sort the array (if not already sorted) in either decreasing or increasing order so that number of swaps are minimized. I was thinking of first determining whether it is increasing type or decreasing type i.e. the type in which least swaps would be required and then sort my array in increasing ...
I am working on the following problem. There are N vertices and M roads connecting them. Some of the roads are broken. I have to go from vertex 1 to vertex N taking at least one good road and find the minimum number of broken roads taken. If no good road is taken, display −1. I am trying to use Dijkstra shortest path a...
The number of ways to split $n$ items into $k$ nonempty unlabelled subsets ($k<n$) is a Stirling number of the second kind.(https://en.wikipedia.org/wiki/Stirling_numbers_of_the_second_kind) Is there an algorithm to generate all the possible combinations?
Where can I download some interesting cellular arrays for Conway's Game of Life? Arrays such as the Gosper glider gun, etc? I can find the images easily enough, but are they available somewhere in binary format? And is there an orderly library somewhere?
You can't find a solution online for it that doesn't run in polynomial time complexity, when using dynamic programming. Have all these sites secretly solved P=NP, and no one knows about it?
I'm trying to determine correct notation for the given functions which are $f(n) = n$ and $g(n) = (log(n))^{100}$. Moreover, I don't understand while calculating its complexity using limit because calculator shows that it goes infinity, so f(n) is growing faster than g(n). But, I found vice versa. Could you explain me...
I have to create new language with languages $L_a = \{a\}, L_b = \{b\}$ and with set operations which contains only words with even length with odd length and first letter not equal to last letter So my solution for part 1 is this. Am I rigth? $L_n = \{aa, bb, ab, ba\}* = (L_a.L_a \cup L_b.L_b \cup L_a.L_b \cup L_b....
Given two sets $A = \{a_1, a_2, \dots, a_n\}$ and $B = \{b_1, b_2, \dots, b_n\}$, both consist of positive numbers, this problem is to find a subset $S$ in $\{1, 2, \dots, n\}$ to maximize $$ \left(\sum_{i \in S} a_i\right)\left(\sum_{i \notin S} b_i\right) $$ A naive solution is to iterate over the powerset of $\{1, 2...
I was trying to understand what a reservation table is in the context of pipelining, when I found this reference here, where the author mentions that there are static and dynamic pipelines. According to him/her, There are two types of pipelines: static and dynamic. A static pipeline can perform only one function at a ...
My professor has asked me to prove the following: Prove that we can use an algorithm for linear programming to solve linear inequality feasibility problems. The number of variables and constraints used in the linear programming problem must be polynomial in n and m I supplied him with an intuitive proof but h...
(Almost) every algorithm runs in exponential time, or merely in 'pseudo-polynomial' time. Given a list of integers, does it contain the number 2? $\mathcal{O}(N)$, where $N$ is the size of input, right? Wrong. Express $N$ as $2^b$, and it's $\mathcal{O}(2^b)$ and it becomes exponential runtime. So every problem (basica...
With efficient I mean of a big O of polynomial time in the number of digits each number has.
Consider the following BNF Grammar G: object-expression ::= id | id ( object-expression ) | object-expression . id | object-expression [ object-expression ] | object-expression . id ( object-expression ) I am attempting to construct a set of LR(1) items bas...
I am trying to find an algorithm that generates all directed multigraphs with a given number of vertices and arcs up to isomorphism (no two generated graphs should be isomorphic). I also want to allow self-edges. I have done some research on this, and I found the tool "nauty" which can generate graphs up to isomorphism...
I've been trying to implement this paper from Boris Epshtein, Eyal Ofek, and Yonatan Wexler, the pioneers of Stroke Width Transform . Having a simple image with random texts, that underwent gray scaling. Then I have produced two edge maps using two different algorithms for output comparison (for later) , Sobel and Cann...
What are the problems that are in co-NP but not in NP? i.e, those problems where incorrect strings can be deterministically verified in polynomial time but the correct strings can't be.
Given an array a of length n of $-1$s and $1$s, and another input $m$, I was supposed to minimize the longest continuous streak of $1$s or $-1$s after flipping $m$ $-1$s to $1$s or vice versa. I know how to maximize it but can't figure out how to minimize it. I maximize the number of $1's$ by sliding window method. Ta...
I found a proof that shows CFL is closed under inverse homomorphism. First of all the Definition of an homomorphism and its inverse: $h: \Sigma^{*} \rightarrow \Delta^{*} \ \ \ h(L) = \{h(w) |w \in L\}$ $h^{-1}: \Delta^{*} \rightarrow \Sigma^{*} \ \ \ h^{-1}(L) = \{w | h(w) \in L\}$ The proof I found works as follows: ...
Let me define the problems first Polynomial Identity Testing $(\mathsf{PIT\text{}})$ Given : A polynomial $p$ over some field $\mathbb{F}$. Decide : Are all coefficients of the monomials of $p$ are equal to zero ? Polynomial Identity Testing $(\mathsf{PIT1\text{}})$ Polynomial identity testing defined in non commutat...
Having a simple 2-SAT problem where the equation is simply: $a \lor b$ We have two implications: $\lnot a \Rightarrow b$ $\lnot b \Rightarrow a$ Thus, in the graph we build we add edges similar to the arrows above. What exactly do the arrows symbolise in this instance? I've read that they means if $a$ is true, $b$ mus...
I'm confused about how the bead-tiling algorithm for the Dubins' TSP from this article works: On the Dubins Traveling Salesperson Problems: novel approximation algorithms Ketan Savla, Emilio Frazzoli, Francesco Bullo http://www-bcf.usc.edu/~ksavla/papers/KS-EF-FB:06h.pdf What does the algorithm return? Does ...
Null, Linda; Lobur, Julia: The Essentials of Computer Organization and Architecture, Jones&Bartlett Learning 2006, Ch. 7 Ex 2: Suppose the daytime processing load consists of 60% CPU activity and 40% disk activity. Your customers are complaining that the system is slow. After doing some research, you have learned th...
The same question has been asked here Some authors define $\Omega$ in a slightly different way: let’s use $ \overset{\infty}{\Omega}$ (read “omega infinity”) for this alternative definition. We say that $f(n) = \overset{\infty}{\Omega}(g(n))$ if there exists a positive constant $c$ such that $f(n) \geq c\cdot g...
I was wondering if there are algorithms for finding the shortest path that contains some selected $k$ nodes in a weighted graph. More specifically, the path that we are looking for needs to pass through all the $k$ nodes, but can contain other nodes from the graph and can visit those $k$ nodes in any order. In additio...
Given two sets, S1 and S2, and their corresponding bloom filters, BF1 and BF2, is there a way to prove that |BF1 ∩ BF2|/|BF1 ∪ BF2| = |S1 ∩ S2|/|S1 ∪ S2| (we can assume both bloom filters are generated using the same set of hash functions)? If not, is there a way to approximate one given the other?
Sorry for the confusing title, but I'm trying to find out if a certain algorithm or class of algorithms fits this description. Given an algorithm A, computing A(x) can be computionally easier if A(g) is known, where g is close to x, and it's easier the closer g gets to x. So also, the amount of computation A has to do ...
I need to prove or disprove if these two languages are same. So I assume that these lanaguages are same because I think that every word from $\{a,b\}^*$ could be concatenated from two words $x$ and $y$ where $|x|_a = |y|_b$. So $x$ and $y$ must belong to $\{a,b\}^*$, too. Then I can write and prove this: $\{a,b\}^* \su...
On Wikipedia it is Written: NP and co-NP are also thought to be unequal.[1] If so, then no NP-complete problem can be in co-NP and no co-NP-complete problem can be in NP.[2] So Subset Sum is NP-complete (given integers find a Subset that sums to 0). CoNp is, the set of decision problems for which a "no" answer has a de...
According to the book, Introduction to Computation And Programming Using Python by John V Guttag, a computer does only two things: Store data Manipulate data But is this all? I mean, without I/O, can a computer be considered useful?
I am attempting to understand the inner workings of the open source string matching library Hyperscan. It takes a multiple-engine approach to the problem of generating string matches, and I'm still in the early stages of following through the debugging output to see how it does what it does. However, one design decisio...
We were given a question in class with this FSM and had a debate over what the regex would be and the corresponding accepted strings. Does this FSM make sense as on state 1 there seems to be a choice between going to state 3 or looping on state 1 with the input of b. ![enter image description here][2] Please forgive t...
In Vol. 1 Issue 1, Jan. 1958 of the magazine Communications of the ACM, Dr. Saul Gorn discusses the advantages of the computer architecture of Edvac to that of Eniac. He states that the Edvac had a three-plus-one address word structure, and that the tendencies of his time period were to use one-address hardware and thr...
Suppose I have 2 possible algorithms: one runs in O(m+n) and the other runs in O(mn). Suppose also that the task is performed on a connected graph with m edges and n vertices. No other information is given about the graph. How do I know which algorithm is faster? EDIT: I don't think my question is a duplicate of the qu...
I'm currently trying to evaluate a CTL* expression and am not sure how to stepwisely evaluate the queries. For example I have EFG p. This means something like 'there is a path where eventually there exists a state s where from there on, globally p holds true'. Globally means that for all successors of a state on all ...
I've been trying to implement this paper from Boris Epshtein, Eyal Ofek, and Yonatan Wexler, the pioneers of Stroke Width Transform . Having a simple image with random texts, that underwent gray scaling. Then I have produced two edge maps using two different algorithms for output comparison (for later) , Sobel and Cann...
In this problem, I want to maximize the number of points of K dance moves. There are N possible dance moves. Each of the dance moves have a point value associated with it which can be positive or negative. There are also points from transitioning from one dance move to another. We're given an $N\times N$ matrix that ha...
So I am in the process of learning about LL(1) grammar and converting an ambiguous one into LL(1). I know how to figure out if a grammar (G) is ambiguous, however, I am having trouble converting it to a LL(1) using left factoring. From my understanding, left factoring is basically factoring out prefixes which are commo...
Given a non-negative integer $n$ such that $X = \{1,2, \dots, n\}$, a combination of k-tuple and its associated index $pos_k$. How to compute the associated lexicographic index for any subset of the given tuple of size $k-1$? For ex: if n = 5, then the associated index of given tuple {1,2,3} = 16. Given that informati...
I had a test a couple of days ago and one of the question had 2 statements : $L^+ = L^\ast$ $L$ contains $\varepsilon$ I had to say does 1 imply 2, does 2 imply 1 or do they both imply each other. I answered that only 2 implies 1 but the answer is that they both imply each other. But I don't understand, if $L = \empt...
I am trying to prove that every finite language is context-free, is there any type of way that I could do it effectively?
I have the following problem: given a directed unweighted graph and a set of source vertices, it's needed to find the shortest path to the specified vertex. The mentioned graph has two special extensions: A graph's edge can be active or inactive depending on edges placed in the path before. In other words, the edge $E...
On the Wikipedia page for the Pumping Lemma for Context-Free Languages, a language, $$ \{b^j c^k d^l | j, k, l \in N\} \cup \{a^i b^j c^k d^l | i > 0, j = k = l\} $$ is introduced. The pumping lemma proof for this supposedly fails because, given a string without a's, you can pump the b's and, given a string with a's, ...
In a paper I see the following lemma about unlabeled binary trees: If $s_1$ and $s_2$ are both m-node binary trees, then the number of n-node binary trees containing $s_1$ as a subtree is the same as the number of n-node binary trees containing $s_2$. It goes on to use this to show that if you want to compute the num...
I've been trying to implement this paper from Boris Epshtein, Eyal Ofek, and Yonatan Wexler, the pioneers of Stroke Width Transform . On computing the gradient direction, given the equation: theta = arctan( Gy / Gx ) where: theta = is the resulting angle Gx = is the X gradient component Gy = is the Y gradient componen...
Both Deterministic and Non deterministic Finite Automata can recognize the same universe of regular languages. On the other hand, Deterministic Push Down Automata can only recognize a subset of context free languages that Non deterministic Push Down Automata can recognize. Is there any intuitive reason for this? It wo...
Treesort sorts input by putting input into a binary search tree and then flattening the tree. In some cases the tree can become unbalanced and so a self-balancing tree is required. There is no requirement for a self-balancing tree if the input is first randomly jumbled up first. However, one cannot shuffle a stream of ...
I know that the intersection of a regular language and a context free language is a context free language. I've seen this fact proven on here and other websites. However, after spending hours reading through proofs, I don't really understand the general idea of the proof itself. I'm not looking for a formal proof, but ...
I recently came across this blog post by Brian McKenna explaining row polymorphism. This seemed like a wonderful idea to me, but then I realized it smells an awful lot like bounded parametric polymorphism: With row-polymorphism: sum: {x: int, y: int | rho} -> int function sum r = r.x + r.y With bounded parametric poly...
Are there scaling concepts regarding the number of components needed and minimum program length needed to solve a problem of some complexity? For example, problems are characterized by O(.) measures of time and space complexity. Space complexity tells me the amount of memory needed but not the number of computational c...
I am trying to understand some notes regarding the A-star algorithm. The example used is to show how the algorithm can be used as a (more efficient) alternative to Dijkstra's algorithm for finding shortest path. I am reading about A* search starting page 71 of the UK GCE Computing textbook, Rouse to find shortest path....
Suppose we want to sort an array that contains $n$ different integers in the range $[1,2n]$. It is known that this requires $\Theta(n\log n)$ comparisons. But comparing integers which might be as large as $n$ might requires time $\Theta(\log n)$ since we have to compare them bitwise. So, apparently the runtime complexi...
An optimisation problem that allows to solve a NPC decision problem through a polynomial reduction is called NP-hard. For these optimisation problems no polynomial algorithm is known. Symmetrically, is there a standard name for all those optimisation problems for which a polynomial algorithm is known?
I have to evaluate my information extraction program. I have to evaluate it by the expectation-driven way. I don't know what that means. I would appreciate if you could help me. Thx.
In "Multiple View Geometry in Computer Vision" Chapter 12. Structure Computation, page 310-313, triangulation is used for point 3D reconstruction. There are three methods mentioned: Midpoint method that "finds the midpoint of the common perpendicular to the two rays in space". Linear triangulation methods that uses SV...
What is the difference between a memetic algorithm and a cultural algorithm? I mean they're both evolutionary algorithms where they select a subset of the population to apply some local search logic. And I think that even their metaphor is pretty similar.
I'm trying to find if the following CFG is ambiguous. \begin{align*} M &\to 0R \mid 1R\\ R &\to 1RR \mid 0 \mid 0M\\ P &\to 0PP \mid 1 \mid 1M\,. \end{align*} When doing the parse tree, do I treat $0R$ as two separate things or as one? If I treat all those things as separate, when I get to $0M$, do I go b...
I have a series of line segments $l_i=(a_i,b_i)$ with $i=1,2,3...n$ $a_i$ and $b_i$ are their starting and ending points coordinates in $x$ axis. The question is how to find a algorithm that is strictly cheaper than $O(n^2)$ and it yields number of pairs $i,j$ such that $l_j$ completely contains $l_i$ and $j>i$. I kn...
I'm trying to prove L={w∈{0,1}∗:w contains more 00 substrings than 11 substrings} is a non regular language using Myhill-Nerode theorem. I'm a bit lost and not sure what to do. Thanks
I have an n-ary tree and I want to get all possible representations of the tree that "cover" (for lack of a better term) the tree. Here's what I mean by cover: Suppose we have the following tree 1 / \ 2 3 / \ /|\ 4 6 5 7 8 | 9 I want to somehow obtain the following: 1 2...
Input : Two matrices $A$ and $B$ of size $n$ X $n$. Compute : Matrix product $A$ X $B$. Some of the known results about matrix multiplication are given below. Brute Force : $O(n^3)$. Nader H. Bshouty : at least $2.5$ $n^2 -$$o( n^2 )$ [over binary field] multiplications. A lower bound for matrix multiplication A paper ...
Is there an algorithm that fills the area outside the edges? e.g.: From this to this
I'm trying to find a regular expression for the following language: $$L=\{x0y : \text{$x$ contains same number of 0's as $y$ contains 1's}\}. $$
Ok. You'll have to bear with me because I'm new to this. I have an idea for a research project. It involves trying to predict a path that someone might take in an indoor environment. My idea is to use smartphones to gather various sensor readings(accelerometer, gyroscope, magnetometer...) while the person walks his nor...
Let $\Sigma = \{0,1\}$, with $w \in \Sigma^* $ and $value(w)$ the not negative integer value of $w$. $w$ is seen as binary string, with its first index being the least significant bit: $$value(w_1 w_2 ... w_n) =  \Sigma_{i=i}^n 2^{i-1} w_i$$ The languages is defined as: $$L = \{a_1b_1a_2b_2 ... a_nb_n \ \in \ \Sigma^* ...
Usually, in MR images one hypothesis research communities are making is, " the spatial intensity distribution is piecewise constant and that each tissue corresponds to a unique grayscale level. Based on that hypothesis, a valid correction method should lessen the standard deviation in intensity for each tissue."(Paper ...
Nodes have values. Node n's value is denoted n.val. Two or more nodes can have the same value. A node n is a category 0 node or more simply a '0' node iff n.val % 4 == 0. A node n is a 1 node iff n.val % 4 == 1. A node n is a 2 node iff n.val % 4 == 2. A node n is a 3 node iff n.val % 4 == 3. Nodes can be matched as...
Given a randomly generated maze of dimensions n x n, with the entrance point always being the top left corner (0,0) and the exit point always being the bottom right corner (n,n) what is the theoretical worst-case running time of finding a path through this maze? The maze has a density of d (for example, if d = 0.5, th...
i just want to double check with what i concluded from this parse trees. A / \ / \ B C / \ / \ 0 D D E | | 0 1 from the above tree i get right derivation to be A -> C C -> D|E E -> 1 D -> 0 and the left derivation as A -> B B -> 0|D D -> 0 i just ...
I'm studying B+trees and I'm trying to understand how actual data can be stored in a physical file and still allow fast lookups. None of it would be in memory, all of the pointers would be "seeks" to different portions of the file. Specifically I'm trying to figure out a way to do text searches. Hence the leaf nodes wo...
this may be a shot in the dark, but I am trying to teach myself more machine learning concepts. I have found a textbook and am trying to work through the exercises in it. Could anyone help me with this example? Example: Use genetic algorithm to solve the following optimization problem, including the initialize populati...
Given a $3\mathsf{SAT}$ form to decide satisfiability takes exponential time. Any boolean function has an unique polynomial representation. So decide $3\mathsf{SAT}$ satisfiability reduces to whether a given polynomial is identically $0$. However deciding $\mathsf{PIT}$ is believed to be in $\mathsf{P}$ since we think ...
I want to come up with a good algorithm that takes as input an undirected graph $G$ and checks which vertices to include in an output graph $G'$, such that each vertex in $G'$ has degree at least 3. I've thought about traversing the graph once to eliminate any vertex with degree less than 3 since none of these can be i...
Using the fact that the satisfiability problem is NP Complete, demonstrate that the 3-Dimensional Matching problem is NP Complete. I am currently in need of clarification of the proof of the above statement as given in the Combinatorial Optimization text by Papadimitriou and Steiglitz. I am a graduate student in mat...
Can a deterministic finite state transducer output ϵ (epsilon) ? A Deterministic Finite-state Transducer (DFT) is a device much like a DFA, except that its purpose is not to accept strings or languages but to transform input strings into output strings. Informally, it starts in a designated initial state & moves...
I need to construct a finite automata which accept a language $L = L_1 \cap L_2$, where $L_1$ and $L_2$ are given below. $L_1 = \{ w \mid w $ is divisible by 2 } $L_1 = \{ w \mid w $ is divisible by 3 } I know how to design a finite automata for a single number but how do I combine the automatons which check divisi...
I need to find N! (mod 232-5) such that 0 ≤ N ≤ 264 for i cases, 0 ≤ i ≤ 1000 in 1 sec. Credits: https://dmoj.ca/problem/factorial2 I am aware that I only have to handle 0 ≤ N ≤ 2 ≤ 232-6 because once N ≥ 232-5, N!≡0 (mod 232-5) . A naive solution would take O((232-6)*1000). I have also tried using Wilson’s Theorem an...
I have a directed acyclic graph whose vertices are either red or black. I want to perform edge contraction between pairs of red vertices only, and avoid introducing cycles. The goal is to have the fewest number of red vertices remaining (and no cycles. Note that after edge contraction, the resulting self-loop is remove...
Given a DFA, A, let L(A) denote the number of words A accepts. I think it's easy to calculate L(A): Translate the encoding of A into a regular expression. If the Kleene star appears anywhere in the expression - the language is infinite. Else: Go through and count all the combinations of words that are possible to make...
A language $L$ is definite if there is some $k> 0$ such that for any string $w$, whether $w \in L$ depends on the last $k$ symbols of $w$. How can I prove that every definite language is accepted by a finite automaton?
I am confused how to check if an algorithm I made is asymptotically optimal. At the very least, the running time is constant at O(4). This is because you will need to check at least 4 names. At the very most, the running time is linear at O(n). This is from n + n + n/2 + n/2 + n/4 + n/4 + .... = 2n * (1 + 1/2 +...) <...
There's a concept I've used frequently where I create an O(n) operation for finding the sum of all subsets ai...ai+L where L is the length of a subset. i ← 0 j ← i - length of subsets subsetTotal ← 0 while i < length of a   subsetTotal ← subsetTotal + ai   if j ≥ 0     Save subsetTotal to a collection     subse...
I was looking for a StackExchange site that would be the best for this question, so if this isn't the best place, please feel free to redirect me elsewhere. I have worked as a Freelancer somewhat out of concern that I would flop on the quote coding interview unquote. I ran across a book called the self-taught programm...
I found an algorithm which sorts the digits of a number to its smallest form. IE 54321 ==> 12345. The algorithm looks like: int main() { int x = 0; cin >> x; for ( int l = 0; l < 10; ++l ) { int rem = x % 10; int tx = x / 10; while ( rem || tx ) { if ( rem ==...
How can a polynomial such as $x^3 + 1$ be converted to its binary form of $1001$. Likewise, $10100001 = x^7 + x^5 + 1.$
Let's say that I'm given a $n\times n$ ($n\leq 1000$) grid (more of like a table) and I color the grid with $n^2$ rectangles, each of a different color (let's say they have colors 1 to $n^2$ for simplicity). The color of the rectangle that is colored the latest on a cell will remain that color. For example, I could hav...
As the functions are of 2 type:1.Pre-defined/library functions,2.User defined functions. What type of function is main() function? This doubt comes in my mind while writing a program we define the main() function as we do the others. Please help!!!
How can we prove that the following problem $A$ is NP complete? Given a set of integers $S={a_1, ..., a_n}$ and a number $D$, is it possible to find disjoint sets $S_1, S_2, S_3, S_4$ such that $S_1 \cup S_2 \cup S_3 \cup S_4=S$ and $$ -\sum_{j=1}^{4}\frac{\sum_{a_i \in S_j}a_i}{\sum_{a_i \in S}a_i}\log_2(\frac{\sum_{a...
My attempt is We can fairly easily build an expression containing no a, one a, or one aa: (b+c)(€+a+aa)(b+c) but if we want to repeat this, we need to be sure to have at least one non-a between repetitions: (b+c)*(€+a+aa)(b+c)*((b+c)(b+c)*(€+a+aa)(b+c)*)* Therefore the final answer is (b+c)*(€+a+aa)(b+c)*((b+c)(b+c)*...
I need to train SVM with 2 different features..the problem is one feature is the HOG with length 144 and other an RGB value with length 3.. Can i combine these two features to train SVM and test using the same? the code iam using is X1=xlsread('train1.xlsx'); Y1=xlsread('CLASS1.xlsx'); svmStruct1=svmtrain(X1,Y1); cl...
I'm currently working with this grammar: $S \to aSBC$ $S \to aBC$ $CB \to BC$ $aB \to ab$ $bB \to bb$ $bC \to bc$ $cC \to cc$ It is supposed to define the language $$ L = \{a^nb^nc^n : n \geq 1\}. $$ I need to know how to get through the grammar rules to end up with $L$. So I started with the first two rules which e...
I was recently asked this problem in an interview and I couldn't solve it. Need some help on how to solve this problem. Given a K-ary tree with N nodes (N <= 2000 and K <= 12) you need to assign some colour to each node. Also, each node has a value associated with it which is equal to the number of units of paint requi...
Suppose that we have been given a regular expression $L$ and then we are asked to calculate the minimum number of states in the minimum sized DFA? How can we go about solving such questions? What I thought is that first we need to convert the given regular expression to The DFA and then minimise it. Is there any bette...