instruction
stringlengths
35
29.1k
Suppose I have a video in which there are two objects $A$ and $B$. Object $A$ appears suddenly at time $Ta1$, and then disappears suddenly at time $Ta2$. Object $B$ appears suddenly at time $Tb1$, and then starts to fade gradually at time $Tb2$, and at $Tb3$ the object $B$ completely fades away. The background intensit...
If we take Solomonoff's prior $m$, defined here and normalize it we get a probability mass function on all finite words. But, the pmf isn't completely determined until we fix a universal Turing machine (UTM) $U$. Say $m_U$ is the normalized prior with respect to a UTM $U$. Is there a $U$ such that $m_U$ has maximum ent...
Obviously binary trees are great because of $O(\log_2 n)$ search, inserts, and deletes in best case. To "maximize" occurrence of best case, we can use self-balancing trees like red-black trees, AVLs, splay trees, etc. If we use a $k$-ary tree, we can get $O(\log_k n)$ searches, inserts, and deletes in best case. Simila...
Fix an alphabet $\Sigma$, and a set of words, $W = \{w_1,\dots,w_n\} \subseteq \Sigma^*$. I have a randomized model that works like this: Alice generates a random sequence of words, using some probability distribution over the words, and then I get to see their concatenation -- but I don't see where the word boundaries...
In RL, in a game situation, usually the agent is trained by playing against itself. When we should not depend on this self-training, and switch to train the agent with a real or different player agent other than the agent it self? I mean is there any characteristics of the environment that would make self-play worse c...
I have some questions about something that I'm working on in an assignment for my database class. Here is the schema for the questions I'm working on, so that you know what to refer to: Category(class, function, country, num_guns, max_altitude, max_fuel) Planes(pname, class, year) DogFights(dname, date) Outcomes(pname,...
I came across this paper which gives bounds on coupon colloector problem. Page 451 contains a table where reference to U1 is given as 'folklore'. I presume this is trivial to follow from the definition but I can't see the logic behind this. Does anyone have hints for me? I tried to get this bound by taking the limit of...
I'm wondering if there is a standard corpus that people use to evaluate their part-of-speech taggers. I am implementing my own tagger, and would like a meaningful way to measure its performance, which would ideally be against the same corpuses that other people are using.
Given an two sorted arrays X and Y, both of size n. Determine if there is an element x of X and an element y of Y such that x = 3y. The algorithm needs to run in linear time in the worst case. At the moment, the algorithm runs in O(n^2). I am unsure how to leverage the fact that the algorithm is sorted to have a scena...
I have the following problem, and I want to show that it is NP-hard (or NP-complete). Consider a clause which can have OR and XOR relationship between literals, e.g. $c_1=y_1 \lor y_2 \lor (y_3\oplus y_4)$. Will the assignment of literals such that the equation given by the conjunction of such clauses, e.g. $c_1\wedge ...
A zero-knowledge proof system for a language $L$ is an interactive proof system where a prover $P$ (a Turing machine) tries to convince a verifier $V$ (a polynomially bounded Turing machine) in a sequence of message exchanges that $x \in L$ so that $V$ learns nothing from the interaction except whether $x \in L$ or not...
I've recently read a really interesting blog entry from Google Research Blog talking about neural network. Basically they use this neural networks for solving various problems like image recognition. They use genetic algorithms to "evolve" the weights of the axons. So basically my idea is the following. If I was suppo...
The Computer Science text book I own describes how an interrupt is handled in an operating system: At some point at the end of an instruction the processor checks if there are any outstanding interrupts If there are, the priority of the present task is compared with the highest priority interrupt If there is a higher ...
I wrote a custom hash table for a project I'm working on. The core functionality was pretty simple rolling table: In each table there is a memory section for HashItemReference(integer SecondHash, integer ItemN) which is the actual table part and a list of HashItem(integer Value, string Key) Each HashItemReference woul...
I just had a course on algorithm, we just started to study graph traversal. the teacher wrote analgorithm but I think there is a mistake: I'm a bit shy so I didn't asked her why so... EXPLORE (s:sommet, D:dictionnary of the following vertexes or ahed of vertexes, var visited:tab) var: LIST:list; i,j: vertexes; visited[...
I'm new here, so I apologize if this is not the appropriate place to ask this question. I just started a graduate level course on approximate algorithms, and I am falling behind fast. The class is very theoretical and we are asked to prove approximation problems. We've covered traveling salesman problems, greedy algori...
I have a finite alphabet Σ and Σ* refers to the set of all finite strings over Σ. 1) Given x, y ∈ Σ* we say that x is a prefix of y if ∃z ∈ Σ* y = xz. If x is a prefix of y and y is a prefix of x what is the relationship between x and y? I'm assuming it is a direct relationship because as x goes up so does y, but I'm n...
Ok, lets assume we have sequence of 1000 bytes. So the possible number of value variations is 2^100. Is there a way to "index" each variation with letters and decimal numbers (A-Z, 0-9), having as shortest length as possible? So the person can dictate sequence of letters and numbers by phone and it can be recreated...
(7,4) Hamming Code (HC) detects all 2-bit errors and corrects all 1-bit errors. However, there can be 2-, 3- or 4-bit errors that come with the same parity bits as that of 1-bit errors. Eg.: Let the data be $1011$. So - the parity bits are $P_1=0$ $P_2=1$ $P_4=0$ , the message transmitted is $0110011$ and the messag...
I am studying Crypto and am trying to understand why discrete log creates is useful for creating a PRG. More specifically, I want to prove via reduction that $B(x)=(x<p/2)$ is a hardcore bit for the one-way function $f_{p,g}(x)=g^x \bmod p$. So far, I have shown that if there is a polynomial-time algorithm $D$ that co...
I have implemented N-grams by constructing a tree (or a trie, technically) that stores frequencies of each N-gram. Each path in the tree represents an N-gram and its frequency: the path consists of N nodes (each node containing a word), followed by a leaf node containing the frequency. So, each path in the tree is of l...
Problem: Given an undirected, weighted, complete graph $G = (V, E, w, c)$. $w$ is the time weight function on edges, $w:E \to \mathbb{N}^{+}$; $w(e)$ represents the time it takes to travel along edge $e$. $c$ is the time deadline function on vertices, $c:V \to \mathbb{N}^{+}$. Given a source vertex $s$, the question is...
int R(int n) { if(n<=1) return 1; else { int sum=0; for(int i=1;i<=n;i=i*2) for(j=1;j<=i;j=j*2){ sum=sum+i; sum=sum*R(n/2); } } return sum; } I try to explain T(1) = 1 T(2) = 2 T(4) = 6 T(8) = 36 T(16) = 360 T(32) = 5400 so, the gr...
I have written an in-place merge algorithm for forward iterators. My goal was to write an in-place merge algorithm to merge two sorted parts of a singly linked list without allocating extra memory to perform the merge. However, I have no clue how to determine its complexity. Here is the corresponding pseudocode algorit...
I was recently looking at the article on the P complexity class on Wikipedia. In the section on relationships to other classes, it mentions that P is known to be at least as large as L, giving this explanation: A decider using $O(\log n)$ space cannot use more than $2^{O(\log n)} = n^{O(1)}$ time. The article sadly f...
If $\mathbf{P} = \mathbf{NP}$, then is $\mathbf{L} = \mathbf{NL}$? I am asking this question because, for other non-deterministic classes, it seems $\mathbf{P} = \mathbf{NP}$ always establishes that they are equal to their deterministic counterparts.
Consider the non-regular language $L_1$ = {$a^n$b$a^n$: $n \geq 0$} and its super-set language L = Language of strings with equal number of trailing and leading a's, or in other words, $$L = \{a^n b w b a^n : n \ge 0, w \in \{a,b\}^*\} \cup \{a^n b a^n : n \ge 0\}.$$ How would we prove that L is also non-regular? I h...
Given a finite alphabet, there are well-specified formal languages that can not be recognized by regular expressions, FSAs or regular grammars True/False I am studying for my exam and I am unsure about this question. From my understanding, you generate formal languages from regex, FSA. For i.e. for a* our formal ...
If we have a computational function $f(x)=g(f(x-1)^2)$, where $g(y)$ is a floating point operation, mapped onto a given number of bits say 32 bits (thus leading to loss of a given number of precision bits every time), is the function a one-way function?
Can someone explain the working of the GHS algorithm using the graph given below. GHS is a distributed algorithm for finding the Minimum Spanning tree of a graph. The description of which can be found here https://en.wikipedia.org/wiki/Distributed_minimum_spanning_tree What I think is that the fragments(the nodes in a...
Knuth, Donald E. (1971), "Optimum binary search trees", Acta Informatica 1 (1): 14–25,doi:10.1007/BF00264289 Please have a look at this paper, specifically page 18 in which he tries to prove his lemma that $R_{0,n-1} \leq R_{0,n} $ here $R$ refers to the minimal optimal node which will be the root of the binary tree co...
From what I have found, a very large amount of protocols that travel over the internet are "text-based" rather than binary. The protocols in question include, but are not limited to HTTP, SMTP, FTP (I think this one is all text-based?), WHOIS, IRC. In fact, some of these protocols jump through some hoops whenever they ...
I am taking a course in algorithm analysis and the professor is arguing that using the negation of the definition for Big O, it can be argued that, for practical computing purposes, both the running time and the memory usage of every algorithm is O(1). How is this possible? How can it be proven?
I'm learning about paging. My book says that the logical addresses generated by the CPU are in the form |p|d|(page number, page offset) and the physical addresses are in the form |f|d|(frame number, frame offset). It is also specifically mentioned that d i.e. the offset is copied directly to generate the physical addre...
Here i want to discuss about Linear Voronoi game. The game consists of two players, and a finite set of users placed along a line. Each player has 2m facilities, where m>0 is a fixed integer. The game starts by the first player, placing 2 facilities on the line, followed by which the second player places 2 facilities...
We usually see examples of languages contained in $P^A$ for some language $A$, or cases where $P^A=P^B$ (or $P^A\subseteq P^B$) for two languages $P^A$ and $P^B$. However, there is any explicit example of two languages $A$ and $B$ such that $P^A\not\subseteq P^B$ and $P^A\not\supseteq P^B$? I was thinking in something ...
The following theorem is (in the context of languages) known as Arden's Lemma: Given a linear system $X = B+AX$ and the matrix A is quasiregular, then we have a solution which is unique and which preserves rationality. In the next lemma we show the converse: For every rational series we can find a linear syste...
I know that we can have 0 accepting states in a DFA, it would just recognize the empty language. What about the case of all states being accepting? Would that mean it would recognize all of the strings in the DFA's particular alphabet? Thanks
Given a set of irregular polygons with the same number of points, where $polygon_i$ is completely contained within the boundary of $polygon_{(i+1)} $. I need to find a set of vertices (one vertex from each polygon) such that the pairwise distances between all of the points selected are maximized. What kind of algorithm...
I'm stumped on what exactly to search for; so here is a non-scientists description of the topic. I've got multiple sensors of different types that are measuring the same physical value in different ways. The sensors are all subject to significant error or temporary unavailability, but in greatly different ways. I want ...
I designed this transition graph, seen below. The alphabet contains {a, b, c}, and the goal of this machine is to accept any strings (no limitations on length of string) that ends with a letter that is already in that string. Example: abba, aaa, bb, ababababacc, cabc are accepted. Example: abc, bccba, a, b, c, cccab,...
So I was able to show that: $\log(n!) = O(n\log n)$ without any problems. My question is when trying to prove that $\log (n!) = \Omega(n\log n)$. I was able to show that: $$\begin{align*} \log n! &= \log(1 \cdot 2 \cdot 3 \cdots n )\\ &= \log 1 + \log2 + \log3 + \dots + \log n \\ &= \log 1 + \dots + \log\tfrac{n}...
In this essay (and others) by Djikstra, he refers to "formal techniques" a number of times. ... for the computing scientist, formal techniques would play a much more important rôle than they had done so far for the mathematician. ... The practical reason was that formal techniques are indispensable for dealing in a su...
I am trying to find a way to compare two real numbers (actually floating-point) with a tolerance, i.e. test $|r-s|\le\epsilon$. Without loss of generality, $\epsilon=1$. I want to do this by replacing the numbers by a discrete key computed on them in such a way that when two keys differ, they map two significantly dist...
I am reading the paper Measuring the hardness of SAT instances by Ansótegui, Bonet, Levy and Manyà (Proc. 23rd AAAI Conf. on AI, pp. 222–228, 2008) (PDF) and I would like to know what the square symbol in the following means Lemma 3 The space satisfies the following three properties: $s(\Gamma \cup \{\Box\})$ = 0 For...
Take for example the following sentence: Computing a hash for a message is "easy"; retrieving the message from the hash is "hard". Intuitively, I can perfectly understand what's written there. But, in mathematical terms, when is a problem considered hard and when is it considered easy? I know that easy/hard should no...
I'm totally new to DFA's and automata in general – this is the first week or two of class that I've actually seen this – and I'm curious as to a pattern to match the following: "Match the set of all strings on the alphabet $\{a, b\}$ that have at most two $b$'s and 1 or more $a$'s."
The problem is to select the minimum number of nodes from a graph such that, the selected nodes and their neighbors consists of all the nodes of the graph. Any straight forward algorithm for this? Repeatedly selecting the node with highest degree centrality doesn't work. Thank you.
I'm trying to find out how many circuits exist in a graph $G$, given its adjacency matrix. Yet, the only thing I know is how to find out if there is a circuit in a graph $G(X,U)$ given a list of out-neighbours for each vertex. To do that, you just delete every vertex with no out-neighbours, and update the adjacency li...
According to CLRS, When the edges of the graph are static—not changing over time—we can compute the connected components faster by using depth-first search. However, I tried to do some runtime analysis, and in a graph $G(V, E)$ on which we have to answer $Q$ connectivity queries. DFS would take $O(V+E)$ asymptotic ...
I know that, in imperative programming languages, a while-do loop is sufficient as a control flow construct to make the language Turing-complete (as far as control flow goes - of course we also need unbounded memory and certain operators...). The gist of my question is: does a do-while loop have the same computational ...
From what I understood, the Active Shape Model (ASM) is used in facial recognition. I figured out how the ASM works but I don't get why we use it. How this shape is suppose to be interpreted for facial recognition? Should it be compared directly to the database? I have read many research papers about ASM and facial rec...
I was given in a lecture the following algorithm that wwas said to be a graph-traversal algorithm. The algorithm given during the lecture The algorithm EXPLORE (s:sommet, D:list of the following vertices of the vertices ahead, var visited:tab) var: LIST:list; i,j: vertexes; visited[s]←_true_; LIST←{s} While LISTE ≠ ...
I am reading the paper Measuring the hardness of SAT instances by Ansótegui, Bonet, Levy and Manyà (Proc. 23rd AAAI Conf. on AI, pp. 222–228, 2008) (PDF).I have two questions the first one is I would like to undersatnd the demonstration for the last claim. Specifically I need an example of the proof tree of $[x\rightar...
This might seem very simple but it's been giving me lots of headaches. For example if I run f(12345) the result is 5310135. I understand why it would return 5310, the rest of 135 is what is giving me troubles. Sorry if the question sounds dumb, I am a newbie seeking for help:). function f (integer n) { print n%10; ...
I have a matrix of logicals (TRUE, FALSE) and I need to count the number of rows that contain only TRUE values. My current algorithm: For every row: initialize counter reduce each col by + (take the sum of all the values in that row) if the result from 1. == the number of total columns, increment counter. Is there a ...
I need to extract all tree-like refutations of this formula $$(a+b)(a+ b')(a'+c)(a'+c')\,.$$ I get understand this one but how do I get the other ones?
I have something of this kind: $$(n-1) d m + m + 2m*v+2v^2 + v$$ Where all n,d,m,v are variables. My little knowledge of computational complexity leads to do this kind of approximation: $$ O( (n-1) d m + mv + v^2 )$$ However I feel I could further simplify into $$ O( n d m + mv + v^2 )$$ and $$ O( n d m + v^2 )$$ hence...
Is 17x+11 a function of O(x^2)? My steps so far: 17x+11 < c.x^2 where x>k 17x+11/x^2 < C Im not too sure what to do next so I'd really appreciate if it someone could guide me. This question was not answered. The link that was provided exceeds what we have to know to solve this problem.
I am confused in finding RAW dependencies whether we have to find only in adjacent instructions or non-adjacent also. consider the following assembly code I1: ADD R1 , R2, R2; I2: ADD R3, R2, R1; I3: SUB R4, R1 , R5; I4: ADD R3, R3, R4; FIND THE NUMBER OF READ AFTER WRITE(RAW) DEPENDENCIES IN THE Above Code. I am get...
I am stuck on trying to understand how to solve the following question. Could someone please explain for a beginner to average-case analysis? Considering the following algorithm A which takes as input a bit string b = b_1, b_2, ... , b_n (each b_i is either 0 or 1) and does the following: A(b,n) k = 0 FOR i = 1 TO n DO...
Given a $n \times m$ grid $G$, with each grid square having a value 0 or 1, find a rectangle $R$ in $G$ that maximizes $R_1 - R_0$, where $R_0,R_1$ are defined as follows: $R_0$ = the total number of 0's in $R$ $R_1$ = the total number of 1's in $R$ The brute force solution is to compute the value $(R_1 - R_0)$ for ...
. Imagine two disks on the xy plane. Each disk is represented by three numbers (the radius, the x coordinate of the center and the y coordinate of the center). All values for this problem are real numbers. Your task is to determine if the two disks intersect.
I want to do image segmentation. In (Li, C. et al, 2011) article about A Level Set Method for Image Segmentation I saw that the authors use bias field estimation. I searched a lot but I couldn't understand the meaning of bias field...What is the appropriate mean of bias field?
Consider the following algorithmic task: Input: a positive integer $n$, along with its prime factorization Find: positive integers $x,y,z$ that minimize $xy+yz+xz$, subject to the restriction that $xyz=n$ What is the complexity of this problem? Is there a polynomial-time algorithm? Is it NP-hard? This problem basica...
Say I have the interprocedural control flow graph (ICFG) of a program. Now I am only interested in the control flow between two functions f1 and f2. What is the most straight-forward way to remove the non-relevant part of the ICFG? Is there a standard performance-optimized algorithm for this task? Does the result, tha...
Does this Turing Machine decide language of polynomials with integer coefficients which have integer roots: The input represents a polynomial over variables x1, . . . , xn with integer coefficients. 1. Examine all possible integer values of x1, . . . , xn. 2. Evaluate the polynomial on all of them. 3. If any of them ev...
Background: I worked on finding the maximum path from the top to the bottom of a tree-like graph. During the process I found that the algorithm for finding the maximum path from the top to bottom of a binary tree also worked for my graph. My problem arose when trying to name the program, because the graph it works on i...
If we expanded the alphabet Sigma = { 0, 1, u, > } to Sigma' = { 0, 1, 2, u, > }. How would the table change? We're just learning about Turing Machines in class and I'm a bit confused. Is the table in the picture calculated in some way?
I'm working on my graduation project for CS, which is about cellular automata. Recently, i was able to build a system where the input is transferred to multiple different structures at once. The input consists of numbers, a sequence of numbers ranges from (-infnite to infinite), like ('5','65443'or'9921075'). From the...
An admissible heuristic never overestimates the cost to reach the goal. However, isn't that only the relative difference between heuristics for two different paths matter? Say we have optimal path A (cost 100 to reach goal) and sub-optimal path Z (cost 120 to reach goal). Even if the heuristic is admissible, say it gi...
When wolfram described Elementary Cellular Automata, most of the rules appeared as triangle and lines. Now, Rule 110 consists of triangles which is proved to be universal. Is there a relation between these triangles and universality like rule 110, or even other geometric shapes can be related to universality?
I would like to know your book recommendations / popular books to learn how computers perform operations, store memory, process your mouse input to open a program for example (maybe not that complicated) at transistor / logic gate level
It took me about a week to understand how does it works, but still, I'm wondering if it actually works! I. The algorithm EXPLORE EXPLORE (S:sommet, D:following vertices of vertex X, visited:TAB) var LIST; i,j:vertices visited[S] ←true; LIST ←{S}; WHILE LIST ≠ 0 selectionner i ∈ LIST IF ∃ j ∈ D[i] , not visited[...
I need an advice. There is in section "V. CONCLUDING REMARKS" of the paper [1], a term that only the autho's paper use: "PREFIX CODING COMMUNICATION". I googled the expression and the only result is the same paper [1]. It's difficult for a beginner in communication complexity to understand what the author is talking ab...
I am looking for bounds - both lower and upper - on the time and spacial complexity of simulating Turing-complete systems with each other. (I am aware that both time and space are ill-defined with many systems. However, I do not know of a better way of describing them.)
I'm trying to figure out what the smallest positive integer x such that the floating point expression round(round(1/x)*x) is not equal to 1 in single precision. I have that the answer is 41, but when I let the number 3 for example be x, isn't 1/3 = 0.333, and when rounded = 0, 0 * 3 = 0? So why is the answer 41?
First of all, this question relates to an issue that affects several areas of science, but since StackExchange doesn't have a meta science section I'll make it specific to computer science, which is pertinent because the solution to the bigger problem may actually come from computer science. In the context of the news ...
I need to find a DFA for this language: L = { $ \omega = xy \in (a,b)^*\mid |x|_a = |y|_b $ }
I am looking for bounds - both lower and upper - on the time, spacial, and state/symbol (i.e. number of states and symbols required) complexity of simulating the (untyped) λ-calculus with a queue machine (roughly speaking, a pushdown automaton with the stack replaced by a (n unbounded) queue). It is easy to emulate a t...
I am reading the paper Measuring the hardness of SAT instances by Ansótegui, Bonet, Levy and Manyà (Proc. 23rd AAAI Conf. on AI, pp. 222–228, 2008) (PDF). I am trying to understand the demonstration of the last part of the Lemma 3 (in bold). For this, I get an example. Let be $\Gamma = (a+b)(a+b')(a'+c)(a'+c')$ then it...
I have a set $E$ which is the set of all possible $d$-tuples ($d$-dimensional vectors) of integers between $1$ and $n$. Typically $d=3$ and $n\approx1000$, but for the sake of making a small example, suppose $d = 2$ and $n = 4$, so $$E = \{(1,1),(1,2),(1,3),(1,4),(2,1),(2,2),(2,3),(2,4),(3,1),(3,2),(3,3),(3,4),(4,1),(4...
Church-Turing thesis : Every effectively calculable function is a TM-computable function. But, hypercomputation models are strictly more powerful than TM and can solve TM-uncomputable problems on the paper. Does this imply that, for one who believes in the Church-Turing thesis, there is only two options : There is two...
I am working on a project in which I am supposed to come up with a system that detects fraud from a credit card transaction. I read about techniques that others have used and decided to use Artificial Neural Networks for their adaptability. WHAT THE SYSTEM MUST DO My system is supposed to detect fraud on a credit card ...
The problem that I'm trying to solve (well, I think that I almost did, but need a review from someone more experienced) is about changing probability of the transition for semi-Markov state machine during simulation. Let's assume that M=<S,T> defines machine with S states and T probabilistic transitions between states....
Does anyone know of an algorithm to generate a set of numbers of size $N$ which are all co-prime to eachother? Ideally I'm looking for something that has random access abilities so i could ask for the 100th item in the set without having to first calculate items 0 to 99. Also, I would like to be able to specify a minim...
I'm reading CLRS Section 33.4 Finding the closest pair of points. At exercise 33.4-2 they say 33.4-2 Show that it actually suffices to check only the points in the 5 array positions following each point in the array Y' But I'm getting 4 array positions following each point in the array Y' will be suffice to check. S...
Consider the following algorithmic task: Given: primes $p_1,\dots,p_k$, and positive integers $e_1,\dots,e_k$, and a positive integer $M$ Find: integers $d_1,\dots,d_k$ that maximize $\prod_i p_i^{d_i}$, subject to the requirements that $0 \le d_i \le e_i$ and $\prod_i p_i^{d_i} \le M$. What is the complexity of this p...
The well-known algorithm for computing the $k$-th largest element in an unsorted array of size $n$ runs in $O(n)$ time. How about for a range $[k, k+c]$, where $c$ is not necessarily independent of $n, k$? The obvious "brute-force" algorithm is to find the $k$th largest using the original $O(n)$-time algorithm, then t...
I was converting a DFA to regular expression with the help of state equations and came up with this regular expression. How do I further reduce this regular expression? $$b+aaa^*b+abb^*+a$$ I can feel it's same as $$a^*b+ab^*$$ but how do I proceed to simplify the first one to the second mathematically?
Consider the language $$L = \{1^i 0^j 1^k \mid i + j = 2k, k ≥ 1\}\,,$$ and let $x_n$ be the canonical $n$'th word in $L$. My problem involves proving that the Kolmogorov complexity of $x_n$ can be bounded by $$K(x_n) \leq c + 2\log_2 |x_n|$$ for some constant $c$. My ideas : (please note that I'm not writing this in a...
I'm currently studying compiler construction book "Compilers Principles, Techniques, and Tools (2nd Edition)" , in page unit 3.1 , page 113 , example 3.2 . i cannot understand what is this kind of method ? E = m * 2; conversion to token types(this method) below <id , E> <op=> <id , m> <op*> <number , 2> <op;> it is...
I need to find a grammar that generates the language composed by all words that have more $a$ than $b$ given an alphabet $\{a,b\}$ I tried the following production rules: S->B B->b | ABB | BAB | BAB | BBA A->a with this rules it's fairly simple to proof that all the words that the grammar generates are made up with mo...
The language is $\{w \mid \text{$w$ is any string except $11$ and $111$}\}$ where the alphabet is $\{0,1\}$. Drawing the DFA recognizing $\{v \mid \text{$v$ is either $11$ or $111$}\}$, then switching the accept and non-accept states, and finally examining this resulting structure, I thought of it as being: $(ϵ∪0Σ^*∪1∪...
High-order pattern matching is an undecidable problem. That means there is no algorithm that, given an equation a => b, where a and b are open terms on the simply typed lambda calculus, finds a substitution S such that aS => bS, where => stands for "has the same Bn normal form". Yet, humans can solve that problem effic...
So for my homework, I was supposed to design an algorithm which was divide-and-conquer that fulfilled the task of finding the two smallest numbers in an array of size n. I recognize that my version is a bit cheap in that regard, in that it uses reference variables and only does work on the size 1 cases of the recursio...
I want a low-level understanding of how a pixel is displayed on a monitor. I am guessing that the point at which I want to display a pixel must be modified in the frame buffer, which should be sent as a signal to the monitor. But, on low level, how do I find out what part of memory represents the frame buffer? I also g...
See the interactive example here. First-fit on the left, optimal on the right. I know that in general, optimal bin-packing is NP-hard, so I'm not looking for a perfect solution. I'm looking for the lowest cost improvement over the current solution. The problem is the one most of the web pages on the internet have: How...
Draw recursion trees and use them to find big theta bounds on the solutions to the following recurrences. For each, assume that T(1) = 1 and that n is a power of the appropriate integer. ex) T(n) = 8T(n-2) + n There are multiple equations that I have to do with the above directions. I am lost on finding big theta bound...
If we have a finite chess board and two figures x and y. Is it possible to get y from x by following chess rules and when white is y and white starts from y placement. Is this decidable? My reasoning is, that we have a finite sets of moves and since all finite languages are decidable and at some point x is going to g...