instruction
stringlengths
35
29.1k
I'm studying about Cook-Levin theorem but there is a problem I faced. Cook-Levin theorem shows that any NPTM can be encoded as a boolean formula. About given language $A$, instance $w$, and NPTM $M$ that decides $A$, I understand that when a boolean formula $φ$ is true when $M$ accepts $w$ and false when $M$ rejects $w...
Min-ones SAT is apparently NP-complete. I get that it is NP-hard (because SAT is trivially reduced in polynomial time to it), but I don't actually see how minimality can be verified in polynomial time. Thus, my question: why is Min-Ones SAT in NP?
The problem is as follows: design DFA over an alphabet {a,b}, that accepts a language: L = {$xwx^R$ | $x \in \{a,b\}^+, w \in \{a,b\}^+$} I have no idea how to remember the first word to be able to detect a reverse of it. I will appreciate any help.
Suppose we have an $n\times n$ zero/one matrix $M$, with $k$ ones. Let us say that the extent of $M$ is the maximum of $i+j$ over all ones at positions $(i,j)$ of the matrix, and the quality $q(M)$ is the minimum of the extent of $PMQ$ taken over all permutation matrices $P$ and $Q$. Let $f(n,k)$ be the maximum of $q(M...
Given a set of strictly positive numbers $a_1, ..., a_n$, the problem is to determine if $\lfloor n/2 \rfloor$ different indexes $i_1, ..., i_{\lfloor n/2 \rfloor}$ exist so that $$\frac{a_{i_j}}{a_{i_{j-1}}} = \frac{a_{i_{j+1}}}{a_{i_j}}$$ for $2 \leq j \leq \lfloor n/2 \rfloor$. How to show that this problem is in co...
As an outsider, it sounds like a lot of progress has been made on understanding rank 1 elliptic curves. Much of the BSD conjecture is known for rank 1, and Heegner points provide a way to calculate a rational point of infinite order on the curve. However, as an outsider, it is hard to understand what properties are fe...
I'm undertaking Theory of Computation Classes. I came across this sentence while studying Recursively Enumerable Grammar: Type-0 grammars generate recursively enumerable languages. The productions have no restrictions. They are any phrase structure grammar including all formal grammars. What is difference betwee...
Example: Finding an element from a sorted array Let's say we have an algorithm that accepts a sorted array of length N as its input. Then in each iteration it randomly selects an element from the array and performs the following operation: if (value == A[randomIndex]) // element found else if (value < A[randomIndex]...
I'm currently reading a book about artificial intelligence and i frequently come across the concept of universal computers, as it is essential to understand the book i would like to know the meaning of author's statement referring to Turning's paper of 1936: If a type of computer can perform a certain bare minimum se...
I studied Computer Architecture from David A. Patterson and have came across the idea of Response time. Response time also called Execution time. The total time required for the computer to complete a task, including disk accesses, memory accesses, I/O activities, operating system overhead, CPU execution time, and so...
I am working on this paper titled “the microarchitecture of superscalar processors by Smith and Sohi” and it says that there are 3 methods of organizing instruction queue. I know that the method “Multiple queues” is the same as the method “Scoreboard” and also the method “Multiple reservation stations” is the same as t...
When we do register renaming to avoid WAR and WAW hazards while executing instructions, how can we know that there is no need for a physical register anymore and we can put it back in the free list?
I know all computable partial functions are countable. Wondering if it is the the other way around as well.
There are two operations as follows: insert(num): insert num into the data structure. find(sum): return a pair(a, b) such that a + b = sum, if no such pair exists return -1 How such data structure could be designed, possibly with find $\in o(N)$ and insert $\in o(\log N)$ operations?
Given a context-free grammar $G$, how can one systematically construct a grammar $G_k$ such that $$ L(G_k) = \{w \in \Sigma^* : |\text{Pref}(w) \cap L(G)| = k\} $$ where $\text{Pref}(w)$ is the set of $|w|+1$ prefixes of $w$? Assume $G$ is unambiguous, if needed.
While watching a sports tournament, I noticed that the tournament tree looks a lot like a heap. I came up with the following data structure: A complete binary tree where the leaves are elements of some set, and each internal node is the $\max$ of its two children. I came up with a BuildHeap algorithm that's $O(n)$, a G...
Consider the algorithm findMax that finds the maximum entry in an integer array. Algorithm findMax($A$) Input: An integer array $A$ Output: The maximum entry of $A$ 1. m <- A[0] 2. for i <- 1 to A.length - 1 do 3. if A[i] > m then 4. m <- A[i] 5. return m Show that there are constants $c_1,d_1,c_2...
The universal approximation theorem states that a feed-forward network with a single hidden layer containing a finite number of neurons can approximate continuous functions on compact subsets of Rn, under mild assumptions on the activation function. How many neurons is needed? For a function in 3 variables and one outp...
As an example, here are all possible trees for the case $k=3$: On each node written is its arity (= the number of children). While this should be solvable by dynamic programming, I think there was a combinatoric result on this (either exact or a rather fine grained upper bound). Does anybody know it? Edit: The size ...
The question is in context to multilevel page table. I was trying to solve numerical on multi-level paging and noticed that page size might not be same at all levels. I came across the point "Outer level page tables need not be page aligned to inner page tables". Question 1: Does this mean that outer level page tables...
Will a study of the mathematical proof of a (data structure and algorithm based) problem, when posed as a proposition, highlight peculiar properties of the problem which may help in designing an optimal algorithm? I think that proofs should yield interesting insights, and therefore can be used in designing algorithms....
The algorithm take in an integer $n$ and outputs the $n$th number in the Fibonacci sequence ($F_n$). The sequence starts with $F_0$. I am trying to prove the correctness assuming valid input: int Fib(int n) { int i = 0; int j = 1; int k = 1; int m = n; while(m >= 3){ m = m-3; i = j +...
The Estrin model for polynomial of degree $n$ is well known. But the reading of the Knuth (vol 2) or the original's paper Estrin do not help (or I miss it). I am not able to determine the complexity of the algorithm for the number of multiplication. The main equation is: $$ \begin{align} c_i^{(0)} &= a_i + x_0 a_{i+1}...
May a DFA recognize a language which is a proper subset of the set of all accepted inputs? For instance, if there is a DFA which decides if an input $W$ has $w_0 = w_n$, can it recognize a language $L$ where there is some $\sigma \in \Sigma$ that does not exist in any element of $L$?
So, using Church numerals, we define $3 = {\lambda} f. {\lambda}x.f(f(f(x)))$, and $4 = {\lambda} f. {\lambda}x.f(f(f(f(x))))$. We can then add with an expression like $3\ g\ (4\ g\ z)$ And this reduces to: $(g (g (g (g (g (g (g\ z)))))))$ ... but why? $g$ is a free variable in each expression, and my understanding is...
This is really a second part to my first question, but I felt that this was different enough from the first part that it merited its own question. So, using Church numerals, we define $3 = {\lambda} f. {\lambda}x.f(f(f(x)))$, and $4 = {\lambda} f. {\lambda}x.f(f(f(f(x))))$. We can then add with an expression like $3\ ...
When deleting nodes from an R-tree, if a branch underflows, then it's meant to be dissolved and its children are meant to be reinserted into the tree. But most R-tree implementations that I've seen just keep the node until it's completely empty. Does this lead to unbalanced R-trees?
I'm trying to prove that for arbitrary $c > 0$, $f(n) = o(n^c) \rightarrow \exists \epsilon > 0 \ s.t. f(n) = O(n^{c-\epsilon})$ Intuitively, this seems to be true to me (little-o implies some gap "between" $f(n)$ and $n^c$ that we can formally express as $\epsilon$). However, I'm having some trouble formalising this ...
Prove that if $L, G$ are regular languages over $\{a,b,c\}$ then $H=\{w\in L|\exists x\in G: |x|=2\cdot |w|\}$ is a context-free language? I think this could be a good exercise and the conditions are very simple. Because $L,G$ are regular they have corresponding DFA's: $$ L=\bigg(\sum,Q_1, q_{01,\delta_1, F_1}\bigg)...
In the context of Upper bounds computaion and Big Oh Notation, I was wondering if the following could be proved... if they are equivalent. $\mathcal{O}((log(n))^{-1}) = (\mathcal{O}(log(n)))^{-1}$ $\mathcal{O}((log(n))^{-1})$ can be rewritten as $\mathcal{O}(1/(log(n)))$ which is $\mathcal{O}(1)/ \mathcal{O}(log(n))$ ...
I read that the mapping for user-space processes is changed after each process switch. By mapping I mean the translation from virtual addresses to "real" memory address. I thought that processes are loaded into RAM and are held there (that's what the RAM is for). So the addresses in "real" memory addresses shouldn't ch...
I have a set of nodes and a function foo(u,v) that can determine whether two nodes are equal. By "equal" I mean transitive equivalence: If 1==2 and 2==3 then 1==3 and also: If 1==2 and 1!=4 then 2!=4 When given a set of nodes I can find all connected components in the graph by passing every possible combination of nod...
I wanted to know which implementation is better to find the root of the element in the Quick Union implementation of the UnionFind problem. The professor has used a while loop to find the root of the element, while I have implemented it using a recursive approach. Which approach is better in terms of space complexity,...
I have proposed a load balancing algorithm for a group of homogeneous processing devices and now I want to measure the average waiting time to see if my algorithm is successful in decreasing the waiting time. I have considered number of tasks on each device as the load of that device. Imagine at first there are 54 task...
As I'm reading the movfuscator paper by Stephen Dolan, I encounter this claim: In order to have Turing-completeness, we must allow for nontermination. This seems like a reasonable statement. But I'm also aware of this work by Wouter Swierstra which aims to prove quite the opposite (as I see it): that one can simulate...
Prove that if $L$ is regular over $\Sigma=\{0,1,2\}$ then the following language over $\{0,1,2,\$\}$ is also regular: $$ G=\{\$x\$|\exists w\in L: x\text{ is derived from }w\text{ by substituting } 01 \text{ with }\$\$ \} $$ For example, if $10112\in L$ then $\$1\$\$12\$\in G$. I think this can be solved using cl...
I'm looking at the name of a variant of the Stable Roommates Problem, when the rooms have more than 2 mates, ie for example 6 to 8. Does this problem has a specific name? A well-known algorithm? To summarize, the problem is the following: Given a set of $n$ people, and a symetric $n\times n$ affinity matrix between eac...
I have a graph $G$ with $m$ vertices $V$ and $n$ edges $E$. $G$ is weighted, directed, and cyclic. I want to select heaviest $k$ edges from $E$ such that all of the edges form a connected, undirected graph. Note that when selecting these edges, the graph is considered to be connected even when two vertices $v_1$ and $v...
We have a function which takes an array as input. It breaks an array into $\log_2(n)$ parts with equal sizes where $n$ is the size of the subarray. It keeps breaking each of the subarrays until there are only two elements left in it. What is the depth of this recursion? Example of the process: First we have $n$ elemen...
There's a story I've heard a few times in various computer science talks, usually offered as a cautionary tale, that goes something like this: In the late 50s, the British gov't purchased an early computer, and tried to build a computer model of the gov'ts budget, including every variable and factor they could think o...
I'm looking at this pdf for problems: http://www.public.asu.edu/~ccolbou/src/355hw5solf10.pdf I found question 3g to construct a pushdown automata for the following: {$ {a^i b^j}$ | ${i \neq j}$} The solution they provided is below: The issue is, when I use JFLAP to test out, I get aabb to pass - when it should just b...
Consider the following decision problem: Input: a set $X = \{x_1, \ldots, x_n\}$, a mapping $f \colon 2^X \mapsto \mathbb{N}$ such that for $f(Y)$ is computed in polynomial time for any $Y \subseteq X$, and an integer $k \in \mathbb{N}$. Question: does $\sum_{Y \subseteq X}{f(Y)} \geq k$ hold? Is this problem in the c...
Are there conditions under which given text $T$ that huffman code and arithmetic code will produce the exact encoding of $T$?
I can calculate this by trying out manually inserting $n$ keys in $m$ order B Tree as follows: Assume median to be selected for split be left biased. That is $m/2$. For example, if $m=4$, then a node [1,2,3,4] need to be split with 2 as a median and resulting in nodes [1] and [3,4]. So, we selected 2 as a median, wh...
Let's say you want to get the value of all nodes in a binary tree (order doesn't really matter). If in each thread, you spawn two more threads to deal with the left subtree and the right subtree, then wouldn't the big O time complexity be O(log n). I was under the impression that you could never traverse an entire tree...
I am working on some set theory and am trying to prove how a set can have the property $A^* = A$. For set $A=\{0^n1^n \mid n \ge0\}$, I still do not understand exactly what $A^*$ is. For example, I thought $A^*$ is the enumeration of the set $A$ so $A^* = \{\epsilon,01,0011,000111,00001111,....\}$ Any helping in at le...
I am having trouble understanding the following statement. I have understood why in a sensorless/conformant problem, if there exists a solution (a sequence of actions) for a belief state $b$, then it is also a solution for any $b'$ that is a subset $b$. Next claim is what is confusing me. Then in a standard graph searc...
Given a list $C=[c_1,c_2,\dots,c_k]$ of positive integers, representing the values of $k$ varieties of coins, and a positive integer $n$, let $f(n,C)$ be the number of handfuls of coins with total value $n$. The order within the handful does not matter, and there is an infinite supply of each variety of coin. What is...
I was given this question and not sure how to solve this. This is a DP minimization problem ? Problem : There are N stations in a certain region, numbered 1 through N. It takes di,j minutes to travel from Station i to Station j (1 \leq i, j \leq N)$. Note that di,j=dj,i may not hold. You are now at Station 1. From here...
I've been looking over sorting algorithms for linked list and here's what I came up with. As we know, for element access arrays will work better than linked list. Also, there is the benefit of elements being stored in consecutive memory locations: due to spatial locality of cache, arrays give better performance. Thus f...
How to solve this problem? A vertex cover of a graph is a set of vertices such that each edge of the graph is incident to at least one vertex of the set. A minimum vertex cover is a vertex cover with minimal cardinality. Consider a set of all minimum vertex covers of a given bipartite graph. Your task is to divide all...
This is a recreational problem, not sure if it is asked due to my limited knowledge in discrete math. Suppose we have a connected graph (which can be seen as a "map"). We start at an initial vertex, and there is a destination vertex which we do not know, until we reach that vertex. The task is to find out the destinati...
How can I calculate the number of cache lines per set or the cache size with the given information? m (number of physical address bits): 32 C (cache size): unknown B (Block size in bytes): 32 E (number of lines per set): unknown S (number of cache sets): 32 t (tag bits): 22 s (set index bits): 5 b (block offset bits):...
I have such a product example: { "color": ["red", "blue"], "material": ["metal", "textile", "plastic"], "options": ["handle", "wire", "bt"], "textile": ["silk", "cotton"] } I need to know what algorithm can help me to produce all options possible for such product, f.e.: { "color": "red", "material": "metal...
Determine the asymptotic running time of the sorting algorithm maxSort. Algorithm maxSort(A) Input: An integer array A Output: Array A sorted in non-decreasing order 1. for j <- n-1 down to 1 do 2. m <- 0 3. for i = 1 to j do 4. if A[i] > A[m] then m <- i 5. exchange A[m], A[j] Can you say anythin...
Since i don't have a CS background in my career, Built up an openmpi compute platform which succesfully computes from a variable number of available nodes. call this whole, a mpi cluster having N^2 4-Core-CPU + 16-OpenCL-1.1-compute-cores with a reasonable compute power each node. I have no experience in parallel opti...
Let $L$ be a regular language over alphabet $\Sigma$. $L$ is the result of merging $2$ languages letter by letter that is for $a_1a_2...a_n\in L_1, b_1b_2...b_n\in L_2, L=a_1b_1a_2b_2...a_nb_n$. $\epsilon \in L \iff\epsilon \in L_1,L_2$. Does this mean that $L_1$ is necessarily regular? At first I tried to prove that...
Bachmair and Ganzinger 1991, 'Rewrite-Based Equational Theorem Proving With Selection and Simplification', specifies the criterion for using an equation as, by some appropriate ordering, u>v (after substitution, and assuming the terms can be ordered). Equivalently, !(u<=v), after substitution. However, Schulz 2006, 'Al...
int seq(int n) { if(n == 0 || n == 1) return n; return(seq(floor(n/2)) + seq(ceil(n/2)); } Find the computational complexity of the above program. I have tried doing it in the following way: $$\begin{align*} T(0) &= 1 \\ T(1) &= 1 \\ T(2) &= 2T(1) = 2 \\ T(3) &= T(1) + T(2) = 3 \\ T(4) &= 2T(2) = 4 \\ T...
Given some finite set $S := \{x_1,x_2,\ldots,x_k\} \subset \mathbb R^n$ we can define a distance matrix $D = (d(i,j))_{ij}$ with $$d(i,j) = \Vert{x_i - x_j}\Vert$$ where $\Vert \cdot \Vert$ is the euclidean norm. Is there an algorithm to determine the minimal $m$ just from $D$ such that there are $\{y_1,y_2,\ldots,y_k...
Let $L$ be a regular language over $\Sigma=\{a,b,c\}$. Build a finite automaton for $L/\{a\}$. Because $L$ is regular then a DFA exists for it: $A=(\Sigma, Q, q_0, F, \delta)$. Let $M$ be a finite automaton, $L(M)=L/\{a\}$. $M=(\Sigma, Q\times\{0,1\}, (q_0,0), \delta', F\times\{1\})$ with the transition function def...
The following comment on an other question says that if we have an infinite language L that satisfies the pumping lemma for regular languages then we have a word with n≤|w|≤2n which is in L. (n is the constant in the pumping lemma) https://cs.stackexchange.com/a/55606/99669 Why is this the case? The lower limit can be ...
Wikipedia says that in order to prove EXPTIME-hardness of our problem, we need to prove that every EXPTIME problem can be poly-time reduced to our problem. Here is a "counter-example" that bugs me. Suppose our problem can be solved in time $O(2^k)$, where $k$ is an input number to our problem instance; let it be in bin...
I'm trying to understand the approach to constructing an grammar which accepts the language ${a^ib^j \mid i>0\ and \hspace{2.5mm}i\leq j \leq(2*i)}$ } Thanks.
Prove that the following algorithm has STOP property. I am not sure if this term is widely know, so the definition of STOP property that I got during classes looks as follows: STOP property (for all input data satisfying $ \alpha $ the computation halts - the number of steps is finite) $\alpha: x \in N $ void BB(int ...
I've more than 10 million strings of length 1-100 characters. This number will be even bigger in the future. I'm interested in clustering this data, but I'm not quite sure what would be effective at this scale. These are the clustering algorithms I've been looking into: Affinity propagation:: seems like a good soluti...
John lives in a city whose streets has the same length. His apartment is located at a specified node H. John need to do his errands where he visits each of k different shop in order. However, each store have more than one location in his city. More particularly, for each 1 ≤ i ≤ k there is a set $S_{i}$ of vertices a...
Let's say we have the following rule: p -: X ≠ Y, X = Y Stating that $\forall x.y. x \neq y \land x = y \implies p$. Now let us suppose that we are searching for a proof of $p$. Such a proof does not exist, of course, but we will search for it. Our starting goal is p. We replace it with the subgoals X ≠ Y and X = Y. T...
In the CLRS chapter 3: When $x → 0$, the approximation of $e^x$ by $1+x$ is quite good: $$e^x = 1 + x + Θ(x^2).$$ How is it to be interpreted, what is the role of asymptotic notation here?
How to find minimum cardinality maximal matching? I tried that pick a edge from highest degree vertex remove other edges from same vertex and so on.
Why the single layer perceptron has a linear activation function while the Multi Layer Perceptron has a non-linear activation function ? What is the potential of the Multi Layer Perceptron respect of the Single Layer perceptron ?
When studying about splay trees, I found the following statement: Suppose we have a splay tree and a sequence of Find operations, where the elements we are searching for are in increasing order. Then the total time necessary to run the sequence is $\mathcal{O}(n)$ ($n$ is the number of nodes in the tree). I looked ar...
EDIT: The most general case I need is not a tree but any Directed Acyclic Graph. I have a directed acyclic graph. I need to sort it in a list so that in the list every node comes after any node it can walk to in the graph. So far so good, just use a topological sorting algorithm. However, I have an additional constrain...
I have numerous records, composed of words. Each word gets translated into vectors, with a variable number of channels, provided that that word exists in a specific lookup dictionary. For n number of words in every record, based upon c number of channels that each vector-based representation of the words possesses, a f...
I have the following task and its solution. Question Given the language $$ A \triangleq\left\{1^{n} 0^{n} \mid n \in \mathbb{N}\right\} \text { with } \Sigma_{A} \triangleq\{1,0\}, $$ give all equivalence classes of the Myhill-Nerode relation. Solution $[1^k]_{\equiv A} = \{1^k\}$ for $k \in \mathbb N$. $[1^\ell0]_...
Say you are parsing a complicated binary file but there is 1 extra byte inserted somewhere. This could completely mess up the entire parse, but if you just looked ahead one token you would see the whole file is in tact minus that extra byte (or bit, whatever). You could have a record in the binary file like this: heade...
Motivation Recently I was trying to optimize some API calls and reduced the problem to optimization of a cumulative number of identifiers across all the requests. I put some considerable effort into solving the problem but I'm still unsatisfied with my solution. Problem formulation You are given a list of unique sets ...
I'm given $L_\cap=\{\langle M_1\rangle\#\langle M_2\rangle\mid L(M_1)\cap L(M_2)\neq\emptyset\}$ and $L_U=\{\langle M\rangle\#w|M \text{ accepts } w\}$. How can I reduce the former to the latter: $L_\cap\leq_RL_U$? My idea was to build a machine $M$ simulating $M_1$ and $M_2$ in series. $M$ accepts a word if and only ...
I have proposed a load balancing algorithm for distributed systems which monitors the load on each device in this system and moves excess load from over-loaded device to less-loaded device. What are best metrics for evaluating the result before and after load balancing? I studied several papers and found metrics like "...
Let $L$ be recursively enumerable and $U$ be non-recursively-enumerable. Is it possible to reduce $U$ to $L$ recursively, $U\leq_R L$? Personally, I do not think this is possible. If we can reduce $U$ to $L$ by a Turing machine that always halt and we also have an Turing machine that compute $L$ (may not halt), then we...
I think that, since graph isomorphism is not known to be $\textbf{NP}$-complete, we can not reduce all problems in $\textbf{NP}$ to it, and therefore the implication does not hold. Additionally, in the accepted answer to this question it is stated, that a proof that graph isomorphism is not $\textbf{NP}$-complete would...
I want to find set cover of this problem. I have sets, each of cardinality 3. I want to find set cover. This is what I am doing. Treat each set as an edge, which is incident on each of its element. I am considering each element as a vertex. Now I will find minimum edge cover of this (hyper)graph. Is this the right way ...
Suppose we have an infinite sequence over the decimal alphabet, call it $w$. For $k\in \{0,1,2,3,4,5,6,7,8,9\}$, let $L_k = \{m\geq 0: \text{$w$ contains a run of $m$ $k$'s}\}$ be a language. Here a run denotes a contiguous block of the sequences. Prove that $L_k$ is a regular language. Here is my idea. Clearly, if $w$...
Given a set S = { $x_{1}$, $x_{2}$, . . . , $x_{n}$} where $x_{i} \in Z$ . and a K and it is $Z^{+}$ . The goal is to find k intervals $I_{1}, I_{2}, . . . , I_{k}$ so that each $x_{i}$ is in one of the intervals $I_{j}$ and so that the sum of the squared lengths of the intervals $I_{k}$ is as small as possible. For ...
Consider the following CFG. $S \rightarrow \epsilon\ |\ aSbS\ |\ bSaS$ Can we prove formally that an equivalent $LL(1)$ grammar does not exist? I feel that intuitively an equivalent $LL(1)$ grammar doesn't exist, but I'm unable to prove this formally.
Given a LTL formula $\phi$ and a transition system $T$ we have to do following steps: Build a (non deterministic) Büchi automaton for $T$ Build a (non deterministic) Büchi automaton for $\phi$ Compute the intersection of these automatons and check for emptyness Step 1 can be done in $\mathcal{O}(|T|)$ time and space....
Need idea for solving the following pushdown automata: $\mathcal{L}=\{w\in\sum ^* | \#a(w)=\#b(w),|w|\geqslant 0\} \,\,\,\, \sum=\{a,b\}$ In the beginning I thought to PUSH A for input a, and then to POP A for input b, but it doesn't work well for the word ba for example
I am still confused over my professor's explanation on why this problem is not a DFA. The Problem: Explain why $L = \{p^kq^k \mid k>0\}$ cannot be recognized by a DFA My professor explained it as that it was because the DFA could not store the $k$ iterations in memory. But I still don't get it. In my mind, you just dra...
Problem is as following: We are 8 trumpet players in an orchestra. There are for example 4 parts so there are always two players on the same part. Now, there are not always the same two players playing the same part meaning the combination of players that play the same part change from piece to piece. What is the cheap...
I am wondering what the time complexity of a for loop that increments the control variable, but also multiplies it inside the loop. For example for (int k = 0; k < n; k++) { stuff k *= 2; } I am thinking it must be something like O(log n), but I know that is not it. Any help would be appreciated.
My textbook says that the Dijkstra algorithm's runtime is $O(n) + O(m \log(n)) = O((n+m) \log(n))$. How did they come up with that? Dijkstra algorithm pseudocode: 1. Dijkstra(V, E, s): 2. Create an empty priority queue 3. for each v ≠ s: 4. d(v) ← ∞ 5. d(s) ← 0 6. for each v ∈ V: 7. ...
Given a dictionary of words and their frequencies (how many times they appear in a universe and given a string(no spaces, punctuation, etc.). What is the best way to segment into individual words? I believe a dynamic programming approach would be best. But I am not sure how to proceed about throwing away unnecessary pr...
I don't understand why when proving if Halting on all inputs problem si not in RE using the complement of the halting problem, I have to take a turing machine and simulate the machine M(the machine that the halting problem receives as input) on w(the word received as input) for n steps. Can somebody explain to me who i...
I have recently learned about artificial neural networks (very interesting) and genetic algorithms (also very interesting). I have read some suggestions concerning how to crossover two parent neural networks to produce a child. For example, randomly selecting weights and biases from either one parent or the other, or s...
So, if you have an 8-bit computer and it can perform a fetch cycle, meaning it can access its memory, how do you create words the computer understands. If LDA "load the accumulator" is in the instruction set and its just something we named for humans and the computer understands binary... How was this idea communicated...
Let G be a connected, undirected graph containing some vertex s. let's say that BFS and DFS are both run on G starting at s and that the breadth first search and depth first search trees produced are the same. Show that G is a tree. Would this be good enough? In order to show that G is a tree Let ...
I have a problem that asks me to consider the string abbbaacc. I'm supposed to figure out which of the following lexical specification produces the tokenization ab/bb/a/acc. The options are: A. a(b+c)* b+ B. ab b+ ac* C. c* b+ ab ac* D. b+ ab* ac* I just learned ab...
Given a state $s$, and a value function $v^i$ that determines the expected payoff for the i-th agent in that state, can the two definitions below, one of Nash equilibrium and another of Pareto optimality be compared to one another? Nash equilibrium: $$v^i(s, \pi^i_*, \pi^{-i}_*) \ge v^i(s, \pi^i, \pi^{-i}_*)\ \ \ \for...
We know that minimal edge cover for the normal graph is polynomial time solvable. Is it also true for hypergraph?
I came across this question in a coding interview and couldn't figure out a good solution. You are given 6 dominoes. A domino has 2 halves each with a number of spots. You are building a 3-level pyramid of dominoes. The bottom level has 3 dominoes, the middle level has 2, and the top has 1. The arrangement is such that...