instruction
stringlengths
35
11.4k
Currently while I was coding, I got a doubt. While I was solving a particular type of problem I found it to be solved in $O(n^3)$. I have broken that problem and solved it in $O(n^2)$. But to solve it I have broken that $O(n^3)$ to $3$ * $O(n^2)$ Is it a better solution than $O(n^3)$ or will it matter the number ...
Reading Fundamentals of Database Systems 7th Edition, on Page 603, it says, Indexes can also be characterized as dense or sparse. A dense index has an index entry for every search key value (and hence every record) in the data file. A sparse (or nondense) index, on the other hand, has index entries for only some of th...
L={ | M is a DFA, |w| is even for all w in L(M)} Meaning we are looking for a Turing Machine or any algorithm that receives a description of a DFA and decides if all the words this DFA accepts are even in there length(length of 0, 2, 4, 6 ..). DFA stands for Deterministic Finite Automata. My proposal is this, check if ...
Hello people on the internet, I'm currently searching for some kind of fast algorithm that allows me to extract curves in three dimensional space that arise as the intersection of two level sets of smooth functions, i.e. \begin{align*}\mathcal{C} = \{\vec{x} \in \mathbb{R}^3 | \; F(\vec{x})= l \; and \; G(\vec{x})=s \...
I am reading http://okmij.org/ftp/gengo/applicative-symantics/AACG1.pdf and there is defined language TL (see last row in the table on page 4). It seems to me from this definition of TL, that lambda calculus is the language of universal logic - each connective (unary, binary, ternary, etc.; quantifiers can be expressed...
Given a cubic graph, I want to color its vertices in 2 colors (Say A & B). A vertex is considered "Good" iff the majority of its neighbors is colored differently than that vertex. (For example, vertex colored A has neighbors A B B is considered Good, and a vertex colored A has neighbors A A B is considered "Bad") I su...
Given positive integer inputs $x$ and $y$ , with $0<x<y$ and $y$ an odd prime (or $\gcd(x,y)=1$ and $y$ odd), the following algorithm computes $x^{-1}\bmod y$ per the (half-)extended binary GCD. All quantities are non-negative. What's an upper bound of the value internally reached by integers $a$ and $d$ , as a functio...
According to the definition, distributed computing means to distributed a problem among different users while workgroup computing means to work on a problem by different users. So what's the difference between these two? Plz explain it with an example
I am having a bit of a tough time grasping whether a computer system contains several page tables or just one page table. Some sources speak of page tables in plural others in singular. Intuitively it makes most sense to me that there is only one Page table containing all the physical addresses especially considered ...
Suppose you were to compress data before it was sent to Random Access Memory. Wouldn't you technically be using less R.A.M?
I don't know how to start with the following exercise: Design an efficient algorithm to decide whether a given triangulation with $n $ points is $3$-colourable. The triangulation is given by a sorted edge list, where every edge is given by the indices of its two end points. Further, for every edge there are given th...
I have a function: int sum = 0; for (int i = 1; i < n; i*= 2) for (int j = 0; j < n; j++) sum++; From my understanding this is $O(n\log(n))$ because the inner loop runs $n$ times for every time the outer loop runs, and the outer loop is running $\log(n)$ times. Putting them together gives me $O(n\log(n))$, which...
If so, then $O(log_2 n)$ = $O(log_{10} n)$ = $O(log_e n)$. It is very wired that computer scientist treat them equally. Considering, $(log_2 n)$ = $m$, meaning $n$ = $2^m$ $(log_{10} n)$ = $m$, meaning $n$ = ${10}^m$ $(log_e n)$ = $m$, meaning $n$ = $e^m$ So, does it mean that $O(2^m)$ = $O({10}^m)$ = $O(e^m)$ Is, bas...
We're given a graph $G=(V, E)$, with source $s$ and sink $t$, $s\neq t$, and that all capacities are non-negative integers. Also the max flow itself is given, so we receive the value of max flow for each edge. We're also given some edge $e'$. How can the max flow be found if we decrement the capacity value of an edge...
It seems that the maximum matching number decreases when some independent (not connected) vertices collapse into one vertex, but I don't know if it is absolutely true. Would maximum matching number increases when two vertices are connected to form a new edge? Any proof? Thanks! Definitions: Given a graph G = (V,E), ...
Suppose i have a graph and i want to find minimum-spanning-tree. As in imperative languages we have to take specific steps from everynode(example ,we use kruskal's algorithm or prim's algorithm) to find the Minimum spanning tree but in declarative language(specially prolog, we can apply same algorithm but those are l...
We have a finite poset and its subset $S$. We can enumerate elements of $S$ using an iterator. I need to check if there are more than one minimal elements of $S$ (regarding the above poset). The best thing I came up with is to construct the graph of all elements of $S$ and then check it for minimal elements. But this: ...
Is the language $L = \{a^pb^q \ | \ p \ge 1, \ q \ge 1, \ p \ge q^2 \ or \ q \ge p^2\}$ context free? I should probably use Ogden's lemma, but I don't know how to do that in this case.
I'm working on exercise 22.3-13 of CLRS (Intro to Algorithms 3rd edition): A directed graph $G = (V, E)$ is singly connected if the existence of a path from $u$ to $v$ implies that $G$ contains at most one simple path from $u$ to $v$ for all vertices $u, v\in G$. Give an efficient algorithm to determine whether or not...
How should I compute efficiently a matching of maximum size in a tree? My thoughts so far: since from a path we can get a matching, then just finding the longest path in the tree should be enough to answer the question. Am I wrong? another approach?
An answer to a previous question I asked advised me to find the dual graph of a triangulation. I'm given the graph in the following form: How can I get the dual graph from a list of edges given this way?
For example, is it a subset? Are they two separate fields in Computer Science? I have hear conflicting information: one professor said they are synonyms. However, in the courses taught at Stanford CS they are two distinct classes: CS221 (Artificial Intelligence) and CS229 (Machine Learning)
Consider the simple problem: Given a list of objects L of length n, and an object O, determine if O is in L. It is intuitive that there cannot exist an algorithm a with worst-case time complexity less than O(n) to correctly solve this problem. But without considering individual algorithms, how can one mathematically p...
I often see that someone uses geometric series for proofs related to time complexity, but also I can't understand why they are used. Are they making proving easier? And how can I use this 'tool' for proofs? Can I transform problems to fit to geometric series? For example the time complexity of this simple function to g...
i saw in a book how to construct a PDA for a case with m is equal to n . It's pretty simple, just push a symbol for every a and pop this symbol for every b that the PDA reads. But, i don't found a way to construct a PDA for this particular case. Every help is welcome.
I'm having trouble identifying the approach to minimize the cost of reaching a certain state in an optimization problem. I've modeled it here as a game. Problem Structure You buy heroes and send them into a dungeon consisting of rooms containing each two challenges (random number check with a given threshold per room) ...
I am reading this book Asymptotic Methods in Analysis by N. G. de Bruijn. It describes the definition of $O$ symbol as A weaker form of suppression of information is given by the Bachmann-Landau O-notation. It does not suppress a function, but only a number. That is to say, it replaces the knowledge of a numb...
Unfortunately (like many other authors) Fenwick does a very bad job of explaining his work (the Binary Indexed Tree) in the original text. The paper lacks a proper formal proof of why this structure should work and only provides examples. This seems to be a very widespread issue regarding this topic and no tutorial or ...
I'm currently trying to map how to make a good algorithm that won't have issues to find the shortest path. The labyrinth consists of an X and Y dimensions as input; However, the labyrinth will generate obstacles within the dimensions and randomly spawned. There is one entrance and at least one exit after finding the sh...
Given a context-free grammar $G$, let $\longrightarrow_G$ be the (one-step) rightmost derivation relation, and $\longrightarrow^*_G$ its reflexive and transitive closure. Let $S$ be the start symbol of $G$, $\mathbf{N}$ the set of non-terminal symbols and $\mathbf{T}$ the set of terminal symbols. For each rewriting ru...
i'm solving a multi part question regarding candidate keys and functional dependencies. now i've already found 2 dependencies(the canonical covering of the functional dependencies contains only 3 dependencies) in the previous parts of the question: $D\to BE, CE \to AD$ ($R=A,B,C,D,E$, R is in BCNF). how can i find th...
I am trying to calculate the length and width of objects using a camera. The camera (90° angle from the top) and the background is fixed. See this Link https://www.pyimagesearch.com/2016/03/28/measuring-size-of-objects-in-an-image-with-opencv/ As an example I take a picture from a US quarter from a distance of 10 inche...
I am trying to solve some past papers in preparations for my next exam and I've stumbled across the following exercise: While I managed to solve most parts of the exercise, I am still unsure about the formula ((b)U(b)). I am unsure which node I should start checking from and on the general definition of U. As far as I...
Let $S= \{1,2,3...,n\}$ be a set and I want to store a subset of $A \subseteq S$. Is there exists any data structure such that insert$(x)$, delete ($x$) can be done in amortised $O(1)$ time and search($x$) can be done in $O(1)$ time, where $x\in A$. Space used by data structure should be $O(n \log^{*}n)$ or $O(n)$ bits...
I would like to know whether the following problem is a standard problem that has been considered in the research literature. I performed some searches, which have not produced results. I call this problem the Maximum Weighted Disjoint Set Union, which is obviously not the name by which the problem is known (if it is k...
I do not understand what is a ridge for hill climbing. The definition I found is a place where all points appear like a maximum, but how is that different than a plateau?
The integer linear programming formulation for the multicut problem for the given graph $G = (V,E)$ and distinguished source-sink pairs of vertices $(s_1,t_1),...,(s_k,t_k)$ is: \begin{alignat}{3} \text{minimize} & \quad \sum_{e \in E} c_ex_e \\ \text{subject to} &\quad \sum_{e\in P} x_e \geq 1, & \quad \forall P...
As seem in the history section of the Wiki Reed Solomon article: https://en.wikipedia.org/wiki/Reed%E2%80%93Solomon_error_correction#History Efficient decoders for BCH / fixed generator polynomial based code words were developed back in 1969 - Berlekamp Massey decoder, and 1975 - Sugiyama extended Euclid decoder. Howev...
I'm given a finite partial order, in the form of a dependency graph between items, and I'd like to have it in series-parallel form (Wikipedia). So formally, given a finite partial order $\le$ on a set $V$, I'd like to construct it using only the following rules: For every item $P$ in $V$, we have the partial order on ...
The Viterbi Algorithm can be used to calculate the most likely path, based on observations in a Hidden Markov Model. Using the same notations as Wikipedia, "each element T1[i, j] of T1 stores the probability of the most likely path so far X = (x[1] , x[2] , ... , x[j]) with x[j] = s[i] that generates Y = (y[1] , y[2] ...
I'm working on a formula that'll evaluate the partial sum of the harmonic series from $t_1$ to $t_n$. The problem is that I'm almost certain the final formula will include factorials. But if the formula has a factorial, then it's runtime complexity would be at least $O(n)$. And this would defeat the entire point of hav...
The array max size is 10^5 I can only imagine on trying every possibility, on a O(n^2) solution, there is a better way for solving that? Thanks a lot!
I have an algorithm that on each iteration generates a copy of an object containing a bit array and modifies it (the modification is limited to just 1 element per copy) While doing the time analysis I cannot neglect the copy cost as this bit array is encoding information about the input set, so for a very large number ...
Here is an example tree: Each node has either $0$ or $4$ nodes. The values $v(n)$ of the node $n$ is given by $v(n) = v(\operatorname{parent}(n)) + k(n)$, where $k(n)\in \{2, 2.5, 8, 50\}$, such that a parent has childs of each value. Find the $K$ least nodes in a given tree (always ignore the root node). For our examp...
I've seen several tables that list operation counts for matrix-inversion related problems, but none of them actually brought forward the way of computing them. I'm interested in solving Ax=b for x, and k-diagonal sparse matrix A - which is a sparse matrix that has zero elements on all but k many diagonals. On these k...
I have a sequence. And now for each element in this sequence I would like to know how many subsequent elements are larger. Or, in other words, I have a sequence $a_1, \ldots, a_n$, and for each $1\leq i\leq n$ I would like to compute $|\lbrace j|j>i\wedge a_j > a_i\rbrace|$. My idea: Implement an AVL tree, put element...
Wikipedia article on machine code and more in general Wikipedia's take on machine code seems pretty amiguous sometimes. Often it makes me wonder if there's more, or it is just bad generalization. Look at this: Machine code or machine language is ......Numerical machine code (i.e., not assembly code) may be regard...
I am not getting enough literature on Vertex Disjoint/Vertex Capacited Min Steiner Tree Packing Most of the few papers that I have found refers to one reference which is not accessible over internet. Korte, B., H. J. Pr6mel and A. Steger, "Steiner Trees in VLSI-layout", in Paths, Flows, and VLSI-Layout, Korte, B., L...
UPD: The following problem comes from error correction codes, to be precise -- either maximum-likelihood or belief-propagation decoding when the spectrum of special failing subsets is known (to some extent). Then the failure probability can be formulated as follows. Let us say the universe set is $\mathcal U = \{1,2,\d...
I am trying to solve a referee assignment problem, but I simply can't think of a way to relate my variable to one of the parameters, and I hope that someone in here can help. I have the following binary variable x(r,m) = 1 if referee r is assigned match m and the following parameters: time(m,t) = 1 if match m takes ...
We know that NP is the class of languages recognized by a nondeterministic Turing machine (NTM) in polynomial time. I've also read that NP is the class of problems can be solved by NTM in polynomial time. It is clear that every decision problem can be seen like a recognition language problem, but if we have a function ...
While reading an article, I noticed the use of term 'I/O Task': Indeed, suppose the currently running process is performing an I/O task (which, by definition, does not need the CPU to be accomplished). Then, the OS may interrupt that process and give the control to one of the other in-main-memory programs that are rea...
None of the 4 possible answers have $\log n!$ in them e.g. one of them is $O(n\log n)$ I tried solving, but I can't get why there is no $\log n!$ in non of the answers?!
Cook and Levin showed in 1971 how deterministically in polynomial time from every non deterministic Turing machine M, that halts in polynomial number of moves/steps, and string w to create the boolean formula $\Phi_{M,w}$ in conjunctive normal form that is true for each accept path/route of M on w and false for each re...
I came across this explanation for count to infinity problem However, i don't understand that after the BC link broke, followed by which B erroneously updated the path to C at a cost of 3; Now why will A update the cost to C as 4 (after getting updates from B) since its current cost to C is 2 which is lesser than that ...
... x = a / b; For the above code, for example, is there a way to determine whether b could be zero at the time of division, even if the answer isn't 100% decisive? Can this algorithm generalize to check any property at a point of a program?
Today I had to prove some tautologies as an exercise, one of them was: (Ga)->(Fb) equivalent aU(b v ¬a) It is clear that I have to prove the implication in both ways. After putting into negation normal form i get that: F(¬a v b) -> aU(b v ¬a) and viceversa. I managed to prove the opposite implication, since aU(b v ¬a) ...
Given two context-sensitive languages, $L_1$ and $L_2$ is the problem of "whether $L_1 \cap L_2$ also belongs to CSL" decidable? I have the same question for the case when $L_1$ and $L_2$ belongs to Recursive/Recursively enumerable language. I think, they are decidable because they are closed under intersection operat...
In regards to the quantum Fourier transform Page 845 of The Nature of Computation states The amplitudes $\tilde{a}_\mathbf{k}$ are the Fourier coefficients of $a_\mathbf{x}$, $$\tilde{a}_\mathbf{k} = \langle \mathbf{k}|\psi\rangle = \frac{1}{\sqrt{2^n}}\sum_\mathbf{x}(-1)^{\mathbf{k\cdot x}}a_\mathbf{x}\,.$$ Here $...
Gödel defines in his System T primitive recursion over higher types. I found notes from Girard where he explains the implementation of System T on top of simply typed lambda calculus. On page 50 he mentions that once we use more types in the recursor we gain more expressive power with the system. I don't understand how...
Will a greedy method of picking the item that causes the largest difference each time lead to the optimal result in the minimum partition problem? Let's say I have a set $\{a_1,a_2,a_3,...a_n\}$, now I have to divide it into two subsets so that the difference between the sums of the two subsets is the minimum possible....
How can we prove that the Halting problem is solvable by a machine with access to some oracle?
$L$ = $0^p1^q0^p$. Where $p, q \geq 0$ Here for any string $w \in L$ , I can have $u$=$0^p$, $x$ = $1^q$ and $v$= $0^p$ and $x^i$ will belong to L for all $i \geq 0$ So how do I prove it to be non regular using pumping lemma as there doesn't exist a string $w \in L$ which cannot be decomposed into the form $ux^iv$ for ...
I tried to implement points location algorithm using Fortune's algorithm to get Voronoi diagram and another sweepline algorithm to locate many points in $O(n\cdot\log(n))$. If there are multiple concentric points on some step I get a pencil of radius vectors origins from the center of a circle. I need to sort them by a...
I need to know which interpolation method is the best for working with reliefs, that is, to know the elevations or depths of a given terrain a set of points.
If M is non deterministic Turing machine and w is any string then $\Phi_{M,w}$ is satisfiable if and only if M accepts w according to Cook and Levin (1971). By the definition of non deterministic Turing machine, M accepts w if and only if M has an accept computation on w. But if all computations of M on w are accept th...
I have the following program x := y + 1; if (y > 0) then x := x + y else x := y + 100; x := x + y; I want to compute the weakest precondition for getting {x = y} by executing this program. The solution of this problem is the following {(y > 0 & y + 1 + y = 0) | (y = -100)} = {( y > 0 & y = -0.5 | y = -100} = {false | ...
I have the following background: I have experience with object-oriented programming languages I find Turing machines and the concept of a "procedure" very intuitive. Yet I'm interested to understand the idea behind the abstract $\lambda$-calculus, and its application in the form of functional programming. When I re...
I am given weighted undirected and non-planar graph G=(V,E). I don't understand much about complex graph and how to work with them. So any tips will help. For example like this I don't know how to explain it but i will try. Result should me like this: In every simple cycle (for example A-B-C-A) there should be at leas...
I studied about Quantum Turing machine and i figured out that the difference between QTM and TM is in transition function and also if a problem is unsolvable by a TM then it is unsolvable by a QTM but I need a justifiable reason to claim QTM does not contradict with Church-Turing thesis.
I'm analyzing the computational complexity of an algorithm whose input size is $n$. Finally, I've ended up with $T(n) = {m^\frac{n-1}{m}}$ where $m$ is a constant. Can one explain the type name corresponding to this computational complexity (e.g., exponential, etc.)?
For the purposes of this question, a maze is a spanning tree on a square grid (although the type of grid isn't super important). There are many Maze generation algorithms, but they only work on a finite grid. What if instead you are working on an infinite grid? But you only need to know finite of the grid at a time (th...
Input: $M$ is non deterministic Turing machine that always halts in $cn^k$ moves/steps, where $c$ and $k$ are constants and $n$ is the length of the input string of $M$, $w$ is any string in $\Sigma^*$ and $a$ is another string in $\Sigma^*$ where $\Sigma=\{0,1\}$. Output: Does $a$ represent a valid computation of $M$ ...
If we had a language $$\sum = \{a,b,c\}$$ for a pushdown automata, and the transition $$a;A/AA$$ means "If you read in an a and A is at the top of the stack, push A", then would you be able to push nothing if you encounter an a and A is at the top of the stack with the transition: $$a;A/\epsilon \space C$$ I am new to...
So I understand the idea that the decision problem is defined as Is there a path P such that the cost is lower than C? and you can easily check this is true by verifying a path you receive. However, what if there is no path that fits this criteria? How would you verify the answer of "no" without solving the best pa...
If $f(x)$ and $g(x)$ are two functions such that $$f(x) \not\in \Omega(g(x))$$ does $$\log f(x) \not\in \Omega(\log g(x))$$ hold?
I want to prove that $H(L_1 \cap L_2) = H(L_1) \cap H(L_2)$ is not always true. If $L_1 = (ab)^*$ and $L_2 = (ba)^*$ with mapping $H(a) = 1$ and $H(b) = 1$, $H(\epsilon) = 2$, then $H(L_1 \cap L_2) = 2$ while $H(L_1) \cap H(L_2) = (11)^*$. Is the above example correct to prove the above statement? Is it allowed to map ...
Say we had a function $4^k$. The asymptotic of this function would be $\Theta(4^k)$, and thus we would say the function has exponential run-time. But what if $k = \log{n}$? Then our same function would be $4^k = 4^{\log{n}} = n^{\log{4}} \in \Theta(n^{\log{4}})$. (Step 2 to 3 is accomplished via a change of logarithm ...
What I am trying to do is determine "closeness" or how similar are arrays of integers (or byte arrays, doesn't matter). For example, let's say a = [0, 1, 2, 3, 4], b = [0, 2, 1, 3, 4], and c = [1, 4, 2, 0, 3]. Is there a function to determine that a is closer to b than c is? So the function I am looking for I think sh...
Reading about the Ski Rental Problem in Wikipedia, I got confused on the "when" is the buying of the skis occur. I could think of 2 possible ways, but each of them would have a different competitive ratio for a deterministic (and non- deterministic) algorithms: Let's say that renting costs 1 dollar a day and buying cos...
Given inorder and preorder (or postorder) traversal sequences of a binary tree balanced binary tree binary search tree of n nodes, what is the time complexity of creating the respective unique tree.
If $f:A^*\rightarrow A*$ and $g:A^* \rightarrow A^*$ are partial recursive we want to prove $h:A^* \rightarrow A^*$ with the following definition is partial recursive $$ h(x) = \begin{cases} \lambda & f(x) = \lambda\\ g(x) & \textrm{otherwise} \end{cases} $$ for $x \in Dom(f)$. One of my friends tri...
What is the grammar for language $L = \{ a^nb^m : n\neq m-1\}$? I only know I have to write grammar for both $ n<m-1 $ and $ n>m-1 $, so this is what I wrote: For $n<m-1$: \begin{align} &S\to Abb \\ &A\to aAb \mid \lambda \end{align} For $n>m-1$: \begin{align} &S\to aaA \\ &A\to aAb \mid \lambda \end{...
For example, when I look at some code like int x = 1; int * y = &x; I can read it like x equals 1 y equals the address of x but how would I "read" something like *y = 1; My best guess is The value at address y equals 1 But I'm wondering if there's a better way to think about it.
I am trying to prove that if $DSPACE(\log^2n) \subseteq NTIME(n^2)$ then $DSPACE(\log^3 n) \subseteq NTIME(n^2\log n)$ using padding, but I'm not sure if the claim is correct, or how to do the padding. I tried to create for $L \in DSPACE(\log^3 n)$ the language $L_{\mathrm{pad}} = \{ x\#^{\log^3(|x|)-|x|}\mid x \in L\}...
I want to solve the following formula: $T(n)=T(n-1 )+ c\cdot\log n $, $T(1)=d$ I though about master but then I realized there is no dividing here so it's not gonna do it, I tried to expand the formula like this: $T(n-1)=T(n-2) + c\cdot \log(n-1)$ $T(n-2)=T(n-3) + c\cdot \log(n-1)$ How do I find the general formula? H...
I'm familiar with how Church numerals are defined in the lambda calculus, i.e. as functions that take two arguments and apply the first argument $n$ times to the second. Then I have the successor and addition functions, both of which I managed to derive and understand: $$\begin{align} \mathrm{succ} &:= \lambda nsz.s (n...
What's an algorithm for $k$-means clustering, in particular an online algorithm (you can stream new points to it), such that once the size of the set of clusters $k$ becomes large, we can still efficiently lookup a point $p$ and classify it into a cluster ID (an integer)? Obviously standard $k$-means alone is not suffi...
How does to prove that language $$\textbf{X} = \{G \mid\text{ all connected connected components in $G$ are trees}\} \in \textbf{L}\,?$$ I know how to prove that language of undirected trees is in $\textbf{L}$ but I don't know what to do next.
I need to represent a family F of sets with some appropriate datastructure. The datastructure needs to support the procedures MAKE-SET(x), DISJOINT-UNION(A,B) and REPORT(A). I dont have a problem with implementing the procedures themselves. Its pretty straightforward if you follow the idea introduced in the chapter on ...
The most common method of proving that some problem, P, is at least as difficult as some other problem, Q, is to demonstrate that Q can be solved in terms of P (with the usual caveats for the complexity of the reduction itself). In particular, I'm thinking about the fact that breaking RSA encryption is believed to be a...
Currently I am working on a Gomoku AI (or generally Connect-X games). Implementing the search tree was no problem, but then I got to the point where I had to implement the value function and was surprised how difficult this is to make with a decent performance. My question is what is the most efficient algorithm to che...
In my exam preparation I stumbled across the follwoing exercise regarding pre and postconditions: As far as I understood the question, we need to express some condition for p, such that if that condition holds for p, then we have that {true} p {true}. The conclusion I got to when trying to think about it intuitevely i...
I got stuck on the following note while reading a paper about computer security: The stack mixes program data and control data – by overrunning buffers on the stack we can corrupt the return addresses! In fact, I didn't understand how a buffer overrun corrupts the return address within a stack frame. Also the use o...
I just began reading Data Structures and Algorithms (Aho, Hopcraft, and Ullman). At the beginning, there is an example that discusses designing a traffic light for a complicated intersection of roads. A visual is given of the intersection along with a table of incompatible turns ("turns" are considered to be any moveme...
Again, the language is $L = \{w | w ∈ \{a,b\}^∗ ∧ |w|_a = |w|_b\} $ Now I'm unsure about what the '*' indicates. Whether it means that either a or b can be repeated, or only one of them or if you can repeat a pattern made of a and b. An explanation would also be appreciated but I thought one or more examples of what wo...
While studying ALU I came across this example, now what's difference between operations of OR Gate and SUM(Adder), in binary language
In this cryptography scheme, we take $g$ and $p$ (a large prime number). and taking the customary clients Alice and Bob who chose $a$ and $b$ secretly whereas $p$ and $g$ are known in public. I haven't mentioned the other requirements taken into consideration for selection of these parameters. So here is how this works...
Working for my exam, this question popped up. Given the production rules below, draw a pushdown automaton to recognise the language it generates: S → AB A → BA B → BB B → T T → b Questions: 1. Since A has no empty transition, wouldn't this just end up in an infinite loop? 2. What order are the values entere...
Consider the following two snipets of code: If a >= 5: If b == 0: .... Else: .... Else if a <= 5: .... If a > 5: .... Else If a >= 5 and b == 0: .... Else If a >= 5: .... Then these two constructs are logically equivalent. I am interested if there algorithms that detects if two or more co...