instruction
stringlengths
35
29.1k
Let's define: $Disagree(M_1,M_2) = \{x| $The result of $M_1$ on $x$ different from the result of $M_2$ on $x\}$ that means: if $M_1$ accept, $M_2$ reject and vice versa $NPA=\{L|\exists M_1,M_2$ Nondeterministic polynomial TM $ s.t. Disagree(M_1,M_2)=L\}$ Is $NPA=R$? I thought about this problem from 2 clashing ways:...
The following is psuedocode used to shuffle the contents of an array $A$ of length $n$. As a subroutine for shuffle, there is a call to Random$(m)$ which takes $O(m^2)$ time for an input $m$. Determine the runtime of the following algorithms. Algorithm 1: function Shuffle(A) Split A into two equal pieces A, and B (this...
I'm trying to find the average case number of times that max is assigned by the algorithm findMax included below. findMax(list): maxNum = -oo # negative infinity for k = 0 to len(list)-1: if list[k] > maxNum: maxNum= list[k] return maxNum The distribution I have considered is uniforml...
Given a tree in which each node has a given value, I want to process "Path Minimum Queries": given two nodes, what is the minimal value of any node on the shortest path between them? My original idea was to solve Least Common Ancestor Queries on any two nodes (using an Eulerian Tour Tree or the Binary Lifting Method), ...
I am looking to create a single tape acceptor Turing machine acting upon the language of any ASCII string, that would only accept strings that contains at least five G's and at most three T's, and rejects any other ASCII string input. I am kind of stuck on how the machine would know that it had encountered greater than...
How are the fundamental approaches to proving theorems by LCF and Automath different? Considering their modern descendants - Isabelle for LCF and Coq for Automath, both rely on type checking to do proof checking. Theorems in Isabelle have a theorem type and the only functions that can create instances of this theorem t...
I am looking for a reference for maximum cardinality weighted matching and the best running time algorithm for it. Maximum Cardinality Weighted Matching: Given an undirected weighted graph $G(\mathcal{V},\mathcal{E})$ where $\mathcal{V}$ is set of vertices and $\mathcal{E}$ is the set of edges where each edge $(i,j) \i...
I'm currently reading The Algorithm Design Manual by Steven S. Skiena as my first book to algorithms. Something in the asymptotic part is kind of confusing to me. Proving the Theta The analysis above gives a quadratic-time upper bound on the running time of this simple pattern matching algorithm. To prove the theta, w...
I am studying the Alpha Beta pruning algorithm here. function alphabeta(node, depth, α, β, maximizingPlayer) is if depth = 0 or node is a terminal node then return the heuristic value of node if maximizingPlayer then value := −∞ for each child of node do value := max(value, alphabeta(child, depth − ...
I originally posted this over on Software Engineering, but it was suggested that I repost it here. I am working on a BCD Floating point library and I'm a bit stuck on the EXP (antilog) functions. The goal is to maintain accuracy for the entire length of the number which could exceed 100 significant digits. So the requ...
What is the minimum number of states required in any DFA to accept the regular language $L$ over $\Sigma=\{0,1\}$ which accepts those strings that start with 1 and end with 0?
My question related to relativized world. I would like to know about how to show that class is different from another class in the oracle world and whether this applied to our real world. For example, let us have the following assumption: suppose for all oracles A we have $P^A \neq PSPACE^A$, then Does it imply that $P...
I want to calculate the frequency of each character in an array. (e.g ['a', 'b', 'o', 'p'] There are several ways to do this: A Simple brute-force over the array would need $O(n^2)$ time and $O(n)$ space Sorting the array first and serial counting the characters is a better solution with $O(n \log n)$ time and $O(n)$...
I see a lot of lecture notes where they use the term "congruence" (ex: congruence relation) or deriving usages such as "the expression e is alpha-congruent to e2". Could someone please explain what congurence means exactly in this context and give some examples to a noob without much knowledge about math/lambda-calculu...
I'd like to understand more how data can be stored on disk so it can be read quickly. I don't want to say database record because I'm not asking how to build a database. My question is closer to how would I build a table. I'm not asking about indexing. I'm thinking about you have an application that already has some a ...
I have been reading about AI search, specifically the toy vacuum cleaner problem and I would like to code an example of this but I am finding the description of the state hard to get my head around. The problem states that the AI needs to be able to move between squares, either left or right and if there is dirt in the...
I have a set of numbers $P=\{p_1,\dotsc,p_{|P|}\}$, where $|P|$ is the length of the set. I want to select a subset, $S$, from $P$ such that its mean is approximately equal to a predefined value $\mu_s$ . $$\sum_{x \in S} x \approx \mu_s * |S|$$ My problem: $|P|$ = 5000 $|S|$ = 1500 $\mu_s$ $\approx$ 90 $(target$ $mea...
In Coq, the nat, the type of natural numbers, has type Set. By the Curry-Howard Isomorphism, all propositions of type Prop are types of corresponding proof terms. How do nats or other instances of Set figure into this isomorphism? In other words, is there a correspondent for Sets in the Curry-Howard isomorphism, as the...
I want to verify semantics of a library of atomic primitives that I wrote. The idea is, only if the semantics of all the primitives are consistent with each other, an application that uses them could behave predictably. For example, a composition of a primitive Fx(lck) which takes exclusive lock on an lck object could ...
I'm trying to efficiently compute events in a time series by grouping them into buckets. My goal is to have as few buckets as possible. The constraint is that events within one bucket are all within a 30 minute time window. To get more concrete, let's assume I've got these events: time event 15:15 1 16:58 2 ...
I am studying balanced trees, especially AVL trees. My question is whether is it possible to create an avl tree given any set of numbers. is it possible to prove the following statement? Let $A$ be the set of integers. Given any set $A$, it's possible to create an avl tree corresponding to the given set of numbers. I...
I am curious to know if RTOS provides deterministic scheduling gurantees then why not all OS'es are RTOS? In what sense regular OS say linux better then RTOS say FreeRTOS?
"make sure you understand why for a non trivial property $S$, $\bar{S}$ is also non trivial" My assumption is: $S$ is non trivial property: There are L1,L2 such that $L_{1},L_{2}\in RE$ and L1 sattisifies the property whereas L2 doesn't. If i assign the complement then it still holds the same just reverse the relation...
I have problems interpreting the definition of asymptotic notation where the functions involve two different set of variables. I am quite confident with the definition of $f(n) = O(g(n))$ and its extension to the multivariable case ($f(n, m) = O(g(n, m))$). However I don't actually understand the meaning of $f(n) = O(g...
As the title says, if an algorithm delivers $m$ before multicasting $m$, does the validity property still hold? I would argue that it doesn't matter, as the purpose of validity is to ensure that the process reaches consensus with the other processes that it multicasts to.
This question is about the correct terminology. Let $P1$ and $P2$ be two LOOP programs. Then $P1;P2$ is also a LOOP program, which executes $P1$ and then executes $P2$. Would this be called concatenation of LOOP programs or nested LOOP programs? I know the answer has to be concatenation because nested would mean having...
Can someone remind me the algorithm that split vertex of graph to 2 groups that at least half of the edges are external, I mean between the groups. As I remember it was a greedy algorithm, each time chosen the vertex with highest number of edges, or something similar
A company has several automatic vertical warehouses (called elevators). Each elevator have several trays and each tray has several slots. A slot contains a given quantity of a given article. Elevators, trays and slots are identified by unique IDs and slot also have access to the ID of their own article. In the same tra...
I apologize if this is not the right stackexchange for this question. I was playing around with the Python programming language, when I discovered something strange. It concerns replacing a substring of a string with another substring. For example, in "spammy", replacing "mm" with "xx" results in "spaxxy". However, in ...
We have five types of photo receptors in the eyes but computer color systems just use the three red, green and blue. Three could be motivated if rod and melanopsin sensations are just linear combinations of cone sensations. Is it so or would a five color display with two additional pixel components with a frequency di...
Where does the code for consistent hashing reside? I have read how it is implemented (at a high level), but am unsure if it is exposed as a microservice between the web server and the app servers or on each app server (would seem unlikely).
I train a neural network - one of the Resnet variations ($\approx 10^7$ parameters) on the CIFAR-10 dataset - and after each epoch, I would like to find the smallest/largest eigenvalues of its Hessian. Formally, we can view our NN as a function: let our dataset (training set) be $D$, let $x$ be NN parameters, and we wa...
I am trying to make a CNN model . Training the image . Want to know that When we apply kernel on image and take out the features of images. That features are rotation invariant or we have to apply some rotation invariant techniques? . Few person on stack overflow says that max pooling does rotational invariance , some ...
I want to try and write an example that solves the problem of travelling from one location to another described in the book AI: A modern approach. The problem involves getting from a particular city in Romania called Arad to Bucharest and the problem can be expressed as a graph like in the following image: If when con...
I have a question, does non-polynomial reduction exists for all problems? the issue is only regarding polynomial reductions?
I've been given a matrix path problem to solve and I need some hints / advises. You're given a $m \times n$ matrix where $m$ is number of rows and $n$ number of columns. When you're in a cell $(i,j)$ you can only move to cells $(i,j+1)$, $(i-1,j+1)$ and $(i+1,j+1)$. Three subproblems have to be solved. I solved first t...
Consider a relation R(A,B,C,D,E) and the only FDs, ABD->C BC->D CD->E These are the only 3 FDs. I want to know if the above relation is in 2NF or not. According to the definition of 2NF, a relation to be in 2NF, it should be in 1NF and it should not have partial dependency. But I'm not getting the partial dependency co...
I am trying to make a Convolutional neural network. Training the images of different brands of Logos. Have 100 images per class and there are 40 classes. I have trained the model now want to check that model is overfitted or not . What should be the number of epochs we will se that with no improvement after which train...
I am trying to understand the proof for this theorem (theorem 4.22 of the book 'An introduction to the theory of computation'): A language is decidable iff it is Turing-recognizable and co-Turing-recognizable. The first direction is OK. But the other is not, namely: What I don't understand is why the author assumed t...
I was trying to understand how we can solve the Longest Increasing Subsequence (LIS) problem in O(N log N) time. I came across a sorting algorithm called the patience sort algorithm. To learn it I was going through this document: https://www.cs.princeton.edu/courses/archive/spring13/cos423/lectures/LongestIncreasingSub...
I am wondering whether Neo4j and the associated Cypher query language is computationally equivalent to relational algebra? Any ideas or papers on that topic?
I am working on the following exercise: Consider a simple and connected undirected graph $G(V,E)$. Show that one can colour the edges of $G$ in polynomial time and with as few colours as possible such that there is no monochromatic cycle in said colouring of $G$. EDIT 1: OK, my approach turned out to be false. I will...
I know that the NSA has recommended cryptography algorithms, such as their A/B suite algorithms and their Commercial National Security Algorithms Suite. I also know that they change their recommendations for key size, an example being in 2019 when they changed the key size recommended for RSA and Diffie Hellman from 20...
I'm trying to understand what's the difference between $S=\emptyset$ and $S=\{\emptyset\}$ The diffenition that I found for $L_S=\{\langle M\rangle\ | L(M)\in S \}$ I understood that $S=\emptyset$ and $S=RE$ are trivial and $S=\emptyset \Rightarrow L_\emptyset=\emptyset\in R$ $S=RE \Rightarrow L_{RE}=\Sigma^*\in R$ But...
Let $quasiP$ be the quasipolynomial time complexity class. Is $E^{quasiP}=E$ false? Is $E^{DTIME(2^{(\log n)^k})}=E$ false at every $k>1$?
I am looking for an algorithm for approximating the chromatic number of an undirected simple graph with $n$ vertices in $O(n^{c_1})$ time and $O(n^{c_2})$ space, for some constants $c_1$ and $c_2$. More precisely, the algorithm should find an upper and a lower bound on the chromatic number. The closer the bounds are to...
I am implementing a 2-3 tree, where every leaf has a unique key and a value, and I need to write an algorithm which finds the sum of values of the leaves which their key is within a given interval. The time complexity of the function needs to be $O(\log n)$. I thought about saving for each internal node the sum of the ...
I wanted to recreate the results of this paper, where the authors draw the boundary between two parts of a building from stereo images. The authors mention that the epipole and the intersection of the two planes (two sides of a building) from two cameras can be found from the eigenvectors and the eigenvalues of the hom...
I don't know how to prove or show the following fact. $\quad$ $\{xx|x \in \Sigma^\ast\} $ can be accepted by a queue automaton. If it would be possible, show by deterministic queue automaton. If not, by non-deterministic queue automaton. If it's not that hard and if I can, please give me a hint.
I am writing an app which displays speeches on various topics, with each speech having a number of attributes. I want to give the user the choice to sort a list of speeches by an attribute, even within a previously sorted list of speeches. Consider for example: Suppose the previous list had been sorted by the attribute...
Disclaimer: I am not even an expert user of these two kinds of software. I understand that the trivial difference between proof assistants and CAS is that in proof assistants, the goal is to show that the given proposition reduces to a tautology. Whereas CAS are used to perform various transformations on mathematical e...
Is it correct to state that $u$ is a universal function if and only if $$ \forall f : \text{RE} \quad \exists g : \text{R} \quad \exists h : \text{R} \quad f = h \circ u \circ g $$ where RE is the set of recursively enumerable functions and R is the set of recursive functions? (Should R be replaced with something like ...
I want to make a following proof but I got some difficulties with it. Would be super if you people have any tips / advises. Introduction: Let (N,e) be our public key and (N,s) our private key with $N=pq$ and $ggT(\varphi(n),e)=1$, as well as $es\equiv 1\mod N$. I want to show that since Lemma of Bézout shows, that ther...
Thank you for looking into this, I have a problem regarding direct cache mapping, My problem really though is with the question formation itself and the problem I am about to present seems to have inconsistency and has unclear description. So the problem is as follows ( I am presenting exactly as given ) 32 bit archit...
Let us say that there exists a $\mathsf{NP}$-reduction from a problem $A$ to another problem $B$ when there exists a non-deterministic, polynomial-time Turing machine $T$ such that for each $a \in A$, one of the possible outputs of $T(a)$ is in $B$ (and conversely, if one output $T(a) \in B$, then $a \in A$). $\mathsf{...
I have been looking at the FPT(Fixed Parameter) algorithm for checking if a vertex cover of size k exists.The algorithm goes as follows: VertexCoverFPT$(G, k)$ if $G$ has no edges then return true if $k=0$ then return false let $uw$ be some edge of $G$ if VertexCoverFPT$(G-u, k-1)$ then return true if VertexCoverFPT$(G...
I have a canvas. On this canvas, I want to position 1, 2 or 3 images. The images can be positioned anywhere on the canvas just as long as they're within the canvas. The images move by their top-left corner. To make sure that the images do not leave the canvas, I am doing this: image_topLeft_x_position = random.randin...
I need to plan an algorithm that decides if a directed weighted graph $G = (V,E)$ has a zero weight cycle. the graph has no negtive cycles the algorithm needs to be in $O(|V| \cdot |E|)$ time my idea was to first add a vertex (called $r$) and connect it to all of the vertices in the graph. and then use the Bellma...
If I have a recurrence equation: $$T(n) = 3T\big(\frac{n}{4}\big) + cn^2$$ It says it splits a problem of size n into 3 subproblems of size n/4. Then it keeps splitting it until the problem size at the leaves is 1 or less. The first part that does not make sense to me is how can you split a problem of size n into 3 pro...
A boolean function $f \colon \{0,1\}^n \rightarrow \{0,1\}$ is symmetric if $f(x)$ depends only on the number of $1$s in $x$. It is known that every boolean function is in $\mathrm{NC}^1$, i.e. there is a circuit of depth $O(\log n)$ computing it. What is known about the constant inside the $O()$ notation? Specifically...
The input: a binary tree and a list $L$ of vertices in that tree. The output: a sublist of $L$ of minimal length that has the same lowest common ancestor as $L$. If there is several sublists of minimal length it is OK to output any one of them. We could just check all the possible sublists of $L$ but that seems ineffic...
I am looking for the answer to the exercise 1-6 in "The Algorithm Design Manual" book. it is stated as follows: 1-6. The set cover problem is as follows: given a set of subsets $S_1,\dots,S_m$ of the universal set $U = \{1,\dots,n\}$, find the smallest subset of $T \subset S$ subsets such that $\cup_{t_i \in T} t_i = ...
I'm building a relevance ranking system for incidents occurrence and prevention. My goal is to use four attributes to establish relevance: tag (About 500 tags), x_coordinate, y_coordinate and time. The final state that I would like to achieve is: to select an object and have a relevance list from the most relevant obje...
Given the root of a binary tree, for instance below, I am running the following tests in Python: 1 / \ 2 5 / \ 3 4 Test 1: cur = root root = None print(root, cur) None, node 1 Test 2: cur = root root.left = None print(root.left, cur.left) None, None In both tests cur and root point to the same mem...
I'm currently learning abstract algebra and the word free appears (free monoid, free vector space) throughout different literatures. Is there a general (and simple) definition of the word (and possibly examples in functional programming) or is it merely a highly overloaded word? Many Thanks!
Let's consider some 128-bit LCG generator mod $2^{128}$, with some random 128-bit multiplier and increment. How fast we can run it using the same tricks like in AES: https://crypto.stackexchange.com/questions/44927/how-long-does-a-good-aes-encryption-take They use there some hardware instruction/hardware acceleration a...
I am trying to make a CNN model on different brands of logos . Firstly , I wrote a CNN from scratch and trained it on which I got 70% accuracy, I have total 40 classes and each class has 100 images . I know it is too short, that is why I am now moving towards pretrained model. My question is that I read on Internet tha...
To prove that SAT-TM (Turing machine emulating the satisfiability problem) is NP-Hard $$\text{SAT-TM}:=\{⟨M,p,1^k⟩ \; | \;∃c,\; |c|\leq p(k), \;\text{such that M accepts c in ≤k steps}\}$$ my professor used the following proof. Suppose $L$ in NP and $V$ is a verifier for $L$ running in polynomial time of power k. $$L ...
Given an undirected graph $G=(V,E)$ and weight function: $ w: E \rightarrow \{1,2,...,10\}$. Describe an algorithm that finds the set of all edges $e\in E$ for which there is a cycle $C$ in $G$ that contains $e$ such that for every $e' \in C, e'\neq e$ : $w(e')\leq w(e)$. I thought maybe because the weights are bou...
I've been doing research on precollege summer programs, and one ongoing project that has come up is "Improving Label Noise Robustness with data Augmentation and Semi Supervised Learning". So, could someone break this down for me? What is a label, what is label noise, and why is it such a large issue?
I want to give examples to explain want I want to know first. Let $G \colon s \mapsto G(s)$ be a PRG. Let $F_{1} \colon s \mapsto G(s) \Vert b$, where $b = \bigoplus_{k = 1}^{|G(s)|} G(s)[k]$. Obviously, $F_{1}$ is not a PRG, since the last bit can be predicted. But if we remove the last bit, it is a pseudorandom stri...
Problem The enemy army has taken $n$ of our cities. In each city $i$ the enemy has placed $e_i$ soldiers. We have $n$ teams, each team $j$ with $d_j$ soldiers. If we place more soldiers in a city than the enemy, we retake the city. Our aim is to distribute our teams so that we maximise the number of retaken cities if:...
I have searched on the internet to find different ways to learn binomial heap operations. What I have found is not quite helpful for me.For example, for delete min operation the algorithm says: Search through the roots of binomial trees and find the smallest key and call it x.Remove the x from the tree. Create a new e...
I’m having some troubles with Bellman Ford Algorithm in the following exercise My guess is that at the end the algorithm should detect the negative cycle BD DF FG GB since B is decreasing at Vth (i.e. 7th) iteration. However changing the distance of the source does not make much sense to me. Is the source to be conside...
Consider a variant of Dijkstra's algorithm (for a directed graph) where nodes are visited not in order of total path cost, but in order of incoming edge cost. (Assume here that all edge costs are positive and distinct). Nodes are never re-visited. What can we say about the resultant paths? One obvious result is that th...
In the standard proof of this language not being regular using the Pumping Lemma for Regular languages, one picks $0^p 1^p 0^{p+p!} 1^p$ where $p$ is the pumping constant and using that can derive the string $0^{p+p!}1^p0^{p+p!}1^p$ (since $p$ divides $p!$ for every $p$, thus proving the language is not regular. Is the...
I am currently working on an experiment to link reinforcement learning with graph neural networks. This is my architecture: Feature Extraction with GCN: there is a fully meshed topology with 23 nodes. Therefore there are 23*22=506 edges. the original feature vector comprises 43 features that range from about -1 to 1. ...
Okay so I'm going through a book CS:APP. I'm in chapter 2. And problem 2.13 talks about how the Digital Equipment VAX computer used bis (bit set) and bic (bit clear) instead of Boolean operations AND and OR. Both instructions take a data word x and a mask word m. They generate a result z consisting of the bits x modifi...
Wikipedia says stack machine “designs have though been routinely outperformed by the traditional register machine systems, and have remained a niche player in the market.” Why is this?
Consider the problem of computing an exponential sum over a certain function $g(x)=f(x)+h(x)$, that is computing $$\sum_{x}g(x)=\sum_{x}f(x)+\sum_{x}h(x)$$ now if we know that $\sum_{x}f(x)$ and $\sum_{x}h(x)$ are two NP-Hard problems, what can we say about the hardness of $\sum_{x}g(x)$?
This question is an extension of this one: Min path cover for a three-layer graph with all paths traversing all layers. I'm designing fictional fruits. Each fruit has three attributes; color, taste and smell. Also, each of the values of the attributes have some compatibility with the values of the other attributes. So,...
If the page size is 4Kbyte and the physical size of the main memory is 32Kbyte. Now if I consider virtual address of 37064.. The page number is then 37064/4096 = 9 And according to my diagram page 9 is mapped to frame 6 But how do I calculate the offset? According to exercise it should be 200. Thank you
Given the grammar $G=(\{S, L_x, R_x, W_x\}, \{a,b\}, P, S)$ derive the words $abaaba$ and $aabbaabb$. $$ P=\left\{ \begin{align}S\phantom{{}_x R_y} &\to \epsilon \mid L_x R_x,\\ L_x \phantom{R_y} &\to x \mid L_x y W_y,\\ W_x y\phantom{{}_y} &\to y W_x,\\ W_x R_y &\to R_y x,\\ ...
Consider the following functions: $$f(n)=2^{\log^*n} \text{ and } g(n)=\sqrt{2}^{\log{n}}$$ Using $\log{}$ properties I think that $g(n) < f(n)$, since: $f(n)\sim n$, $g(n)\sim n^{\frac{1}{2}}$, and $n^{\frac{1}{2}}<n$. However the book that I'm reading says otherwise. What have I gotten wrong?
I have to design a nondeterministic one tape Turing machine that accepts only non-palindromes in $O(n \log n)$ time. My best shot was only in $O(n^2)$ time. How can I use the properties of NTM on a single tape to find a faster solution?
What does yields mean in the phrase yields no back edges in the context of DFS? procedure DFS(G, v) is label v as discovered for all directed edges from v to w that are in G.adjacentEdges(v) do if vertex w is not labeled as discovered then recursively call DFS(G, w) As you see, the line if ...
My understanding is that a language cannot be decided if the language is actually infinite (not generated by any machine). However, actual infinites make me squirm. Is there any reason to believe in semi-decidable or undecidable languages other than a belief in actually infinite sets? A positive answer to this question...
I saw that the injectivity "derives directly from the theorem", but i can't see how it's happen, any explanation?
Why does quicksort have a big $O$ notation of $(n \log n)$. I would like some help understanding what exactly $(n \log n)$ is, and then how it applies to quicksort. Also in $(n \log n)$, what is the base for the $\log$?
Let $(G,+)$ be an abelian group, $X$ a finite set (of "colors"), and $f:G \to X$ a function such that there exists a subgroup $H<G$ for which $f$ separates cosets of $H$, i.e. $\forall a,b\in G:f(a)=f(b)\iff a+H=b+H$. Using information gained from evaluations of $f$, determine a generating set for $H$. This is the hidd...
I'm trying to learn augmenting paths and I got confused. I've found some other source that has the same setup that my slides have, therefore I will refer to that. It is said that Each augmenting path computation can be easily done in O(m) time. in these lecture notes within a graph of m edges. I could not understand ...
The Combinatory Logic uses expressions of the form (x y) called "applications" (here, we have an "application of x to y"). Thus, the language of CL is a set of "parenthetic expressions", each looking like a string of variables to which pairs of balanced parentheses are multiply applied in an exhaustive manner (that is,...
I know that it's a bit stupid question.. , but still, Is there any difference between $RE$ and $RE\setminus R$ notations? I'm asking because I saw that in some places using both of the notations, for example for $$ L_{HP}=\{(\langle M\rangle,x)|M\ halts\ on\ x\}$$
Why is it the case that when Alice and Bob use a noisy channel for communication, the capacity of the channel does not increase even if they are allowed to share pre-distributed randomness? This is mentioned in some notes (see paragraph before Section 4 of https://cds.cern.ch/record/613098/files/0304102.pdf) but I have...
I am given a directed graph $G=(V, E)$ with a weight function $w: E\to\mathbb{R}$, that doesn't contain negative cycles. I need to find an algorithm that returns true if and only if there is a cycle with weight zero in the graph. The time complexity needs to be $O(|V||E|)$, so I thought about using Bellman-Ford algorit...
Given a directed graph $G=(V, E)$, two nodes $s, t \in V$ and a subset of nodes $U \subseteq V$. Provide an algorithm that determines if there is a shortest path from $s$ to $t$ that passes via all nodes in $U$. I came across a solution that starts with the following steps Run BFS on G, notate $d_s(v) \quad \forall v ...
What is the time complexity of the following functions, and why? int f(int n) { if (n <= 1) return n; return 2*f(n-1); } int g(int n) { if (n <= 1) return n; return g(n-1) + g(n-1); } ```
In a system with a single type of resource, there are 8 processes with the following maximal requirements: Process P1 P2 P3 P4 P5 P6 P7 P8 MAX 75 60 65 35 30 45 30 30 Specify the minimal value for the total number of available resources, so that the state of the system is considered safe, in the scenario w...
My resources were the following video, as well as this video. Basically, in one of the videos they state that the good suffix table for the pattern "ABCBAB" is the following: k suffix d2 1 B 2 2 AB 4 3 BAB 4 4 CBAB 4 5 BCBAB 4 and for "DRIDI": k suffix d2 1 I 2 2 DI 5 3 IDI 5 4 RIDI 5 ...
So as I understand $EQ_{TM}$ (problem of deceiding whether two turing machines are equivalent) is not Turing Recognizable (by showing that $A_{TM}$ is reducible to its complement ${NEQ_{TM}}$). But we can also reduce $A_{TM}$ to $EQ_{TM}$ itself, that means: $EQ_{TM}$ and ${NEQ_{TM}}$ are not disjoint since we can redu...