instruction
stringlengths
35
29.1k
if we have a Graph (V, E) and for all nodes v_i, v_j exists a path from v_i to v_j can you give me an example of such graph with dominating set size 2 and doesn't have a vertex cover of size 3?
Given $k$, a $k$-domino is a non-ordered pair of integer values of $[\![0, k-1]\!]$, for example $\langle 0, 3\rangle$ or $\langle 1, 1\rangle$ are dominoes, the domino $\langle 3, 0\rangle$ being the same as $\langle 0, 3\rangle$. A sequence of length $n$ of dominoes is a sequence $(d_0, d_1, …, d_{n-1})$ where $d_i =...
Specifically, how many bitwise operations (approximately, could be just order of magnitude) occur each time a Bitcoin ASIC miner performs a SHA-256 hash in typical mining computation, i.e. as it guesses the nonce and computes the hash of the 1 MB block to be added to the blockchain? By bitwise operation, I mean the mos...
I want to generate a grammar that can't generate the words $qw$ and $wq$ but can generate the word $qwwq$. In other words, $L(G)=\{m ∈ \{q,w\}^* \mid m \neq wq,qw \}$. My grammar: \begin{align} &S \to qSw \mid wSq \mid qXq \mid wXw\\ &S \to qYw \mid wYq \mid q \mid w\\ &X \to qX \mid wX \mid qXw \mid wXq \mid ε \\ &Y ...
The Heesch number of a shape is the maximum number of layers of copies of the same shape that can surround it. For example the following shape (in the center) has a Heesch number of 4, because we can get at most 4 layers to surround it: Given a shape, is there an efficient algorithm to compute its Heesch number? The o...
I want to make a regular expression for the language consisting of words whose length is at least 3 and which contain at most two $x$'s, that is, $$\{w\in \{x,y\}^* \mid |w|\geq3\text{ and the number of }x\text{'s in }w \text{ is at most } 2\}$$ I wrote: $$ x^+(x+y)^+y^+ $$
If we have length $n$ unsorted array such that each element is integer and different, how to find $i$ largest numbers in linear time O(n)? but $i \leq n^{\frac{1}{2}}$. For example, if we have $A = [11, 6, 8, 1, 9, 100, 88]$ and input $i = 2$, then output is $[100, 88]$ (sorted).
Given $A=\left\{n\in \mathbb{N} \mid \text{$n$ is odd}\right\}$, we want to prove that if $S \in P$ then there is a Karp reduction from $S$ to $A$. My attempt: If $S \in P$ we can solve $S$ with a reduction that converts in polynomial time an input from $S$ to $A$, but I don't know how to prove formally the function a...
I was going through the playlist of an online course on Social Network Analysis offered by the Indian Institute of Technology (Madras), when I came across the claim that "when a lot of people get together and start discussing and debating conflicting ideas, true knowledge is known to emerge"-- and thus implying that Wi...
So I'm a newbie to c++. I know the basic concepts of c++ as I have already learnt c language. For competitive programming DSA is very important. But I don't know any STL functions. Is it possible to learn DSA without knowing STL? Which one is advisory to learn first(STL or DSA) so that it will be easy further? Also sug...
You have a few variables that can only assume the values 0 or 1 and you use those to form two polynomials. Is there a way to multiply the two polynomials that is faster than O(n²) where n is the number of terms in the polynomial? What I could come up with: As the variables are binary, they all follow the equation X²=X...
I have two similar questions, one about the H-trivial monoids and one about the R-trivial monoids. I cannot see the reason why H-trivial monoids, i.e., the monoids where H induced classes are singletons, coincide with the variety A of aperiodic monoids, also characterized as the monoids that satisfy the monoid equatio...
True random number generators use an unpredictable physical means to generate numbers, whereas pseudo-random numbers utilize mathematical formulas to produce a certain sequence of numbers that will appear random. I know that for PRNGs the efficiency is very high because they tend to generate a large quantity of random ...
We are learning how to solve recurrence relations in different ways (Forward Substitution, Backward Substitution, Master Theorem, etc...). I really thought I understood the topic since most of the problems were in the form of $aT(\frac{n}{b}) + f(n)$ where applying the Master Theorem is no sweat, but we're given this r...
I was going through the text Compilers: Principles,Techniques and Tools by Ullman et. al. where I came across the claim in the question by authors. Below is the definition and following it is the claim by the authors. Form of a Syntax-Directed Definition In a syntax-directed definition, each grammar production $A\rig...
I was going through the text Compilers: Principles, Techniques and Tools by Ullman et. al where I came across the following claim: L-attributed definitions include all syntax-directed definitions based on LL(1) grammars. What is the intuition or logic behind this statement? In the later sections they show that L attr...
Below is an excerpt from the Red Dragon book. $$(1) \quad S \rightarrow A_1 \quad A_2 \quad\{ A_1.in : = 1;\quad A_2.in : = 2 ;\}$$ $$(2) \quad A \rightarrow a \quad \{ print(A.in) \}$$ We find that the inherited attribute $A.in$ in the second production is not defined when an attempt is made to print its value durin...
Is it true that adding two numbers in base 2 is more complex than multiplying them? If so can someone please explain why this is the case?
I am trying to solve the Budgeted Maximum Coverage Problem. I have read and implemented the greedy and modified-greedy methods to solve it, as proposed by Khuller. Both are approximation algorithms. The greedy provides a $1/2(1-1/e)$ approximation, and the modified greedy guarantees $1-1/e$. I am trying to get better r...
New to the board, if this is the wrong section I apologize and I will delete it. Will be helpful to be provided correct exchange to guide me through this process of learning. If you have a given an array such as A[1...n] of numeric values (can be positive, zero, and negative) how may you determine the subarray A[i...j]...
This demonstrates the limitations of considering expected running time of an algorithm as a useful measure. For any $n>0$, describe a function $f:\{0,1\}^n \to \mathbb{N}$ such that $\mathbb{E}[f] = \mathbb{E}_{x\in \{0,1\}^n}[f(x)] = n^c$ for some constant $c$ and ${\sf var}[f] = E[f^2] - (E[f])^2 = \Omega(2^n)$. ...
There are two parties A and B going on. Some people are going to party A, some are going to party B. We are given instructions of the form different 1 3, meaning that person 1 and person 3 are attending different parties same 3 4, different 4 5, and then given a command tell 1 4 we have to answer if they are at...
We have been taught that: Insertion-sort will best work if we have a small list. Quick-sort will best work if we have a long list. Merge-sort will best work if we have a huge list. It is not intuitively understandable. However, let us say if we have a list with 20 elements and want to sort it because shifting action ...
Every RL paper has a section with some finite sample analysis/error bound/ convergence proofs. I have difficulty fully understanding such proofs and coming up with my own analysis for my personal projects. Can anyone suggest books/courses where I can develop my skills to do such work?
I was playing around with graph theory and I noticed that a directed integer graph with unique vertices $V$ and edges $E$ such that each vertex only points to vertices with a higher value can be used to enumerate all $n \choose 2$ ways to choose $2$ values from a total of $\left|V\right|$ possible values. For example: ...
Turing's Checking a large routine: Finally the checker has to verify that the process comes to an end. Here again he should be assisted by the programmer giving a further definite assertion to be verified. This may take the form of a quantity which is asserted to decrease continually and vanish when the machine stops....
I have a problem that is similar to the conventional interval scheduling algorithm but it is two dimensional, so I have another metric to take into account. My dataset format: Cars with the start and end time of parking, along with their length in meters. Total street length in meters. Number of cars. Opening hours of ...
LOOP = {<M,w1,w2,w3>: M is a Turing machine that doesn't halt on at least 2 of the wi} HPC = {<M,w> : M is a Turing machine that doesn't halt on w} Show that LOOP is polynomial time Turing reducible to HPC I am not sure how to begin solving this kind of problem. Also the question I am trying to solve brings up the def...
I am reading section 9.3.3 Dealing with local optima in Algorithms by Dasgupta et al. and the authors mention that in randomized restarts, it is four times likely to end up with a bad solution. They, then in the next sentence, imply that this a good thing as there will be fewer repetitions needed. Here's the text for ...
Can a finite automata not have a start state? I think it is possible for a finite automata to not have a start state. However, I'm not sure if I'm correct.
Show that a Turingmachine with tapes that are infinite in both directions semi-decides the same languages as a classical TM. Apart from the entry-word, the tapes are filled with empty spaces and the head's on the first letter of the entry-word Under "classical" TM we understand a TM that has a tape that starts at the...
Currently, I am writing code in Python for a paper that I'm reading and has been implemented in R already by the author. For this paper we have a corpus with $n$ documents and $m$ words. In one of the steps, I have to calculate the probability of document $j$ as follows: Step 4 We use document-term matrices with the G...
I'm not sure why the algorithm computes $c_k$ with $\sum_{j \neq k} w_j x_{i, j}$. Why does one need to ignore the $k^{th}$ feature here? I'm not sure how this is derived. Is this the result of taking the gradient with respect to the $k^{th}$ feature? Also what exactly is $a_k$ and $c_k$?
I have a problem that I am working on an algorithm for: I have $k$ sets of distinct positive integers (each set is distinct, not necessarily across sets) $S=\{A_1,A_2,A_3,...,A_k\}$ where $\forall A_i\in S,\ A_i=\{a_{i1},a_{i2},a_{i3},...,a_{in_i}\},\ a_{ik}\in \mathbb{Z}^+, a_{ip}=a_{iq}\iff\ p=q$ (so $n_i$ would be ...
Can we express the matching capabilities of Unix library function glob() using a single-stack push-down automata, i.e. set of context free formal languages? If not, which is the minimal automata that we need? For those that do not know what glob() does, it is a pattern matcher generator using a few operators: * matche...
I'm trying to build a NFA for the following language $ L = \{ \sigma_1 \sigma_2 \sigma _3 \ldots \sigma _n \mid \sigma _1 \neq \sigma _n \}$. The catch is that for $ \Sigma $ such that $ |\Sigma|=2^k $, the NFA should have $\Theta(k)$ states. I was thinking of representing the letters in binary but I'm not sure what I ...
I am working on chapter 13 of CLRS. I am studying how to fix the colors on a red-black tree after deleting a black node. Suppose we want to delete the node 2. This is a black node. He will be replaced by his rith child in the RB-DELETE algorithm. Because we removed a black node and the node replacing it is black (all ...
I've recently stumbled upon a problem that I struggle realy hard with ever since. There are two large decimal integers, order of magnitude $10^6$. The task is to find how many bits in the binary representation of $A*B$ are set (how many 1s are there in the binary representation). Now, for small numbers, that's trivial....
I need to prove that determining whether a graph has a relaxed-Hamiltonian cycle (definition given ahead) is NP-hard. A relaxed-Hamiltonian cycle in $G$ is a closed walk $C$ that visits every vertex of $G$ exactly once, except for at most one vertex that $C$ visits more than once (i.e. that vertex may repeated twice ...
Definition: AtmostONESAT: SAT instance having promise of $\leq1$ witness. What is the complexity consequence if an instance of $SAT\in$ AtmostONESAT can be decided whether or not there is a witness in $P$? I believe the problem is similar to UnambiguousSAT (wiki says we get NP=RP if USAT is in P https://en.wikipedia.or...
What is the regular grammar of the language: $$L=\left\{a^nb^nc^md^m\left|n,m\ge 1\right|\right\}\:above\:\Sigma =\left\{a,\:b,\:c,\:d\right\}$$ My attempt: $$S\rightarrow aAbcBd|aXd$$ $$A\rightarrow aAb|\epsilon$$ $$B \rightarrow cBd|\epsilon$$ But I'm not sure if I'm right until here. Is it good? Edit: This language ...
Below is Question 8.1 in Algorithms by Dasgupta et al. There's a solution to this problem that uses binary search from here. Pasting the answer for posterity. My questions are: When they say input size, are they just referring to edges or both edges and vertices? Is it correct to say that we make at most $log( |E| l...
I would like to find the first positive solution(if there is one) to this equation: $$\frac{ax^2+bx+c}{dx^2+ex+f} = gx+h$$ The simplest way I fond would be to do the following: $$ax^2+bx+c = (dx^2+ex+f) * (gx+h)$$ $$(=)$$ $$ax^2+bx+c - (dx^2+ex+f) * (gx+h) = 0$$ $$(=)$$ $$Ax^3+Bx^2+Cx+D = 0$$ and find the roots of the ...
Let a relation $R$ be A-polynomial if there is a polynomial $p$ and a polytime algorithm $A$ such that for each $x$: If $(x,y) \in R$ then there is a witness $w$ of length at most $p(|x|)$ such that $A(x,w) = y$. For each $w$ such that $A(x,w)$ halts, we have $(x,A(x,w)) \in R$. Prove or disprove: Each $R$ in FP is ...
According to this we can do so by replacing every edge in the undirected graph with two edges backwards and forwards with the same capacity. But I'm having a hard time seeing how this prevents something like $f((u,v))=c$ and $f((v,u))=c$ (where c is the capacity in the original undirected edge) but then that means the ...
My understanding is that an NFA compiled using Thompson's Construction should have a running time that is linear in the length of the input string, with a space complexity that is linear with the length of the regex pattern. Consider this pathological example: $a^*a^*ab$, which should match at least one $a$ followed by...
Is there a standard name for an algorithm to handle this type of tree merge? Each node of the tree has a label. Nodes from the 2 trees should be combined if they have the same label, and their values should be totaled. Example: tree1 and tree2 are merged to produce "output" const tree1 = [ { label: 'Parent A', ...
I had this question in Learning theory, but it's really just a question in probability theory to be honest, so I'm gonna try to rephrase it in a way that really emphasizes what I was trying to do to solve it: Let $\mathcal X_N=\{0,1\}^N$, $\mathcal Y=\{0,1\}$ and define a uniform distribution, $\mathcal D_N$, on $\mat...
Self-driving car technology continues to attract popular attention and interest in today's media, but how would a computer scientist explain the theoretical nature of the problem? For example, we are frequently told that Sudoku and Go are examples of NP-completeness and PSPACE-completeness, and a range of practical pro...
I am wondering what do JAMZ, JAMN, and JMPC stand for in Tanenbaum's Mic-1 architecture. I know that MPC, the control store’s memory address register, stands for "MicroProgram Counter", but what does J mean? Likewise, there are 1-bit flip-flops where the values of N and Z are latched. The book says that if JAMN is set,...
Consider an operator $+$ defined on $P(\mathbb{N})$ as follows $$A + B = \{2x:\ x\in A\}\cup\{2x + 1:\ x\in B\}$$ Show that $A$ is $m$-reducible to $A+B$ and $B$ is $m$-reducible to $A+B$ As per the definition of reducibility $B$ is reducible to $A$ if there exists a total computable function $f$ such that for all $x\i...
I have a matrix over integer of size (50,50). I want to know whether it is possible to exchange rows and columns in such a way so that the transformed matrix is a lower triangular whose diagonal entries are non zero. Is there any algorithm which can determine this efficiently?
Consider an operator $+$ defined on $P(N)$ as follows: $A + B = \{2x\mid x \in A\}\cup \{2x + 1\mid x \in B\}$. Show that both $A$ and $B$ are Turing-reducible to $A+B$ I am kind of confused about this notion of turing reducibility thing. Does it mean that There is a turing machine which converts an input from $A$ to a...
I am a theoretical physicist, and new to CS.stackexchange, and have a little knowledge of CS, and in Machine Learning (only some general stuff). In physics we often analyze the spectrum of linear bound operators on finite dimensions, or simply try to understand the eigenspace of some matrix $M: v_j, \lambda_j$, where $...
I have a basic linear regression model that predicts the spread and total points of NCAA college basketball games. My inputs include various efficiency metrics about each team playing each other. A snippet of the data I am working with looks like: Team_1 Team_2 Off_Eff_T1 Def_Eff_T1 Pace_T1 Off_Eff_T2 Def_Eff_T2 Pace_...
Background I need such an algorithm inside an android app (home launcher) to show the recently used apps. I want to avoid simple LRU / MRU logic by combining those logics (or use an alternative if anyone has a suggestion). I don't want an app that was started 100x before 10 weeks to stay on top until another app was st...
I was refreshing some old tests about sorting algorithms, there was a question as follow: Question: we have n weight disks with different weights and we want to sort them pair by pair, How many times we have to weight in worst case (maximum comparisons) to sort the whole disks? the answer was $ \lceil \log n! \rceil...
Let $f$ be an $o(2^{-\sqrt n})$ function, and let $g$ be an $o(2^{-\frac{n}{2}})$ function. Is the function $ f + g - fg$ is an $o(2^{-\sqrt n})$ function? Can you help me prove that? I think the answer is correct, but when for example, I consider the expression $\frac{2^{-\sqrt n} + 2^{-\frac{n}{2}} - 2^{-\sqrt n - \f...
I have been looking at the Suurballe node-disjoint algorithm, which is illustrated here: http://www.macfreek.nl/memory/Disjoint_Path_Finding What I am a bit unsure about here is "Step 4". So before that each node in the first shortest path is duplicated/divided into an in and out version of itself. And after that a new...
I think since the input word is delimited by special symbols, which the machine cannot move past, the language accepted by such a device should be finite. Are all finite languages are regular, and are regular languages decidable by a TM?
I've built a topic model, with: Input: list of tokenized lists Output: a m x t matrix (with each cell indicating the probability of word i appearing in topic k). Output: a k x n matrix (with each cell indicating the probability of topic k in document j). To find the optimal number of topics, I want to calculate the c...
I've come across this question and I think I'm on the right track with the idea I just don't really know how to formalize it properly or understand why everything said in the question is required for the proof. The question is as follows: Let $\mathcal X$ be a finite example domain and let $\mathcal Y = \{0, 1\}$. Let...
Given a $m\times n$ matrix and a starting position $(i,j)$, how can we find the shortest path to go through all the elements at least once if we can only move by a single unit (i.e. up, right, left or down) at a time? Currently all I could think of was moving to the nearest corner and then traversing from there, but th...
I got these for four of them, but I can't get the transition function. Q = {q1, q2, q3, q4} Σ = {a,b} q1 is the start state, and F = {q4}
How can I solve this recursive function using substitution method? $$T(n) = 2T(n/3) + T (2n/3) + n^3$$ I substitute $T(n/3)$ and after that $T(n/9)$. when it goes to k-step, I'm stuck.
So, i faced this question during a pratice quiz i have no idea why " all of the elements are located contiguously in memory " wrong!! My logic is that priority queues are made of binary heaps and binary heaps are made of arrays ( according to introduction to algorithms by CLRS ) , so this means that elements are locat...
Is it possible to have a finite automaton where $\Sigma = \mathbb{N}$? Why or why not? I think it is possible to have a set of all natural numbers, however I'm not sure why.
I have the following problem: In a school, there are n students and m clubs, with n > m. Each student needs to be assigned a club. The students have preferences, (say top 3 or top 5) of the clubs they wish to be matched to. So far, it's basically just a maximum weight matching in a weighted bipartite graph, which can b...
What is the space complexity of quicksort? I was doing some research and found some saying it is $O(1)$, some saying it's $O(\log n)$, and some saying $O(n)$. Not sure what to believe, even though $O(\log n)$ seems to make the most sense for me. Does it all depend on the pivot point that is chosen?
I have been working to understand the pumping lemma better, but I am quite stuck at proving these two languages is not regular: \begin{align} L_1 &= \{(ab)^n c^m \mid n\ge 1, m\ge 2n \} \\ L_2 &= \{(ab)^n a^k (ba)^n \mid k<3\} \end{align} For $L_2$ my approach was: Let us be given a number $p$. Let $z = (ab)^p a^k (...
So I am a computer science student and I was recently looking at the subject of comparing DNA sequences. Probably the most widely used algorithm is the Needleman-Wunsch algoirithm and while it might be suitable for most cases, It bothers me that an $O(n^2)$ algorithm is used to compare large batches of text, both from ...
An ancestry matrix $M$ for rooted tree $T$ is defined as $M[ij] = 1$ iff node $i$ is an ancestor of node $j$. Suppose we are given a matrix $X$. We can easily check that if $X$ is compatible with some rooted tree (and create the tree) or not. The question is if $X$ is not an ancestry matrix, how hard is the problem of ...
If a programming language only supports global variables, is it still possible to use asynchronicity, like callbacks, event-driven programming, other kinds of parallelisation? How can it be done?
Given matrix $A \in \{0,1\}^{n \times m}$ with $n$ rows and $m = 2^n - 1$ columns. Where $j$-th column is binary decomposition of $j$ ($j = 1 \dots 2^n - 1$). For example, if $n = 3$: $ A = \begin{pmatrix} 0 & 0 & 0 & 1 & 1 & 1 & 1 \\ 0 & 1 & 1 &0 & 0& 1 & 1 \\ 1 & 0 & 1 & 0 & 1 & 0 & 1 \end{pmatrix}$ This matrix calc...
This is something like assignment problem, we have 2 group of people, first contains $n$ person and second contains $m$ person. we have a matrix $C$ which is an $n \times m$ matrix and our goal is to find an assignment matrix $A$ which is again an $n \times m$ binary matrix (contains ones and zeros) and if $A_{ij}$ is ...
I am learning automata theory, and I am confused about this exercise: Give context free grammar to create the following language where the input alphabet is $\{a,b\}$ $L = \{w \text{ where }w\text{ is NOT of the form }b^n a^n\}$ So, I understand how to create $\{b^n a^n, n\in\mathbb{N}\}$: $$S \to bSa \mid \epsilon...
A Markov chain with transition matrix $P$ is termed regular if for some $n$, all entries of $P^n$ are positive. Is there a known notion of degree of regularity quantified in terms of how soon all entries are positive? That is, a Markov chain with transition matrix $P$ would be considered more regular than a Markov chai...
Given a regular language $L$ defined over $\Sigma = \{0, 1\}$. We define a new language $$Perm(L) = \{w \mid \exists x \in L, w \in perm(x)\}, $$ where $perm(x)$ is the set of all permutations of the word $x$. We have to show that $Perm(L)$ is context-free. I have looked at the properties that neither CFL nor Regular l...
1 2 3 4 5 |---|---|---|-----|---|---| | | > | v | | | 5 | | > | ^ | > | [>] | z | 4 | | ^ | | | ^ | | 3 | | ^ | > | > | ^ | | 2 | | a | ^ | | | | 1 | |---|---|---|-----|---|---| Let say we have a GRID like the one above. I want to create score for paths, where every next step has ...
I noticed that some "design-the-grammar" problems say verbally Alphabet is $\mathbf{\{0,1\}}$. $\{w \mid w \text{ contains at least three 1s}\}$ and some problems list it as $\{ w ∈ \mathbf{\{0,1\}}^* \mid w \text{ contains at least three 1s} \}$ So, my question is: Is the in-line notation with the asterisk star '*...
I am studying Automata theory. DFAs and NFAs seem pretty straightforward to me, but I don't quite understand how to design push-down automata for context-free languages. If I have context-free language where the input alphabet is $\{a,b\}$ $L = \{w \text{ where }w\text{ is NOT of the form }b^n a^n\}$ How would I desig...
Suppose there is a path (linear) graph $G = (V, E)$ where $V = \{0, \ldots, n - 1\}$ and $E=\{(0, 1), (1, 2), \ldots, (n - 2, n - 1)\}$, with edge weights $w_e : E \to \mathbb{N}$ and vertex weights $w_v : V \to \mathbb{N}$. Let $\lambda$ be a known constant. We need to find an exact cover $C \subseteq \mathbb{P}(V)$ ...
There are four variables: $x_1, x_2, x_3, x_4$. If you choose either $x_3$ or $x_4$ or both — then you should choose exactly one of $x_1$ or $x_2$. If you choose neither $x_3$ or $x_4$ — then there is no restriction in choosing $x_1$ or $x_2$. I have come up with the following if else logic for this, but cannot proceed...
We wish to find the maximum independent set in a bipartite graph. My intuition led me to the following algorithm. (Assume that the bipartite graph is connected and has at least 3 vertices, if not run the algorithm on each component) Given $G=(L,R,E)$ Let $S$ be the set of vertices with degree $1$. Note that since grap...
Let $T_1(n)$ be the time complexity of computing the square of an $n$-bit integer, and let $T_2(n)$ be the time complexity of computing the product of two $n$-bit integers. Assuming that addition is asymptotically faster than multiplication, which of the following is correct? $T_1(n) = \Theta(T_2(n))$. $T_1(n) = o(T_2...
I recently read this paper Mahoney, 1999. And encountered this line, optimal compression of a probabilistic language L with unknown distribution (such as English) using an estimated distribution M (an encoding of length −log2 M(x) bits for each string x) is M = L, by the discrete channel capacity theorem. Can you ple...
Say you have some virtual machine with < 100 numbered opcodes that fully specify its behaviour. Is there an easy way to order and enumerate all possible programs of less than n instructions, the result being that a particular number refers to a particular program? Preferably with natural numbers and short programs at t...
So I understand the logic behind converting positive decimal numbers to IEEE 32 bit floating numbers but I'm not completely sure behind the negative one's. If for example we have a decimal number say -15.5, do we have to do two's complement first then convert it to the floating point representation or we directly do it...
I've recently come across a few articles that talk about a "Generalized Transition Graph" (GTG), but I've never heard of such a thing before. This other answer to a similar question leads me to believe that GNFAs are simply GTGs with a different name where GNFA is the more standard nomenclature/name. There is a Wikiped...
Problem: Assume that $k \geq 1$ and $\epsilon \geq 0$, is $\ln^k(n) \in$ $\Omega( n^\epsilon)$? Answer: In the special case of $\epsilon = 0$, I claim the answer is no. I suspect the person who wrote this problem meant to write: assuming $\epsilon > 0$. I claim that if we differentiate $\log^k(n)$, k times then we get ...
My theory take a file examplesize:(3GB) convert said file to a number divide that number by a large prime number example:(2^82,589,932 · (2^82,589,933-1))[2018 Dec 07] get the quotient and the remainder if the remainder is still large do the math again to get another quotient and remainder until the remainder size...
Problem: Is $\log(n!) \in$ $\Omega( n^n )$? Answer: Since $n! > n^n$ for all $n > 1$ we can conclude that: $\log(n!) \in$ $O( n^n )$. Let us look at the special case where $n = 4$. \begin{align*} n! &= 4(3)(2) = 24 \\ n^n &= 4^4 = 256 \end{align*} Let us look at the special case where $n = 5$. \begin{align*} n! &= 5(4)...
I have the following question and given answer: Question: List the names of managers who have at least one dependant. Answer: {e.Fname, e.Lname | EMPLOYEE(e) AND (∃d)(∃t)(DEPARTMENT(d) AND DEPENDANT(t) AND e.Ssn = d.Mgrssn AND t.Essn = e.Ssn) } My answer was exactly the same except that instead of the (∃d)(∃t)(...) s...
I am trying to design a parallel scheduling algorithm based on a constraint graph $G=(V,E)$ in which each node represents a task and each edge $e=(v_1, v_2)$ signifies, that tasks $v_1$ and $v_2$ can not be executed in parallel. Each task is executed exactly once, so the problem is finding "good" independent sets $V_i$...
Problem: Give tight asymptotic bounds $( \Theta )$ for the following function: $$ T(n) = T(n-2) + n $$ Answer: We are not given the base case. I am going to assume that $T(0) = 0$ and $T(1) = 1$. Here are some values for the function. $$T(2) = T(0) + 2 = 2$$ $$T(3) = T(1) + 3 = 4 $$ $$T(4) = T(2) + 4 = 6 $$ $$T(5) = T...
Consider the following language, where the alphabet is $\{0, 1, 2\}$: $B = \{0^a1^b2^c|a, b, c \geq 0 \text{ and }c = ab + 1\}$. Is this language a context free language? Prove your answer. I am having trouble using the pumping lemma of context free languages to show if this language is context free? Can anyone give me...
If we partition the nodes of a graph into sets A and B, there is an edge e of weight larger than any other edge crossing the cut between A and B, e would never be in the minimum spanning tree?
Hi I'm trying to show $C=\{wzzw^R|w,z\in\{0,1\}^+\}$ is not a context-free language.( I have this believe because $C=\{ww|w\in\{0,1\}^+\}$ is not a context free language.) I'm really struggling to come up with a string that captures the essence of irregularity of this language: I tried strings like $s=1^p0^p1^p0^p1^p1^...
Is $L_1 = \{0^n1^m0^{n+m}\mid m,n \geq 0\}$ regular? What is its context free grammar and proof? Second, is the following language context-free? $$L_2=\{0^a1^b2^c \mid a,b,c \geq 0 \text{ and } c = ab+1 \}$$ I am trying to prove this via the pumping lemma but am stuck. For CFG however, I have no idea. For the context-f...
Consider a trail as a sequence of land heights representing the elevation along the trail. A pit is any position in the trail surrounded by higher terrain on both sides. For example, in the sequence [1000, 600, 1700, 900, 900, 1400, 600], positions 1, 3 and 4 are all pits (elevations 600, 900 and 900 respectively). We ...