instruction
stringlengths
35
29.1k
Given a tree with n nodes, Print all nodes which are the endpoint of the diameter. 1<= n <=100000. E.g. For Above tree answer would be A,B,F,G I tried the O(n2) approach (Running Dfs from each node) but need a solution better than it.
Approach:1 To prove any unknown problem $B$ is NPH then take any known NPH problem $A$ (e.g. $3$-sat) which reduces to $R$ in polynomial time. If I take any instance example $I_1$ of $A$, then prepare another instance example $I_2$ of $B$, and if $I_2$ can be solved in polynomial time then $I_1$ can be solved in polyn...
Google has the article Extra, Extra - Read All About It: Nearly All Binary Searches and Mergesorts are Broken. Which primarily discusses the overflow on the mid calculation. However, what I found interesting was the return value for when key is not found. Initially, I thought the negative indicates the value was not fo...
this is the algorithm : F() = { count = 0 n = 1000 For i = 1 to n Do If n Modulo i = 0 Then count = count + 1 end if end for if count = 2 then return prime else return prime } So what i know is complexity of a loop is n and other than loop is some constant so what i get is O(n) but my teacher...
Suppose we are given a graph $G$ of order $n$ and a black box that can efficiently (polynomial time) compute the chromatic number $\chi(G)$. I am curious to hear how would one go about in order to construct a proper coloring of $G$, more precisely Find an efficient algorithm (polynomial time) to construct a proper col...
For n-bit ALU is equal-to operation and similar comparisons generally limited to n/2-bit words, or n-bit?
I'm reading a book on Randomized Algorithms by Raghawan and Motwani and I don't understand the algebra/calculus of a step in the analysis of Karger's algorithm(Randomized min-cut). They have the following: $$Pr[\cap_{i=1}^{n-2} E_{i}] \geq \Pi_{i=1}^{n-2}(1-\frac{2}{n-i+1}) = \frac{2}{n(n-1)}$$ This part in particular...
I have a directed graph with roughly 2000 nodes, and roughly 4000 edges. I have created an application so the people that use it can easily see the path drawn on a map, if they e.g. want to find the shortest path between two nodes. And this works as intended. However, this shortests path is based on the weights of each...
I have been reading up on Boolean logic and, specifically, the Boolean satisfiability problem. I have seen several people mention that the expression must be converted to conjunctive normal form (CNF) before it can be solved. Why is this the case? I understand that propositional formulae would be quite "chaotic" if not...
I am looking for references and/or algorithms for generating 4-dimensional periodic triangulations on unit 4 lattices. That is, generating a space filling triangulation of the 4D integer lattice (Z^4) that is invariant under lattice translations. I have found references for 2D and 3D, but it is not clear to me how to g...
At section 5.2 of 2000’s republication of 1974’s paper ‘Continuations: A Mathematical Semantics for Handling Full Jumps’ by Christopher Strachey and Christopher Wadsworth, the following denotational semantic equation is given (to show that the following block command is equivalent to the while-loop command $\textbf{whi...
I have read (and re-read) the informal proof of The Halting Problem. Can we not make the same argument using only the Program, without the Input {e.g. H(P) rather than H(P, I)}? I am confused by the step where we pass the Program as the Input as well. This seems to be the key since all explanations mention this step...
The proof that the Edmonds-Karp algorithm will require at most $O(|V||E|)$ uses the fact that when an augmenting path has critical edge $(u, v)$, $\delta_f(u)$ strictly increases. Therefore, that particular edge can only be critical at most $|V|$ times and the total number of augmenting paths until the max flow is at m...
I was recently introduced to big O and big Omega, as well as big theta. I know that big O is the worse case scenario in terms of runtime, big Omega is the best case scenario, and big theta is in between. However, I'm still confused on how I would use it mathematically to prove that n log n = Ω(n). Also, I get that n0 i...
Selecting the median as an approach for pivot selection halves the array into $T(\frac n3)$ and $T(\frac{2n}{3})$, so our $T(n)$ becomes: $$T(n) = T(\frac{2n}{3})+ T(\frac n3)$$ Solution: Approach 1: using master method, it's CASE 1 gives and upper bound: $$ \begin{align} T(n) = T(\frac{2n}{3})+ T(\frac n3) + O(n)\\ \...
Why are Gene squencing file i.e FASTA files so compressible. It was stated on a site that few compression algorithms are capable of compressing these files to Gigabytes (from Terabytes). And is it possible to convert binary data to FASTA file for high compression. Is there any difference between algorithms used in c...
I am implementing a UDP based go back n example and I am a bit stuck on how the server should respond to packets. If my client has a sliding window of say 5, it can send 5 packets to the server without waiting, and any time it receives back an ack lower than its highest window value it will retransmit all packets from ...
In the this discussion of Dijkstra's Algorithm appear the following comments: # Nodes can get added to the priority queue multiple times. We only # process a vertex the first time we remove it from the priority queue. I'm curious as to under which circumstances a node would be added to the priority queue multiple time...
SO According to question grammar should be like this (A -> AA ). ->So i learn that if grammar is left and right recursive both then that grammar must be ambiguous but here the answer is deferent. Plz explain me.....Thanks :)
I am trying to implement min-max heap structure A min-max heap is a data structure that is identical to a binary heap, but the heap-order property is that for any node, X, at even depth, the element stored at X is smaller than the parent but larger than the grandparent (where this makes sense), and for any node X at od...
I read order statistics from the book The Design and Analysis of Computer Algorithms", by Aho, Hopcroft, Ullman, Addison-Wesley As per the algorithm the recurrence relation given T(n)<= cn for n<=49 .....1 T(n)<= T(n/5) + T(3n/4) + cn for n>=50 .....2 How can I prove it by induction T(n)<= 20cn? I have two more questio...
In a lecture I'm taking about complexity theory a professor said, there are infinite many NP-complete problems. Question: I was wondering if there exists something like a database or a book with some known reductions (or with maybe more than only the NP-complete ones) and the proofs for them? I know there is a very ni...
I am studying direct mapping in cache. I understood the concepts like dividing into blocks and lines , tag directory etc. When solving numerical problems of finding main memory size or tag directory size I have no problem. What I understood is that, in cache we have a tag associated with each cache line ( neglecting va...
You are given an undirected graph (social network) in which each edge $e = (v, v')$ has an interval $I_e = [l_e, u_e]$ on it. The meaning is that you know that $v$ and $v'$ met at some point during the interval $I_e$, but have no idea when exactly. You also know that some source node $s$ started with some infectious di...
Is it true that for a finite or a countably infinite hypothesis class $\mathcal{H}$, then it is going to be PAC-learnable (and vice-versa)? And what about if we change the cardinality of the hypothesis space to be an uncountably infinite? Does that mean it will not be PAC learnable? Please correct me if I'm wrong, than...
In 2005 ID software open source the game Quake 3 Arena. When they did it was discovered was an algorithm that was so ingenious and all it did was calculate the inverse of a square root. The easy way to calculate the inverse of a square root being float y = 1 / sqrt(x); But then again this functionality has already bee...
For a given undirected graph $G=(V,E)$ I'm trying to construct a boolean polynomially computable formula $\varphi$ with the following property: $\varphi$ is satisfiable $\iff$ vertices of $G$ can be colored in $3$ colors with the following condition: For any edge $(u, v)\in E$, if $u$ and $v$ have different colors, the...
I still have some doubts for finding the VC-dimension. Suppose $\mathcal{H}$ has VC-dimension $n$. This is the process of how I think about it: (1) Show that there is a set of $n$ points that can be shattered by $\mathcal{H}$; and (2) No set of $(n+1)$ points is shattered by $\mathcal{H}$. For (2), I just gotta show th...
Given two strings $s, t$, I would liketo find a maximal subsequence of $t$ (denoted as $t'$), such that the concatenation of $t'$ with its reverse ($t'_R$), is a palindromic substring of $s$. I thought to use dynamic programing to solve this question, but I'm not sure how to use it and how to define the recurrence func...
LOC = lines of code KLOC = Thousand lines of code Fault (or defect) density = number of reported bugs per line of code. Software artifact = function, class, module Reading research papers on fault density and fault prediction, it seems a bit hard to get an overview, because there are lots of studies, and lots of differ...
My question is about the article Sub-Linear Memory: How to Make Performers SLiM. It is written in the article "our algorithm is compatible with distillation (Sanh et al., 2020)". Now I would like to know if SLiM is compatible with parameter sharing... Is SLiM compatible with ALBERT and with ELBERT? P.S. I am asking thi...
In the proof of the Time Hierarchy Theorem, Arora and Barak writes: Consider the following Turing Machine $D$: “On input $x$, run for $|x|^{1.4}$ steps the Universal TM $U$ of Theorem 1.6 to simulate the execution of $M_x$ on $x$. If $M_x$ outputs an answer in this time, namely, $M_x(x)\in \{0,1\}$ then output the oppo...
My question is about the article One Loss for All Deep Hashing with a Single Cosine Similarity based Learning Objective. I would like to know how to solve the out-of-sample problem: given a new code how to find its corresponding orthogonal target? Tell me the time complexity how many ms the algorithm demands for solvin...
What device integrates and coordinates all the data from millions of CPUs/cores in a supercomputer? To call these cores CPUs (Central Processing Unit) seems wrong when they are not central at all but comprised of millions of units. Isn't there one processing unit or device that is truly at the center? I have Googled th...
Given an integer number $n$ (in base 10) and a base $b$, determine whether the representation of $n$ in base $b$, $(n)_b$ has a coefficient with value of $b-1$. Examples - n=21914, b=6 (21914)6 = 245242 => we have b-1=5 in the representation of (n)b - n=50673, b=9 (50673)9 = 76453 => we don't have b-1=8 in the represen...
What is the average number of comparisons performed when sorting 3 items? The question is based on the above picture.
The Kleinberg and Tardos Algorithm makes the following claim without proof: Any algorithm that builds a spanning tree by repeatedly including edges when justified by the Cut Property and deleting edges when justified by the Cycle property - in any order at all - will end up with a minimum spanning tree. Is there any ...
Show the the following language is $\Sigma_3$-complete: $$ \mathrm{REG} = \{ \langle M \rangle \mid L(M) \text{ is regular}\}. $$ Using the quantifier method I figured out that REG is in $\Sigma_3$, but how do I prove that it is $\Sigma_3$-hard?
A computational problem is said to be in the class $NC^K$, if the result $f(x)$ can be computed in time $O((\log |x|)^k )$ on a multi-processor computer, while the total number of operations remain polynomial in the input size $|x|$, i.e. number of bits in $x$. Show that counting the number of 1’s in a binary word $x \...
I'd like to create a function decode(x : string) such that decode(x : string) == decode(decode(x : string)). I believe I can think of how to do this with reserve chars. Is that my only option? I'm not much of a theory guy. But, I think essentially what I need to do is represent a structure that is idempotent on substit...
Assuming the 'hardness' of any possible input instance with $N$ elements (of any bit length) for the subset sum problem could be represented as $H \in \{0,0.000001,0.000002 \dots, 1 \}$, being ${0}$ those instances considered the most "easy" or "tractable" and ${1}$ those instances considered the "hardest" or "intracta...
I have the following problem: Suppose that we have several points that cover some cities, with a cost associated to each point. This can be represented as a grid: c1 c2 c3 c4 c5 cost p1 1 0 1 0 1 200 p2 1 1 1 0 0 100 p3 0 1 0 1 1 300 ... etc. Where $c_n$ represents a city, and $p_m$ a poi...
I have two arrays A and B of the same length n. I am looking to swap such that all the elements of array A are less than each element of B. Elements in A and B can be unsorted. Example Inputs: A = [2,5,1,8], B = [9,3,6,10] Expected Outputs: A = [2,5,1,3], B = [9,8,6,10] I solved using brute force way that takes O(n^2) ...
I know that, 0* generates, NULL, 0, 00, 000, 0000, ... and so on. But how does (0*)* actually work? Does it generate even length 0's? Like this, NULL, 00, 0000, 000000... or it generates strings same as first expression? What I thought is that if it has 2 star means, that it will multiply any string inside, regardless ...
Given an an table that contains products I am selling with the dates, and given a table that contains the possible work orders with each work order, arrange the work orders such that all items are filled. (assume a starting stock of 0) What I can produce per day: Item1 30 Item2 20 Item3 25 Sales Orders: ...
Suppose $A = \{0^{n}1^{n} \mid n \ge0\}$, which is not regular, and let $B$ be a finite subset of $\Sigma^* \setminus A$. Is $A \cup B$ regular?
We know that any languages $\subseteq\\\\$ $\Sigma^{*}.$ Because any language collection of string over alphabet. And we know that set of all languages is $2^{\Sigma^{*}}$ which doesn't $\subsetneq\\\\$ $\Sigma^{*}.$ But I have couple of smalls confusion are that $A.$ Set of all regular languages $\{L_1,L_2,L_3..........
While I have come to learn some computer science, I find that I have next to no knowledge on computer networks. Are there any good books at a basic level that cover some of the fundamental topics? Ideally something that doesn't overwhelm a newcomer and provides a good jumping-off point to get started with. If it helps,...
I am trying to solve this recurrence with substitution method. I guess $T(n) = \Theta(n \log n)$ (with Master Theoreme). Can someone show me how to demonstrate the upper bound $T(n) = O(n \log n)$?
Before starting, I want to say that I understand time complexity, and I understand how a hash table is considered O(1) vs an array having a time comp. of O(N) in terms of what you learn. What I don't understand is why looking up something in a hash table is not O(N). Surely, just because you know the key, you still hav...
A colleague recently brought up this argument when we were talking about big-O runtime analysis and I've been unable to find why it is incorrect: Informally, the argument goes like this: "If the runtime of all logarithms of any base are supposed to be equivalent, there is nothing that keeps us from saying $O(\log x) \...
I have tried to solve and understand LeetCode question "297. Serialize and Deserialize Binary Tree", and after I read their solution I came up with a question that I will be glad If you can help me to understand. First of all, two binary trees with different structures can have the same preorder result and that is the ...
I do not have too much background in complexity theory, so please feel free to let know if my question is ill defined. My question is, does $\mathcal{P}\neq \mathcal{NP}$ preclude the possibility that an NPC problem could have polynomial time algorithms on almost any input? I am thinking something along the lines of th...
Pretty much the title. I watched a video talking about P vs NP and it mentioned that the event that sparked this entire debate was the fact that some exponential time problems were shown to be solvable in polynomial time. So here I am hunting for some examples so that I can dive deeper into how they were cleverly chang...
In their book An introduction to the Analysis of Algorithms, Flajolet and Sedgewick analyze the number of compares performed by Mergesort along the following lines. They denote by $C_N$ the number of compares that Mergesort uses to sort $N$ elements, and come up with the recurrence relation $$ C_N = C_{\lfloor N/2 \rfl...
Given a binary square matrix of order $n$. Can the problem of finding the longest sequence of 1's (horizontal or vertical) be solved with recursion? I know how to solve the problem without recursion by iterating over the columns and rows, but was wondering it there is a solution using recursion.
I would like to know if it's actually possible to encode a (binary) sequence with rotations in MILP/MIP. Given a binary sequence $(0,1,1,0,0,0,0,1)$ and variables $x_0,x_1,x_2,x_3,x_4,x_5,x_6,x_7$ I want to restrict my MILP program such that it takes up one of the following: \begin{align} (x_0,x_1,x_2,x_3,x_4,x_5,x_6,x...
We need to find mth smallest possible distance by considering all possible pairs. I solved this problem by considering all possible pairs and maintaining a max priority queue. If the max priority queue size is less than m I push the current distance into it. Otherwise, if the size of the priority queue is greater than ...
I have two sets of vectors: A and B. I want to find the vector Bi in set B that is maximally distant from the vectors in set A, either by average distance or closest distance. I know that I can accomplish this by comparing every vector Ai in A with every vector Bi in B, but that will be very costly. It is acceptable fo...
Suppose $A$ and $B$ are arrays of real numbers of length $n$, and $M$ is another real number. One algorithm for finding indices $i$ and $j$ such that $A[i] + B[j] = M$ is to comparison-sort $B$ and run binary search with argument $M - A[i]$ on it $n$ times, which gives an $O(n\log n)$ algorithm. The source I have claim...
This question is asking for clarification on what P=?NP is asking specifically. I've read the official problem description: here and it seems like P=?NP is primarily concerned with inputs that result in a 'yes' from the solver. For subset-sum, this would be inputs that do have a subset that sums to T. My question is th...
Say that your friend picks a word $(w_1, w_2,\dots,w_n)$ according to a known probability distribution $(p_1,p_2,\dots,p_n)$. You ask yes or no questions until you are certain which word has been chosen. For example, you can eliminate a subset $S$ with the question "Is the word in $S$?" The cost of the guessing strate...
I've got a basic implementation of a Pushdown Automaton which recursively checks the rules of a grammar in CNF to find whether a given input string is accepted or not, and it can also count the number of possible derivations of that string. My problems lie when the grammar has rules which could create infinite loops, e...
I am reading the "Reaching Agreement in the Presence of Faults", M. Pease et al and trying to understand their proof for the $n \geq 3m+1$ case. In the induction step $m \gt 0$ it says the following: ... Any other set satisfying these requirements, moreover, must contain a nonfaulty processor (since it must be of...
I have been reading up on 2D Turing machines on wolframscience and I am kind of confused about what exactly is the relationship between 2D Turing machines (like Paterson's worm and Langton's Ant) and Cellular Automata. I understand that they are both defined pretty differently but I keep seeing references between one a...
I faced this problem in a hiring challenge which is now over. I wrote a solution for the problem but at that time the judge gave me wrong answer. Afterwords I thought about the solution but couldn't find any problem with my logic. Maybe I made some implementation mistake during the contest (I'm not sure). But now I hav...
There are $n$ closed boxes and one and only one box of them contains a prize. The $i$-th box has probability $p_i$ of containing a prize. A player must pay $c_i$ coins to open the $i$-th box. The player must open boxes until the prize is found, then the game ends. Find the optimal box opening strategy that minimizes th...
Let's suppose we have a square grid board like the one shown in the picture below: I'm wondering how I can find the path with minimum number of "bending" points (like the ones shown in red) between two given squares ("Start" and "Finish"). The board has some impediments or broken squares on it (Black squares). I tried...
I'm pretty sure there's a textbook solution to this problem, but I haven't figured it out. I have fixed-size blocks of data arranged in a sequence: block 0, block 1, etc.. There are reader threads that read through the blocks sequentially. There are writer threads that append new data to the empty space in the last blo...
I am interested in finding a Linear Transformer which only uses ONLY matrix operations (more specifically matrix-matrix multiplications during training and matrix-vector multiplication in inference time). The linear transformer should avoid elementwise operations like the GeLU (Gaussian error Linear Unit) in SLiM (Sub-...
Consider the following algorithm: function randomQueries(A, n <- A.size) if n > 1 then p <- n - 1; x <- partition(A, p); randomQueries(A[0,1,...,x-1], x) randomQueries(A[x+1,...,n-1], n-1-x); for y = 1 to x do for z = x + 1 to n - 1 do query(A, y, z); else if n = 1 then query...
Let $G = (V, E)$ be a directed graph with negative edge weights and no cycles, and $L:V \to \mathbb [0, \infty[$ be a function defined over this graph. This graph represents all possible paths a particle can take to go from a starting node $s$ to a final node $t$. Every weight represents the amount of energy the partic...
Is there a polynomial-time algorithm for distribution of clauses of arbitrary symbols (i.e. similar to multiplication distributing over addition)? For simplicity, let's assume the distributive operation is concatenation and the symbols are letters in the English alphabet. For example, the clause (a b c) distributed wit...
I'm trying to work out how to make the working implementation of fitting the straight line among the set data points. I base my function: pub fn sum_squares<Q: CanBeLabel>(l1: &Line<Q>, accuracy: u32) -> Point { let mut dataset_size: f32 = 0.; let (mut y_mean, mut x_mean): (f32, f32) = (0., 0.); let (mut ...
In number theory, progress is sometimes guided by people stating a specific Diophantine equation that they don't know how to solve. Is there anything similar in the field of Boolean satisfiability? More specifically, is there an instance of $3$-SAT in less than $100$ variables that people have tried to solve (by exhibi...
The standard technique to show NP-completeness of $L$ seems to be to show that $L$ is in NP, and then to show that some NP-complete language can be reduced to it. What if one tried to show it the other way, i.e., if L $\leq $ 3SAT? Wouldn't that be one one step way of showing that the language $L$ is in NP-complete?
Given a boolean formula $F$ of length $n$ defined over a fixed number of variables (say 50), is it NP-complete to decide whether $F$ is satisfiable?
Given: a finite collection $V$ of bi-infinite linear sequences of two-dimensional integer lattice points, each sequence ${V_i}$ given by $\cdots,\vec{{V_i}_{-1}},\vec{{V_i}_0},\vec{{V_i}_1},\cdots$ where $\vec{{V_i}_j} = \vec{{V_i}_0} + j \times \vec{d_i}$ for $j \in \mathbb{Z}$. (A natural way to represent a sequence...
Let $f:\mathbb{N}^{p+1} \to \mathbb{N}$ a primitive recursive function and $g:\mathbb{N}^{p+1} \to \mathbb{N}$ the bounded sum defined by : $g(\bar{a},x)=\sum\limits_{i=0}^x f(\bar a , i)$. To show that $g$ is a primitive recursive function we want to show that $g$ is closed under the primitive recursion : $g(\bar a, ...
I just can't figure out the difference between these three classes of complexity, does anyone know the difference and can explain it in a simple, direct way without too many definitions involved? Thank you very much!
I was watching this video on statements. There is an example: $x + \frac12 = 2$ It's an open statement as the truth value could be T or F depending on the value of $x$. $∃x: x + \frac12 = 2$ and $x ∈ ℤ$ Now the statement is closed statement (proposition) as the truth value is F. But later the professor said: $x + ...
My class had a discussion prompt that stated "Many programming languages, especially older ones, provide no language support for concurrency. C and C++ are examples of such languages." I thought C had the fork() command, maybe it's talking about an older version? I was then curious whether there were more languages tha...
Consider an acylicic directed weighted graph in which the nodes represent cities and the weights represent the amount of fuel a car spends when going through that edge. At each city $u$ the car refuels an amount equal to $F(u)$ of fuel. The car cannot traverse an edge if it doesn't have enough fuel to do so. Consider ...
Consider the following bfs pseudo code that calculates distances of all nodes from $s$ in graph $G=(V,E)$. I know that if $G$ was undirected and unweighted, then the above bfs would calculate correct distances. However, I'm not sure if it would still work if $G$ is directed and unweighted. Basically, what I'm asking i...
There are infinitely many different $PDAs$ for the same $CFL$ exist, therefore we can't check equality for $CFL.$ But also there are infinitely many different $DFA$ exists for same regular language. So why equality of regular is decidable but not for $CFL?$
I had a doubt in the proof by contradiction technique. Under this technique, we assume the negation of what we want to prove as true, then show that assuming so generates a contradiction. Since a consistent system cannot have a contradiction, so our assumption must be false and the original statement must be true. The ...
Let's say you have a maximum integer flow function in a network with 7 directed edges, meaning the flow cannot be increased anymore. The capacity of each edge is then increased by one. The capacity of all edges is always an integer, and so is the flow. Is there an algorithm that can find a maximum flow in this new netw...
Given a graph $G=(V,E)$, I'm looking for a way to orient its edges in a way that will bound its out degree. For example, I can bound the graph's out-degree by $\approx 2\cdot a(G)$, where $a(G)$ is $G$'s arboricity by simply assigning all vertices that have at most $2\cdot a$ unassigned neighbours to a set. Then, marki...
I'm trying to create an algorithm that finds the percentage of similarity between two subjects with sets of survey questions. Example: Q1: Do you prefer physically demanding tasks? A1: Nope Maybe Yes --> Subject_1 Choose Maybe / Subject_2 choose Yes Q1: Do you prefer the outdoors? A1: Nope Maybe Yes --> Subject_1 Cho...
I'm trying to devise a $O(|V| + |E|)$ algorithm to calculate number of shortest paths between $s$ and $f$ on a undirected, unweighted graph. Can someone please check my pseudo-code? Also, isn't $O(|V| + |E|) + O(|V| + |E|)$ = $O(|V| + |E|)$?
For example exist linked list with thousands (maybe million) elements or very deep tree which some branches are very long and have only one child, but exists other short branches with many children. How process this lists and trees changing very deep recursion to iteration? I have struct Node { Node* next; }; but al...
Given a suitable lattice and a monotonic function $F$, we can compute the bisimilarity of a labeled transition system (its greatest bisimulation) by computing the greatest fixed point of $F$ using Knaster–Tarski. I was wondering if the least fixed point of $F$ has any meaning to us or if it's worth computing. It is cle...
Two main disadvantages of Huffman encoding is that it makes two passes over data: First pass: Find out sequences frequencies $f(\cdot)$ of letters $c \in C$ in the document $D$. Then constructing Huffman optimal tree before transmitting the tree to the receiver. Second pass: encode and transmit the letters themselves ...
The mentioned problem: Cluster Editing Problem. I need to code this problem but i can't understand the algorithm behind it, even when i try to search for resources about graphs into the web; can anyone helps me to face the problem?
Found this question about Shannon's expansion. While I am trying to follow its logic, found one super convenience simplification used. Can we do this in general while dealing with boolean algebra? or only in Shannon's expansion? Can we just turn b+d into 1 while we have (+)⋅1 previously in the equation? Also + into 1 w...
We know that every $CFL$ has infinite configuration space. Due to this equality problem is undecidable. But why finiteness property is decidable inspite having infinite configuration space?
the scheme of iteration ? Here is the scheme of iteration : for $g : \mathbb{N}^p\to \mathbb{N}$ and $h:\mathbb{N}^{p+1}\to \mathbb{N}$ two primitive recursive functions we associate $f: \mathbb{N}^{p+1}\to \mathbb{N}$ defined by : $f(\bar a, 0)=g(\bar a)\\ f(\bar a, x+1)=h(\bar a, f(\bar a, x)).$ Here is my attempt :...
I read that Rice theorem applicable only for language property not for machine property. But today I have read from stack exchange and one site they are applying Rice theorem on machine also. My question is could we for both or language only?
As we all know it is $NPH$ to check whether $G=(V,E)$ is $k$-colorable or not. It is also hard to find the chromatic number of $G$. But I'd like to ask what are some good (or best known) approximation for coloring a general graph? More formally, I am looking at a graph $G=(V,E)$ for which I do not know the chromatic nu...
The algorithm of Wigderson (see here) can color a graph that is known to be $3$-colorable in $O\left( \sqrt{\left| V \right|} \right)$ colors. This is done in $O\left( |V| + |E|\right)$ time. For those who are not familiar with the algorithm, I'll give a brief description of it (it can be used for any $k$-colorable gra...