instruction
stringlengths
35
29.1k
I'm reading here that linked allocation uses a linked list, where each block has a pointer to the next block. For sequential access, this would take moving through the blocks one by one. Would it not better to use a doubly linked list so that this time could be cut in half? Algorithmic analysis I understand that sequen...
The first one seems like a DFA. Could someone explain why this is a NFA?
I'm trying to construct a regular expression for the language of binary strings in which every 00 must have at least two 1s before it. I realize this can be done with lookbehinds using the following regex: ^(?:(?<=11)00(?!0)|(?<=1)0|1+)+$ , however I am now trying to construct a regular expression in the sense of forma...
I am wondering is anyone has something like a cheatsheet with all the operations between $O(n)$, $\Theta(n)$, $\Omega(n)$, $o(n)$, $\omega(n)$. For example, this is something I don't know how to solve: $$\frac{\Theta(n)}{o(n)} =?$$ There are not many combinations and I was wondering if anyone could help me.
I just wonder if solving largely monotone SAT formulas (meaning most clauses do not contain negated literals, but some do) is in any way easier than general SAT formulas? In other words, are there heuristics specially designed for solving such formulas that are not applicable to more general SAT problems? I tried but d...
Problem statement Given a set of $N$ linear inequalities of the form $a_1x_1 + a_2x_2 + ... + a_Mx_M \geq RHS$, where $a_i$ and $RHS$ are integers. The inequality $A$ dominates or subsumes inequality $B$ if all its coefficients are less or equal and $RHS_A \geq RHS_B$. Most inequalities are sparse, i.e. most coefficien...
I am new to DFA and I am trying to understand the following question. The alphabet is Σ = {0, 1} Construct DFA for L = {0^n: n is either a multiple of 3 or a multiple of 5 } Question The above language does not say anything about the 1s. When we write strings in this Language, we get L = {є, 000, 00000, 000000, 0000000...
Left recursive ambiguous expression Grammar: $E \rightarrow E+E \mid E*E \mid (E) \mid \mathbf i\mathbf d$ I tried computing FIRST and FOLLOW sets of both left recursive grammar and after eliminating left recursion. In both the cases, I was able to compute FIRST sets successfully, but not FOLLOW sets. I have shown th...
Substitution in untyped Lambda calculus is complicated by variable capture. Can this boring technical complication be entirely avoided by some restriction on the standard formation rules? Something that prevents the dangerous symbol duplication. If so, how? Otherwise why not? Alternatively, can the complication be avoi...
I have to construct an FA for the following language: $$ \{ w_1,w_2 \in \{a,b\}^* \mid w_1 = 0^{2n}, w_2 = (100)^m, \text{ for some } n,m \in \mathbb{N} \}. $$ Does anyone here have any experience with something like that? I'm totally lost how I should draw an FA for something like that. Would appreciate any kind of in...
N houses are located on a straight street which has K streetlights. Each streetlight has range R. Given N and K how to find minimum value for R? N is an array containing location of each house. K is an integer value. I am unable to identify the algo for this. I tried solving by taking location of 1st and last house, th...
Computers are an exceptionally powerful tool for various computations, but they don't excel at storing decimal numbers. However, people have managed to overcome these issues: not storing the number in a decimal format, which is limited to very few decimal places, but as an integer instead, while keeping track of the nu...
Consider the following algorithm: (the print operation prints a single asterisk; the operation x = 2x doubles the value of the variable x). for k = 1 to n: x = k while (x < n): print ’*’ x = 2x Let f (n) be the time complexity of this algorithm (or equivalently the number of times * is printed). Prov...
Cheers, so my textbook explains these parts very poorly, so I would gladly take any advice! I am confused between the test-and-set instructions, which per my book is a very common CPU instruction set, and the use of semaphores for which my book says that: a flag implemented using this way, is a semaphore. Does that mea...
Let's say I want to evaluate a two-argument function using all possible combinations of elements from sets A and B as arguments. For example, if the function is addition, we get this grid: A 1 2 3 1 2 3 4 B 2 3 4 5 3 4 5 6 Let's also say that retrieving an element from a set is has a fixed cost, b...
I have a theory that all finite state machines can be monitored by a second turing machine with infinite tape to determine if the state of the first machine was repeated thus reaching the conclusion that the finite state machine must be looping. I'm fairly confident that this is not a new idea but I could not find anyt...
A strong composition operator seems to be very fundamental. (Hindley and Seldin use the notation S for "strong" composition combinator). It abstracts the pattern $f(x, g(x))$, i.e. a direct and a $g$-mediated effect of $x$. It's probably my inexperience but, why is this "strong"? Is it because normal (weak?) compositio...
According to this picture ROM is classified under Main Memory , but isn’t ROM a secondary storage because it’s external and non volatile ? Any clarification with reference links will be highly appreciated. Thank you.
I'm trying to find a grammar for $L = \{w \text{ | }w \in \{a,b\}^*, |w|_a=|w|_b-1\}$, which is proving to be tricky. I know that $L_2 = \{w \text{ | }w \in \{a,b\}^*, |w|_a=|w|_b\}$ has the following one, so I have been trying to modify it so that I "force" to have one more $b$, but I don't see how to do this. The obv...
On a distributed system, there are more than 50 machines than continuously read from a database which tasks they have to process. There is no criteria based on which a certain machine chooses which task to process, leading to problems like unbalanced-task machines and low-quality completed tasks (the quality of a proce...
I have included an example in my question. I know this state is unsafe as there are no full sequences in the process. However, is there a way to arrive at a safe state from it at all?
I have tried to find a definition of complementary language to $SAT$, I mean $\overline{SAT}$. But I still confused, in case of $L\in \overline{SAT}$ is it mean: if $\varphi\in L$ then all interpretations are satisfy and if $\varphi\notin L$ then exists interpretation that unsatisfy OR vice versa if $\varphi\notin L$ t...
I am given a set of d-dimensional points, and need to find the set of entrance points in them. Definitions: A point p1 captures p2 if 1) All dimensions of p1 is smaller or equal to p2; and 2) At least one dimension of p1 is strictly less than its corresponding dimension of p2. (e.g. p1 = <1.0, 2.0, 3.0>, p2 = <1.0, 3....
Let's consider 128-bit pseudorandom generator. From Harris 1960, if we model uniform random permutation, we know that every period length $l$ has equal probability $1/n$ (Eq. 5.2) for any particular starting point, where $n = 2^{128}$ is the size of the domain, so the expected cycle length is $\sum_{i=1}^n i/n = (n + 1...
I can see a counterexample such as this: But I can also see in some cases it could be the same. I am trying to understand what property makes a MBST also a MST?
So I followed this tutorial to get the concept of "Earliest deadline first scheduling". I have to implement this task >>> TASK. Now the thing which I am not getting in this Task is that what does "Start of next period" means in the deadline column. Still, I have implemented it >>> Here. I placed the deadlines with a RE...
If this is my adjacency matrix for the hamiltonian cycle: $$\begin{pmatrix}0&1&0&1\\ 1&0&1&0\\ 0&1&0&1\\ 1&0&1&0\end{pmatrix}$$ Then a reduction algorithm to reduce this to a TSP problem is to introduce 1 anywhere an edge is missing and let pre-existing edges have a cost of zero (according to this), applying this yield...
The Xpath 3.1 presented by W3C includes the full grammar of the language with both abbreviated and unabbreviated syntax. I am interested in references (if any) for any formal work done to compile/translate an XPath query in its abbreviated form to its equivalent in fully expanded unabbreviated form. Even work done on v...
I once asked why does computer data bits are usually organized on binary (base 2) sets, rather than on unary (base 1) sets, aiming to also understand why its not also ternary (base 3), heptary (base 7), ennary (base 9) or even decimal (base 10). One programmer commented that Turing machines are always binary because th...
I am writing a publication about websites privacy. Quite a standard for such works [e.g., 1, 2] is to summarize categories of websites in the study, to either prove that the study is not biased, or the opposite that some privacy violations are skewed towards some categories. I found that categories are usually IAB cate...
I have recently started studying Randomized algorithms on my own. I am refering to Rajiv motwani - randomized algorithms book. Objective - find kth smallest element using radomized select in $O(n^\frac{3}{4} \log n)$ time My attempt: From array of n elements, pick randomly $n^\frac{3}{4}$ elements. Now from k th smal...
Currently I am studying CTL model checking. I found this exercise: Consider the CTL formula $EG^2(\alpha)$ which means that there exists a path that satisfies $\alpha$ at every even position. Define $Sat(EG^2(\alpha))$ as a fixpoint of an operator and describe how to extend the CTL model checking algorithm for formulas...
Say we let $R$ denote the set of currently chosen vertices in Dijkstra's algorithm, $d$ be the currently stored path-length estimates, and $s$ be the source. The standard property that we know is true is that for all $r\in R$, $d(r)$ is the correct shortest path length from $s$ to $r$. I was just wondering if the follo...
I was not sure whether this is a computer science question or a math question, so I posted it here, hope that it is alright. I am trying to learn the technique of Hermite interpolation. I do understand that it is a generalization of Newton polynomial interpolation, which also considers derivatives to ensure continuity ...
I am reading a proof that the Subset Sum decision problem is NP-complete. I know that the time complexity is always calculated based on the number of bits of the input in binary, hence the $\log{W}$. Also, for this specific problem the size/length of the input is $(n+1)\log{W}$, with $n$ and $W$ being two integer varia...
Is there a method to prove things with longer input in complexity theory? For example, using padding argument it's trivial to show that $\text{NTIME}(n^2) \subseteq \text{DTIME}(n^4) \Rightarrow \forall k \ge 2, \text{NTIME}(n^k) \subseteq \text{DTIME}(n^{2k})$ Is there a common method for the opposite direction, i.e.,...
int foo(N){ if(N <= 1){ return 0 }else{ return 1 + foo(N-1) } } I can tell that the time complexity of this program is O(N) but I am unsure on how to prove it mathematically? If I can get some hints I'd grealy appreciate it.
I found this given problem as follows: Write a regular expression where all strings in which every substring 000 appears after every 1. Now, I also found the answer from Illinois university study material which is available online. The given answer is as follows: (1+01+001)*0* However, I think this is not the correct a...
For example, $D_1 = \{ w | w$ does not contain baba as substring$\}$ For $D_1$, I would make $F_1 = \{q_4\}$. As I tried to design $D_2$ as the complement of $D_1$ which does not have baba as a sub-string, I've found that I can make $D_2$ by inverting all the acceptability of all states, making $F_2 = \{q_0, q_1, q_2,...
Is there an online tool that returns the time complexity of recursion functions? For instance, when I enter $T(n) = T(n/2) + n$, I'd like to get $\Theta(n)$. I tried using Wolfram Alpha, but it doesn't return the above result I was looking for.
I'm interested in the Lovinger and Zhang paper Enhanced Simplified Memory-bounded A Star (SMA*+). Are there any further papers on this algorithm or publicly-visible code (in any language) implementing it? I have some things I'd like to understand better about the algorithm (apologies, they're quite basic). What is t...
I am thinking of techniques that we can implement in order to avoid deadlocks in processes. While I am aware of some tactics, e.g. killing a process when we reach a deadlock, or using spooling, would there be any other viable solutions? For example, can we adjust a process to be executed if it is urgent, and has higher...
While studying recurrences and the methods for solving them, I'm get confused on the assumption made on the solution of the following problem. Why we assumed that this inequality holds for all positive $m<n$, in particular for $m=\lfloor n/2\rfloor$? on what basis do we choose this $m$ and why do we need it. Appreciat...
This question is about generators, which are functions that return an item from a (usually very large or infinite) set on demand, an example from Python is: def all_natural_evens(): n = 0 while True: yield n n += 2 As can be seen, the above function yields the even number n in an infinite ...
Task: Given an array $arr[a_1, a_2, \dots, a_n]$ of integers, let $A = \sum\limits _{i\in \{1, 2, \dots, n\}}a_i$. Determine whether it is possible to spit $arr[]$ into 3 subsequences of equal sum, i.e. if $s_1 =s_2 = s_3 =\dfrac{A}{3}$ where $s_1 ,s_2 , s_3$ denoted the splitted arrays. My thoughts: I will first exam...
Although it might be a bit of newbie question, my question is, How can I apply the Master theorem to the following relation: T(n) = 99T(n/100) + log(n!) I'm trying to learn about algorithms, but I'm not really comfortable with logarithms(haven't studied in school yet), so I'd really appreciate a bit of help. Thanks.
What would be the time complexity of a depth-first traversal algorithm on a graph, that is simply trying to retrieve all nodes being visited from starting node up until a depth limit is reached (i.e. same node can be visited multiple times if cycles are present). The idea here is to retrieve an ordered list of nodes th...
I am looking for recommendations for algorithms (apparently this is the right SO site for that) that efficiently scan the high-dimensional parameter space of a cost function that is very expensive to evaluate. By expensive to evaluate I mean that one can only do O(1) evaluations per second on a modern computer. By eff...
Generating a Gray code representation of a binary number can be thought of as mapping one binary number onto another binary number. Therefore, $n$-bit Gray code is a permutation of $2^n$ elements. What would be an efficient way to generate the corresponding permutation matrix (having sparsity 1)? A brute-force solution...
As far as I know, when you reach the step, in a gradient descent algorithm, to calculate step_size, you calculate learning_rate * slope Now, slope is obtained by calculating the derivative of the cost_function with respect to the feature you want to find the optimal coefficient for. Let's say that the cost function for...
How would you call an array [1, 2, 3, 4, 5, ...] that has (and ensures) the property of not having any undefined values through all its length. "Dense" could work but it's not exactly what I mean, as it has more to do with zero/non-zero values.
I understand that a computer memory sequential word must always include at least two bits so it must be binary and therefore cannot be unary. Must a word be binary (and never unary)? That is to ask; can there be a "unary" computer memory sequential word? This question might relate to my other question - Must a Turing ...
I'm new to to python and tried a lot to solve this but can't get this right. I need help on this Thank you The code I wrote is - prod=1 for i on range (50,100,2): prod = prod*i print(prod)
I want to automatically&optimally split and distribute a number in several buckets as evenly as possible across a period of time. Example: 5000 across 12 months, in 6 buckets, with weights 15%, 20%, 15%, 10%, 30%, 10%, and a minimum of 100 per month per bucket; that is ~416 per month across buckets Rules: This is th...
I'm trying to prove that the tenth root of n grows slower than the logarithms but I have no clue. Also, how can I find which of two functions grows faster? It it related to derivatives? Thanks a lot.
I am working on something that requires checking a very large natural number $x$ to determine if it is the square root of an even larger natural number $y$. So I am wondering what are the fastest algorithms for computing square and square root, and how should I be approaching this i.e. Computing $\sqrt{y}$ and compari...
Here, Yuval Filmus wrote: Unary encoding is only relevant in contexts where the length is not fixed. Are there words without fixed size length? Is there a Computer Science theory which describes computers which can include such words in their memory cells (while at least some words are unary) and could the output of ...
I am training a model for ham and spam classification using LSTM. I am indicating the spams as 0, and the hams as 1. However, the dataset has much more hams than spams, so I tend to get an output very close to 1. That means the output is almost always above 0.5. So I have two questions about this : Q1. Should I rate my...
I need to perform 2's complement operations on -50 - -48 From a mathematical point of view the following would be true. -50 + 48 = -2 If I would follow the steps I would have: I got to this result by getting the bite for 50 and 48 and then reversing -50 = 11001101 -48 = 11001111 In 2's complement: the bite result for ...
I'm struggling in understanding how to recognize irregular languages. I know what the meaning of irregular language but still find it hard to recognize. Are there any tips to recognize better and to know which is regular and which not? For example, which of the following is not regular, and what gives you the intuition...
For example, I have one program that requires $O(i)$ time complexity, and a second program requires $O(j)$ time complexity. Would the total time complexity be $O(i+j)$? And why?
I am currently reading the paper On computing the length of longest increasing subsequences by Michael L. Fredman. I'm struggling to understand parts of the proof of Theorem 3.5, especially this bit: Now consider the following enhancement $A^*$ of $A$. Whenever $A$ concludes that $L < k$, $A^*$ continues to completely...
Given two equally sized sets, $P$ of Boolean predicates and $E$, I want to decide if there exists a bijective function $f: P \rightarrow E$, such that \begin{align} \forall p \in P \; p(f(p)) \end{align} It seems like a special case of having a weight matrix $W$ where $w_{ij}=0$ if $P_i(T_j)$ and otherwise $1$, and the...
What data structure would one use to keep a large number of IP addresses (v4 and v6, but not at the same time if that makes a difference), and I'm talking about millions, preferably hundreds of millions at a time for fast look-up. The preference would be for fast look-up. Initial filling of the data structure is not to...
I am unable to understand how the negation of a sentence into CNF actually makes sense, hopefully somebody can explain it to me in understandable terms! Given the sentence: If the battery is charged (A) and the screen is not cracked (B) then the phone is working (C) The following makes perfect sense: (A ∧ B) => C I can...
Consider a graph $G = (V, E)$, where $V = \{0, 1, 2, \ldots, n\}$. The graph $G$ is complete, which means we can traverse $(i, j)$ for all $i, j \in V$. At each vertex $v \in V$, there is a task that we must complete. The task at vertex $v$ takes $q_v > 0$ minutes for $v \neq 0$, and we must complete all tasks. We star...
Given the sentences, S1, S2, if S1 |= S2 then all models that satisfy S1 also satisfy S2, how is the following statement correct? A ∧ ¬A |= B How can something and not something equate to true? I am stuck trying to work out how true and false can still entail true, actually how can A and ¬A occur at the same time? Than...
https://leetcode.com/problems/bus-routes/ You are given an array routes representing bus routes where routes[i] is a bus route that the ith bus repeats forever. For example, if routes[0] = [1, 5, 7], this means that the 0th bus travels in the sequence 1 -> 5 -> 7 -> 1 -> 5 -> 7 -> 1 -> ... forever. You will start at th...
$$T(n)=2^n+4T(\frac{n}{2})$$ I have started substitution for: $$T(\frac{n}{2})=2^{\frac{n}{2}}+4T(\frac{n}{4})$$ $$T(\frac{n}{4})=2^{\frac{n}{4}}+4T(\frac{n}{8})$$ $$...$$ $$T(\frac{n}{4})=2^n+4[2^{\frac{n}{2}}+4(2^{\frac{n}{4}}+4T(\frac{n}{8}))]=2^n+4\cdot 2^{\frac{n}{2}}+4^2\cdot 2^{\frac{n}{4}}+4^3T(\frac{n}{8})$$ S...
Construct a turing machine (TM) over the alphabet {a,b,0,1,#} that reads strings of the form (ab)^n with n>0. If the string w on the tape has this structure, the TM should overwrite all letters with the character 1 and go into an accepting state and if not, the TM should overwrite all letters with the character 0 and ...
I have a set of $d$-dimensional hyper-rectangles with integer axes. These hyper-rectangles may overlap. The union of these hyper-rectangles forms a $d$-dimensional orthogonal polyhedra $P$. I sort the $d$ dimensions in order. So there are dimensions $1,2,3,\cdots,d$. I want to express $P$ by a directed graph $G$ (inste...
I am reading Algorithms by Dasgupta et al and the graph section provides an example graph and mentions that there are 4 orderings with one of them being B, A, D, C, E, F. Are the other 3? B, A, D, C, F, E B, D, A, C, E, F B, D, A, C, F, E
I'm reading The Algorithm Design Manual and this is one of the excersizes: Prove or disprove the following statement: $\Theta(n^2 ) = \Theta(n^2 + 1)$ I think this is untrue because the right side of the equation claims to have a multiple $c$ such that it is smaller than all the multiples of $n^2$, which is untrue. B...
I am currently working on CLRS 1.13. The idea is to use Stirling's approximation to prove that $${2n \choose n} = \frac{2^{2n}}{\sqrt{\pi n}} \left( 1 + O \left( \frac{1}{n} \right) \right)$$ Now directly replacing Stirling's approximation I arrive to something like: $${2n \choose n} = \frac{2^{2n} \left( 1 + \Theta(\...
I have a large (10 million+) set $X$ of data points in some high dimensional $\mathbb{R}^d$ ($d \geq 500$) space. Each data point is quite sparse, e.g. has around $10$ components. Every missing component can be seen as having value $-\infty$ for the purposes of this problem. Associated with each data point $X_i$ is a ...
I'm having troubles finding information on how to solve/optimize a problem I'm currently facing, which probably means I'm either approaching it poorly and/or I don't know what to search for. The question I think I need the answer to: given several sets of possibilities, what is the smallest number of sets I must select...
how can I find the regular expression for this intersection ? I've tried to find words but it did not help too much.. $$[\; (a+b)^* c^* (a+b)^* \;] \cap [\; (c+b)^* a^* (c+b)^*\;]$$
int P(int n) { if (n==1) return 1; else return P(P(n/2)); } How will this function P(P(n/2)) be executed and what will be the recurrence relation for this code? Original image with the code
In the book - Computer Organization and Design: The Hardware/Software Interface [RISC-V Edition] by Patterson and Hennessy, CPI is defined like this: The term clock cycles per instruction, which is the average number of clock cycles each instruction takes to execute, is often abbreviated as CPI. Since different instru...
If I have two kinds of LinkedList $A$ and $B$. $A$ is a move to front one which means: >>> lst1 = 1, 2, 3, 4, 5, 6, 7, 8, 9 >>> lst1.contain(7) True >>> lst1.to_list 7, 1, 2, 3, 4, 5, 6, 8, 9 $B$ is a swap list, which means: >>> lst2 = 1, 2, 3, 4, 5, 6, 7, 8, 9 >>> lst2.contain(7) True >>> lst2.to_list 1, 2, 3, 4, 5, ...
Suppose I have some (increasing, nice asymptotics) function $f(n)$. Does there exist a complexity theoretic problem (e.g. PATH, 3-SAT, GO etc.) that can be solved in time $\Omega(f(n))$ on a deterministic Turing machine. In other words is there a problem proven to be an element of $\mathsf{DTIME}(f(n))$, but not $\math...
I have to work on something , but I am making an error that I can not identify. Propably, it is going to sound simple to you but it's my first course on computer architecture and there is nothing in my slides or book. "We are given a memory, where the smallest chuck of information that can be adressed is 1 byte, and we...
I was studying shortest path algorithms and was met with an issue regarding Bellman Ford for the image below. Following the graph, i see that node 3 has a length of 1 while node 2 has a length of 2. When computing the path from 1 to 8 which is the correct path between 1->2->6->4->7->8 and 1->3->2->6->4->7->8 ? I can s...
Suppose you have an $n\times m$ 2D array consisting of each $n$ rows of $m$ real numbers. What is the sequence of indexes $i_1,i_2...i_m$ such that $\sum_{j=1}^mA[i_j, j]$ is maximized, subject to the constraint that each run of a value in $i_1...i_m$ must be at least $r$ entries long? A correct algorithm with time lin...
We consider training one-dimensional open map of Kohonen with neurons in one-dimensional input space. We assume it is completed the phase of the device and the weights $w_i$, $i = 1,2, \dots, N$, are placed in ascending order. (As we know, this provision will not change in rest of the training.) At each step of the tra...
I get $n$ numbers, where every number is an integer between 1 and 1000. If within given numbers are duplicates, I sum all of them to one number. I repeat it until I have only distinct elements. As a result I return number of distinct elements at the end. How do I do it in additional space complexity $O(1)$ and time com...
Let $n$ be a positive integer. On a circle are arranged $n$ points $A_1$, $\ldots$, $A_n$. We put some arrows from $A_1$ to $A_2$, from $A_2$ to $A_3$, etc., from $A_n$ to $A_1$. On each arrow are written a string ($\textit{name}$ - so that we could distinguish all arrows from each other) and a number. How can we find ...
Given a random graph $G(n, p)$, where $n$ is the number of nodes and $p$ is the probability of connecting any two edges, it is known that $t = \frac{\ln(n)}{n}$ is a threshold for the connectedness of the graph: if $p$ is greater than $t$ the graph will be almost surely connected, otherwise disconnected. The farther yo...
I am working on a chatbot designer interface. The dataset for the conversation flow consists of messages. Each message has a parent message and can have multiple possible next messages. The system displays one of the possible next messages depending on the reply. This makes it a complicated structure of parent-children...
There's lots of answers on the proof but I didn't find anything that regarded my difficulty directly. Question ( From " Introduction to Algorithms ( Cormen ) " ): Answer ( Found on the net ): I don't understand the case where $ A[j] = v $ when we prove the maintenance step for before the j+1-th iteration ( after ass...
I have the following mixed integer programming (MIP) problem: $$ \begin{array}{rll} \text{Maximize } & z=k \\ \text{subject to } & a_ik - m_i \geq 0 & (i=1,\dots,n) \\ & b_ik - m_i \leq 1 & (i=1,\dots,n) \\ \text{where} & k \in \mathbb{R}_{\geq 0}, m_i \in \mathbb{N}_0 & (i=1,\dots,n), \end{array} $$ where $a_i,b_i$ ar...
I'm pretty confused so I hope I don't mix up the different terms here. The two's complement representation of decimal 0 is simply 000 The two's complement of 000 is 111 I imagine that complementing a number is equivalent to flipping bits in binary The nine's complement of 000 is 999 This is what confuses me. Are ...
I am reading Automata and Computability by Dexter C. Kozen and I am in the first chapter entitled Strings and Sets. If we have a set $A=\{ab,b\}$ do we get to assume that the null string $\epsilon$ is also a member of that set? If we have another set $B=\{\epsilon\}$, does $A\cap B = \{\epsilon\}$ or does $A∩B=\emptyse...
In boolean logic, why is the "opposite" of AND (&) equal to OR (|)? For example, why would !(A & B) be equal to (!A | !B)? I understand that not A would simply be !A, but why does AND change to OR?
I drew a Push-down Automata, accepting the following language: $$ \{ xcy : x,y \in (a+b)^*, \#_a(x) > \#_{bb}(y) \}. $$ Here $\#_{bb}(y)$ counts the number of times that $bb$ appears in $y$, with overlaps. For example, $\#_{bb}(bbb) = 2$. My question here. Is it possible to reduce my PDA to less states? Thanks.
Let $G=(V,E)$ be a weighted undirected connected graph and $w: E \to \mathbb{R^{+}}$ a weight function so that there are no two edges that have the same weight, and $T$ is an MST of $G$ . Then in each cycle in the graph, the edge with the minimum weight belongs to $T$. I either need to prove it in a positive way or gi...
I've been trying to find a formula that helps us identify where an address can be depicted in cache. I remember my professor talking about some kind of division but I can't find it in my textbook nor internet (maybe I am not searching the right words). For example: I have a cache that has $2^{14}$ blocks, each 32 byte...
I'm trying to prove that $L=\{a^kb^ra^m|k,r,m\ge0 \text{ and } m=k+r\}$ is not regular and, although it's trivial to prove it via pumping lemma, I'm having troubles trying to find a way to prove it via closure properties (for example a union of $L$ and another regular language which may give a non-regular language). It...
I am a beginner at Java and this code example came up in class: int horsepower = 15; if(horsepower > 15) if(horsepower <= 20) System.out.println("There is a lot of horsepower"); else System.out.println("The car super fast"); the output is nothing but I can't understand why. I...
For an alphabet $A = \{ a_1, a_2..., a_n \}$, the set of regular langages $L_r$ on $A$ are recursively defined by closed union, concatenation, and Kleene star's operator. I understood that languages ($A^*$) and regular languages (a subset of $A^*$) are different. Why do we need Kleene star, isn't concatenation enough f...