instruction
stringlengths
35
29.1k
Problem I have $J$ matrices $C_{j}$, which are $K \times M$. Elements of each matrix $C_{j}$ are between 0 and 1. I want to randomly choose $J$ matrices $A_{j}$ and one matrix $B$ such that: Elements of all matrices $A_{j}$ and matrix $B$ are between 0 and 1 $A_{j}B = C_{j}$ for all $j$. Dimensions of each matrix $A_{...
I'm learning about single source shortest path algorithms and need to clarify few doubts- Does Dijkstra’s assumes that the weights of edges in a graph searched by it are positive integers. Does Dijkstra’s assumes that the graph searched by it is free of cycles. Relaxing an edge is same as setting its weight to 0. Doe...
I see everywhere that the recursive equation for the complexity of Strassen alg is: $$T(n) = 7T(\tfrac{n}{2})+O(n^2).$$ This is not so clear to me. The parameter $n$ is supposed to be the size of the input, but it seems that here it is one dimension of a matrix while the input size is actually $n^2$. Also, each matrix ...
Coming from non-computer science background, I am trying to understand the different types of equivalence and equality usually used in type theory. Ideally, I am looking for clear definitions and notations (ie the symbols commonly used) of: difference between equivalence and equality of types $T_{1}$ and $T_{2}$ defin...
A finite automaton (FA), A, may accept or reject its own encoding, {A}. A machine, M, can be written that accepts {A} iff A rejects {A}. Turing gave a famous proof that M is not an FA. The proof relies on a contradiction that occurs when one assumes M is an FA and then runs M on its own encoding. However, it may st...
My initial thought is that L can't be context free since I can use the pumping lemma. I also don't think a grammar can be generated since it needs to keep track of the number of c's and a's. However, I'm having a hard time coming up with an algorithm for this language.
This DFA is a token scanner for a programming language.I would like to add keywords of the programming language(if,else,end ... etc) in the DFA so the lexical analyzer can recognize them. The Question is : Do i have to convert the entire given DFA to an ε-NFA(which will result in more states),add the keywords(with ε t...
Recently, I was looking at the underlying data/implementation of a survey application created using a RPA tool. As a user progresses through the survey, the "decisions" reveal a predominantly tree-like structure, with some graph-related elements (there is essentially a "GO TO" component that allows a single node to sha...
Electrical engineers often use multiplexers to implement Boolean functions. What is the correct technical term for this model of computation? Is it Decision Tree model or is there another name?
Is $\{\langle G \rangle | L(G) = \sum^{\star}\}$ in co-RE? $\langle G \rangle$ is the encoding of a context free grammar. My intuition is that this is false.
Lets say I have a set: $ L = \{\langle G \rangle | L(G) = \Sigma^{\star}\}$ and the question asks if it is co-RE. I know that if something is co-RE, it halts on every input not in L but may or may not halt on inputs in L. So in this case would something "not in L" be nothing?
I have the following problem: Consider the MAX-3-SAT problem: given a Boolean function in Conjunctive Normal Form (CNF) determine the maximum number of clauses that can be satisfied. Prove that this problem is NP-hard. I know that I'd have to reduce 3-SAT to MAX-3SAT, but I'm pretty lost on how that would work. T...
Learning induction proof now, found a "simple" example, which is a bit confusing to me (not sure if it is a valid example). If so, why the IH( suppose a root of rank k has at least $2^k$ vertices in its tree )is a valid one since it just repeating the statement that we are trying to prove ? What about the induction s...
In the book by William Stallings the overflow rule overflow rule for 2's complement addition is stated as follows: Overflow rule: If two numbers are added, and they are both positive or both negative, then overflow occurs if and only if the result has the opposite sign. Then the book gives the following examples: Do...
I have been tasked with reducing the following lambda expression: (λpq.pqp)(λab.a)(λab.b) using call-by-name and call-by-value reduction strategies. Call-by-name strategy: Left-most, outermost redex first but no reduction under lambda. Step 1) alpha-equivalence (λpq.pqp)(λab.a)(λcd.d) Step 2) Reduction - using the ...
The following is an excerpt from Information Theory: A Tutorial Introduction, page 65. Now, supposing the identity of each letter in English does not depend on any letter that is more than 10 letters away. In practice, the dependency between letters diminishes rapidly as inter-letter distance increase, as shown in Fig...
Give a context-free grammar for the following language: $\{ a^i b^n a^n \mid i \ge 0, n \ge 0 \}$ So far, this is the solution that I have been able to come up with, though I am not sure how accurate it is: $$\begin{align*} S &\to aSa \mid X \\ X &\to bX \mid a \mid \varepsilon \end{align*}$$ I worked this out from o...
I am trying to figure out the difference between information and conceptual models. For me, both terms seem to mean be the same, but I cannot find a reference where this is established. They are never used together; maybe because they are from different domains? My question is: What is the difference between informatio...
M is a turing machine description, L(M) is recognized by M, |L(M)| is the size of this language. {M : |L(M)| <= 330} {M : |L(M)| >= 330} I don't quite understand what this question is asking. Does the first question mean M accepts at most 330 inputs? My thoughts: co-CE CE (Construct a M to check the input, if >= ...
I have a tree where each node is assigned a weight (a real number that can be positive or negative). I need an algorithm to find a simple path of maximum total weight (that is, a simple path where the sum of the weights of the nodes in the path is maximum). There's no restriction on what node the path starts or ends. I...
How can I design a sorting algorithm of n elements using a Fibonacci Heap? Will it be a flavoured version of heap-sort where I replace the heap data-structure with Fibonacci Heap? Your help is appreciated
i am trying to understand Context free grammar and generate a CFG for any given language. when you're given a language , what is the best way to generate a CFG from it? are there any steps to follow to help you create a CFG for any language? is there ways of breaking down the language to make it simpler so that it hel...
Why would you want to traverse a binary tree in preoder, inorder or postorder? Why not use an order like breadth-first search for all graphs?
Is odd length pallindrome DCFL or NCFL? Like 1) $L=\{w1w^R\mid w \in \{0, 1\}^*\}$ or 2) $S\rightarrow aSa\mid bSb\mid a$ or Suppose odd length String like 3)$S\rightarrow aSa\mid bSb\mid aSb\mid bSa\mid a\mid b$ We get information about even length palindrome, that it can never be DCFL, but what about odd length?
I'm beginning to have an understanding thanks to some videos relating to "Proposition as Types". But, I don't come from a theoretical CS background, so maybe I'm blocked probably a bit by notation... Given that I have understood, Conjunction, Disjunction, Implication, I'm stumbling on Negation: intro: [A] /\ --- ¬ A...
I was asked this question and could not come to the correct answer: Let $L$ be the language of all words over $\{a,b\}$ where the first letter is identical to the letter that is next to last. (Pay attention – every word with length 2 is in the language.) Sketch a nondeterministic automaton that accepts this language. ...
I know that if a language is regular or context free, the language is decidable. However, if a language is decidable does that imply that it is also regular or context free?
Let $G=(V,E)$ be a directed graph, $\omega : E \rightarrow R$ a weight function, and $s,t \in V$ a pair of different nodes. It's given that $G$ doesn't have a negative cycle. Moreover, 10 of its edges are colored in red (let's say that the rest are colored in blue). I want to find an efficient algorithm that find the s...
I'm considering the general resource reservation problem: n processes, m resources. Each process requests a set of resources and each resource can be used by exactly one process. Processes are only active if they have all requested resources. Instance: A set of processes P, a set of resources R, the set of resource req...
Post's Correspondence Problem is known to be undecidable. A variant of PCP, namely PCP with partially commutative alphabets is also known to be undecidable. Is the following variant also known to be undecidable? PCP with commutative alphabet. Given and alphabet $\Sigma = \{a_1, a_2, \ldots, a_K\}$ and $2N$ sequences $...
I have several series of integers (vectors) that could be plotted at equal distances apart: 1: [0,1,2,1,5,3,5,7,4,2,3,4,3,4,5,6,8,1,3,1,3,8,4,3,5,1,3,8,3,4,1,8,8,6...] 2: [5,3,7,4,2,3,4,1,2,11,5,3,15,7,4,13,7,2,13,8,9,11,1,19,11,8,11,16,11...] ... n: [40,31,32,41,45,43,45,57,54,42,53,44,53,44,53,35,31,33,8,3,4,1,8,8,...
Can anyone help with this question? I currently have this solution that prints 1 2 3 4 5 6 but I'm having trouble going back down to 1. public class noLoop{ public static void main(String []args){ noLoop(6); } public static void noLoop(int n) { if (n == 0) { return; ...
Whenever I've come across this question whether on the internet or in my class everybody mentions the 4 address sequencing capabilities required in a control memory and the steps of address sequencing: 1. Incrementing of the control address register 2. Unconditional branch ... Etc. But what is the "definition" of addr...
I am trying to find references on a particular idea, but I don't know which keywords to use in a google search. the idea is: as an example, consider graph search. maybe the problem is: find a path from node $X$ to node $Y$. We can consider two versions of this problem: For any node $n$, we can query only the informati...
I've been reading about the Grover algorithm for finding elements in an unstructured database by the means of quantum computing, and even done some exercises. What I don't understand (and can't find anywhere) is what is supposed to happen if the element is NOT present in the database. The oracle would never flip any qu...
I found a question. Least number of temporary variables required to create three address code in static single assignment form for the expression $p+q*r-s/(q*r)$ My attempt: $t_1 = q*r$ $t_2 = s/t_1$ $t_3 = p + t_1$ $t_4 = t_3 - t_2$ So, I got $4$ variables but their answer is $5$. Am I missing something? Where ...
Tl;Dr; Given: type A = { int: foo, int: bar } type B = select foo from A What is the name of the typing relationship between A and B? What is the name of the operation of deriving type B from type A? Long Version When we talk of subtyping in programming we typically think of it in terms of whether a new subtype B o...
I have a context-free grammar with the following production rules, $S$ being the start symbol: $$\begin{align*} S &\to AB \\ A &\to a \\ B &\to a\end{align*}$$ Is this in Chomsky normal form? My problem is I thought CNF is supposed to be an efficient way to write a grammar, yet the grammar is not efficient in the sense...
I'm learning graphs these days and need to clear few doubts- Can I determine weather 5 points in two dimensions whose X and Y coordinates are given lie on the same straight line in O(1). What is the efficient way to find out the degree of the specified vertex in an undirected graph (V,E)? I'm thinking of O(|E|)? What ...
I am a beginner developing kernels (though I have developed several Hello World programs in C and C++). I frequently see reference being made to global constructors (e.g., osdev https://wiki.osdev.org/Calling_Global_Constructors), but I have not been able to find a clear definition or in it. Could someone please guide ...
If you multiply two normal distribution PDFs with means $\mu_1$ and $\mu_2$ and variances $v_1$ and $v_2$, then according to this page, the new mean is $$\mu = \frac{\mu_1 v_2 + \mu_2 v_1}{v_1 + v_2}$$ and the new variance is $$v = \frac{v_1 v_2}{v_1 + v_2}.$$ However, if I use those expressions directly to combine sev...
I'm studying $\lambda$-calculus, and had a question regarding an exercise I came across. I understand that $\lambda$-calculus uses three main strategies of evaluation, but I'm having trouble applying it. Specifically $\beta$-reduction. For example, for $1 + 2$: \begin{align} 1 + 2 & = \lambda n.\lambda m.\lambda s. \la...
I created this algorithm off the top of my head this morning. It has one loop, therefore it has a time complexity of O(n) and only stores two variable during loop so it has a space complexity O(1) time. Please correct me if the last statement is wrong. I looked online and I don't see other sorting algorithms that look ...
Assuming the coded data is errorless and given generator polynomial coefficients. By what algorithm can I decode the data coded by matrix constructed by given generator polynomial?
I have a big interval $I = [a, b]$ of size n. I want an asymptotically minimal set of subintervals of $I$ (let's call it $S$) one can use to construct any subinterval of $I$, by concatenating at most $K$ subintervals - specifficaly I'm interested in $K = 3, K=5$ only, but general solution would be interesting too. In ...
$<M>$ is the encoding of a TM and L(M) is the language accepted.
Below is a sample of 2 homework TM where Im not sure what complexity class they fit in. Also have to decide the complexity class of the complement. These 2 in particular confuse me because I got a different answer so I feel I may be missing something: S = { : M is a TM s.t. M(0) = accept} U = { : M is a TM s.t. M(0)[20...
So in class, we were talking about the idea of floating point precision in IEEE754 format, and how, when some numbers are added, precision is lost. My professor then gave the following example of a large absolute error between what we think the answer might be, and what the answer actually is when our program (written ...
I haven't found any way to show this was the case (that P/=EXP, without using the Time Hierarchy Theorem) If you can find a way to show this, can you give a short explanation of this,and also if possible link a paper supporting your conclusion. Thank you so much
Consider the following problem: given a lambda calculus term $t$ and free variable $v$ determine whether $\phi(t,v)$, where $\phi(t,v) := \exists t'. t' \equiv t \land v \notin FV(t')$. This problem is undecidable. To prove this, assume the contrary. We define a term $s$ as follows: $$s x \equiv \lambda n.j. j y$$ if $...
I have a problem that goes as follows: Problem. Suppose we have undirected graph $G$. We denote a $k$-perfect graph as a graph such that $\forall v \in G, degree(v) = k$. Present an algorithm that constructs a subgraph $H$ such that $H$ is $k$-perfect, for $k$ maximized. Do this in $\theta(|V| + |E|)$ time. I was think...
I am trying to build an Earley parser using the Wikipedia pesudocode as a base, with Aycock's fix for epsilon rules as follows: def predict(self, column, symbol, state): # original predict for alternative in grammar[symbol]: column.add(a new state corresponding to alternative) # Aycock fix if nu...
Say we have a DFA like the one shown below that accepts the empty string, $\varepsilon$. Also suppose the functionality of this DFA has been implemented as a circuit so that an led lights up whenever an accepted word is detected as input. While this hypothetical circuit is "idle", i.e. not receiving any a's or b's a...
Suppose $M_1$ and $M_2$ are two Turing machines such that $L(M_1)\subseteq L(M_2)$. Which of the following is true? (A) On every input on which $M_1$ does not halt, M2 does not halt (B) On every input on which $M_1$ halts, $M_2$ halts too (C) On every input which $M_1$ accepts, $M_2$ halts. (D)On every input which $M...
I am not able to understand time complexity of this for loop. While outer loop is O(n) the inner loop jumps certain calculation. How to find the complexity? public void function(n) { for(int i = 1; i< n; i++) { for(int j = 1; j <= n; j += i) { ...
Problem statement: You have a lightbulb for an interval of $N$ seconds, where $N$ is given. At time 0, the lightbulb switches on, and at time $N$, it switches off, regardless of any switches. From time 1 to time $N-1$ you have a maximum of $N-2$ switches in the form of an array called switches, which turn th...
I'm currently studying growth of function chapter in Introduction to Algorithm. In exercise 3.1-2 the question is: Show that for any real constants $a$ and $b$, where $b>0$, $(n + a)^b = \Theta(n^b)$. I understand I need to find constants $c_1$, $c_2$, $n_0 > 0$ where $0 \leq c_1n^b \leq (n+a)^b \leq c_2n^b$ for...
I have been following the course Concrete Semantics with Isabelle/HOL. At some point we are given the task to verify a program/extend some semantic construction/prove some mathematical fact. I personally prefer to dive a little bit more into operational semantics, so adding new features to the IMP language is the way t...
I have two automata of states, transition and events (Etat, Transition, evenements) and I want to create a function that create the synchronized product between those two automata. For instance, given plant and spec automata, plant : donnees=("nomprob", # name of the problem [("e1",True),("e2",True),("e3",True)...
Here is the Python code. The solution is fairly common and is seen in most textbooks like 'Cracking the Coding Interview' and 'Element of Programming Interviews'. class TreeNode: def __init__(self, x): self.right = None self.left = None self.val = x Here is the solution: class Solution(obje...
In MIPS processor, address bus is of 32 bits. So on addressing an instruction, a whole 32 bit instruction is fetched. How is it byte addressable then? I mean if on addressing a particular address, the memory sends 32 bits as a wholesome, how is it byte addressable?
Given a set of points in the 2-d plane, find the minimum edge size, L, that would allow the construction of a tree whose edges connect all given points, but no edge exceeds length L. Here is an algorithm, which I think might work but seems slow: Pick a random point find the distance of its nearest neighbour, store t...
I don't think there's any way to ask a very precise question here, so this might be considered opinion based. Nevertheless, it seems the question is clear enough because I'm asking whether these two initial steps towards a theory are trying to achieve the same thing. It seems to me Hoare went towards an imperative-ca...
I have given this question as home assignment. I tried a lot to solve it but couldn't found any solution. Please help Thanks in Advance!
I know that CFG for $$ \{a^{m}b^{n}\mid m\leq n\leq 2m \}$$ is $$ S\rightarrow ab/abb/aSb/aSbb $$ but I am not able to tweak it in such a way that it is strictly in between m and 2m and not equal to any of m or 2m. I want to draw PDA for the same. For drawing the PDA what I did was to push non-deterministically 1 a ...
my question is that given a list of integers (lets say A), for each element A[i], find the smallest element A[j] which could satisfy A[i] < A[j] and i < j. Return -1 if there is no such element. For example, given [4,2,1,9,3], return [9,3,3,-1,-1] I have come up with a brute force solution which costs $O(n^2)$, but I'm...
Given set of grammar rules, how to find if they correspond to Context-free or unrestricted? Just for Understanding (don't solve the below one), eg: \begin{align} S &\rightarrow B/A, \\ 1B &\rightarrow 111B, \\ 1A0 &\rightarrow 00 \end{align}
Does anyone know how efficient was the first Turing machine that Alan Turing made? I mean how many moves did it do per second or so... I'm just curious. Also couldn't find any info about it on the web.
Say I have a set $\mathbb{S}=\{1,2,...,n\}$. I have an adversary who breaks up $\mathbb{S}$ into $k$ unknown and disjoint subsets. Denote this new set $\mathbb{A}$. I can guess any combination $s$ and my adversary has to tell me if $s$ is itself a subset of any element in $\mathbb{A}$. For example, if $n=4$, a valid $...
Given a graph with positive edge weight representing "time to travel through", and 2 or more pairs of start/end vertices, we can find concurrent paths for the pairs such that the maximum cumulative weight along any path is minimum, using classic shortest path algorithms. Now what if the weight is not static, but repres...
I'm trying to learn reduction. I have this problem called "even subset sum" that's very similar to subset sum. It's the same problem as as subset sum except that the only numbers allowed are even positive integers. I'm trying to show this problem is NP-hard by reducing the problem subset sum to it but I'm not sure wher...
I would really appreciate if someone can explain the syntax diagram itself and can help to build the parsing tree.
i have this program to prove: given the ex3 method below Suppose that the formal parameter "a" has always at least 2 elements and that a.length > i >= 1 Prove that ex3 satisfies the following predicate: ex3 (a, i) <==> (for all k 1 <= k <= i ==> a [k-1] == a [k] +1) public static boolean ex3 (int[] a, int i) { ...
Let $G=(V, \Sigma, R, S)$ be a (non regular) probabilistic context-free grammar, and $u_1, \ldots, u_n$ a set of $n$ strings generated by $G$. For finite $n$, it is always possible to find a regular grammar $\hat G=(\hat V, \Sigma, \hat R, S)$ which generates the strings $u_1, \ldots, u_n$. Intuitively, as $n$ goes to ...
I’ve encountered the following difficult question that I don’t know how to solve. $L_1$ and $L_2$ are regular languages over the same $\Sigma$. $$\begin{align}L^\wedge=&\{σ_1σ_2...σ_n\mid n\ge1, \sigma_1, \sigma_2, \cdots, \sigma_n\in \Sigma, \\ &\exists \mu_1, \mu_2,\cdots,\mu_n,\zeta_1,\zeta_2,\cdots\, \zeta_n \in\S...
I was asked which among the following is true: $\Sigma^*-\{\epsilon\} = \Sigma^+$ $L^* - \{\epsilon \} = L^+$ As I can see, both $\Sigma^*$ & $L^*$ are sets. I thought both were true because of set difference, but the answer lists only the first option as correct and the second as false. How so?
The problem is informally defined as follows: There is a pipe with holes in it, located at discrete positions. We have tubes that are used to cover the holes. Tubes come at fixed radius. Having a tube of a radius of 1, say, placed at position 3, covers holes at positions 2, 3, and 4. The puzzle is about providing posit...
Hi I know two nested for loops will have time Complexity of O(n²). However let's say first loop starts from 0 and goes upto variable X max value(suppose x is n) and second loop starts from +1 of the first loop then we woudn't compare all the values of x with all the other values of x.In that case it woudn't be n². In t...
In Spanning Tree Protocol, a root switch is selected at first, and then somehow, the shortest path from each other switch to the root is obtained. Thus we established a tree network. My questions are: After the tree network is established, does the root switch act as a center in the network? In other words, all the...
Imagine you encode an 8 bit symbol as a 10 bit symbol that is sent sequentially over a wire. The goal at the receiver is to detect the byte boundary. Since there are 4 times more encoded symbols than source symbols, 3/4 encoded symbols are invalid. So the idea is that if you look at a buffer of received bits, if they a...
I am not 100% sure if this is the right stackexchange to ask. I have a max-flow algorithm and I am also computing the min-cut from that algorithm. I want to test the correctness and speed of it and I am trying to find if there are some datasets against which I can test my algorithm. The dataset should preferably have...
I am working on solving the following problem and implement the solution in C++. Let us assume that we have an oriented weighted graph $G = (V, A, w)$ and $P$ a set of persons. We receive a number of queries such that every query gives a person $p$ and two vertices $s$ and $d$ and asks to compute the minimum weighted p...
I know about Steiner Tree Problem. It is stated as Input to Steiner Tree Problem is a weighted graph G and a subset T of the nodes (called terminal nodes) and goal is to find a minimum weight tree that spans all the nodes in T. Can we give a polynomial time algorithm to solve the Steiner Tree Problem such that |T| ...
Source: K. Riesen, Structural Pattern Recognition with Graph Edit Distance, Advances in Computer Vision and Pattern Recognition. Link: https://www.springer.com/cda/content/document/cda_downloaddocument/9783319272511-c2.pdf?SGWID=0-0-45-1545097-p177820399 Below I want to ask clarification for an example in the text as i...
I define a parser as a context-free grammar with semantic actions for each production. It is not defined in what order the semantic actions run, just that the semantic actions of the non-terminals in a production run before itself does. E.g. a (very) simple arithmetic language: S -> E { print(nt[0]) } E -> E '+'...
I have a problem which i don't know how to calculate or more specifically what am I missing. The subject is about 802.11 (wifi) The selected PHY rate is 54Mbit/s, that is whenever DATA is being sent the rate is 54Mbit/s, and when the node is not sending anything the rate is 0. To simplify the task, assume that there ar...
This is sort of a computer science question and sort of a programming question. What is the name of the formal class of languages that can be described by .NET regular expressions (assuming it a well known class)? For instance formal regular expressions describe the class of regular languages but .NET regular express...
I've been exploring the differences between Context Sensitive Analysis (CSA) and Context Insensitive Analysis (CIA), members of inter-procedural static analysis. The problem I'm coming up against is when to use one over the other. Namely, suppose the following context: The input program is in Static Single Assignment ...
A problem instance is a linear program with the following kind of quadratic inequalities allowed: For some of the variables $x_i$, there is a variable $s_i$ (intuitively for approximating $x_i^2$, and distinct from all the $x_j$) and positive constants $l_i,r_i$, such that the following constraints are also included: $...
You are given a linked list of size $n$. An element can be accessed from the start of the list or the end of the list. The cost to access any location is $\min(i,n-i)$, if the location being accessed is at index $i$ and it belongs to a list of size $n$. Once an index $i$ is accessed, the list is broken into two lists. ...
Section 2 of this Lecture Note: Shortest Path Algorithms Luis Goddyn, Math 408 describes an algorithm using Edmonds' Minimum Weight Perfect Matching Algorithm to solve the shortest path problem for undirected graphs with negative-weight edges but no negative cycles. I have two problems in understanding this algorithm: ...
It seems that this article (https://arxiv.org/pdf/1312.4456.pdf) proposes that laws of physics are uncomputable (i.e., they could not be reproduced on a computer), but I'm not sure about it. In some part of the article it says: If we expand the set of computational devices that we use to define computational complex...
How would you formally prove the non-existance of a polynomial time verifier for $A_\mathrm{TM}$? I mean we can't just say that in order to read a certain certificate we need more than poly-time because we need to prove it for any possible certificate. What would be the correct proof ?
I'm currently programming a go game, and I'm struggling with some aspect of the game, especially how to handle the end game, how to count points and how to detect dead stones ? I thought of doing a BFS on an empty intersection (to get all the empty intersections connected) and if all the stones connected to the BFS (Gr...
Given a matrix NxM of positive integer values and a starting position (that has value 0), determine the maximum sum path of length K that starts and ends at the aforementioned position. Legal moves are up, down, left, right and each position can be visited multiple times but only contributes to your sum once. Example: ...
If I understand(*) correctly, a decision problem is some function $f(x)$ whose function argument $x$ can be represented by data of a limited length (e.g. not an irrational number) and whose value is either 0 or 1. If there exists some algorithm which can calculate the function value $f(x)$ in less than $\sum_{i=0}^{i_\...
TL;DR: I implemented a special (?) binary tree and can't find any further details on the method I used on the internet. I would like to know if there are any scientific papers discussing my implementation. Long version: I saw this very interesting binary tree using "bin numbers" in RFC 7574. The leaf nodes contain da...
Let $f$ be a binary relation defined on set $S$, which contains numbers from $1$ to $n$. It is also given that number of $|\text{Img}(f)| \le k$. I want to store the function $f$ such in way such that space required is minimum. I am trying to store the function with a graph, but number of edges turnout to quadratic in ...
I have difficulties understanding how the priority queue is used in Dijkstra algorithm. Wikipedia lists 3 operations performed on priority queue: add_with_priority(), extract_min(), decrease_priority(). With the first two I have no problems, both operations are screaming fast. But the last one is executed with the p...
I have an algorithm that solves the Vertex Cover problem. The algorithm is Repeat while there is an edge: Arbitrarily pick an uncovered edge $e = uv$ and add $u$ and $v$ to the solution. Delete $u$ and $v$ from the graph. I know this strategy is a 2-approximation to Vertex Cover and that its worst example is the ...