instruction stringlengths 35 29.1k |
|---|
The Church-Rosser Theorem [0] states that the Lambda Calculus (LC) is
confluent: between a source expression S and target expression T, the
latter in normal form, for any given P, a sequence of permissible
reductions that begins with S, there is some subsequent sequence of
reductions Q (possibly the empty sequence) tha... |
monitor DiningPhilosophers
{
enum {THINKING, HUNGRY, EATING} state[5];
condition self[5];
void pickup(int i) {
state[i] = HUNGRY;
test(i);
if (state[i] != EATING)
self[i].wait();
}
void putdown(int i) {
state[i] = THINKING;
test((i + 4) % 5);
test((i + 1) % 5);
}
void test(int i) {
if ((state[(i + ... |
Let's say I have a optimization problem P1, where the constraints are linear but the objective function is not. Let's say I have another optimization problem which is linear in constraints and linear in the objective function.
The goal of the problem is to show that if P1 has a bounded optimum value then P2 has the sam... |
(larger context at the end)
My view of the problem
I have an undirected graph whose nodes can be categorized into three classes depending on some metadata (I have a function that can tell me the class of a node in constant time), let's name the classes $A$, $B$ and $C$.
I want to find an $A$ node and a $C$ node such th... |
I've heard it said that "fortran uses column-major ordering because it's faster" but I'm not sure that's true. Certainly, matching column-major data to a column-major implementation will outperform a mixed setup, but I'm curious if there's any absolute reason to prefer row- or column-major ordering. To illustrate the i... |
I have a question : is the term front-end in this context phpmyadmin is frontend for mysql slang is it taught in academy in this context I don't want to use slang term
|
Are there any problems which are known to be both NP-complete and EXPTIME-compelte? My guess is no, because we know that $P$ is not equal to $EXPTIME$ and EXPTIME-complete problems are not in $P$, and hence a problem that was both NP-complete and EXPTIME-complete would imply $P \not= NP$. Is my thinking correct?
Note... |
Task
Build the Parse Table
Let $\mathcal{G}$ be the following context-free grammar:
$$
\begin{aligned}
E &\to TE' \\ E' &\to +TE'\; |\; \epsilon \\ T &\to F T' \; \\
T' &\to *FT'|\;\;\epsilon \\F &\to (E)\; | \;id \\
\end{aligned}
$$
I calculated $ FIRST $ and $ FOLLOW $ sets
\begin{aligned}
FIRST(F) = FIRST(T) = FI... |
I am reading a book about data architecture, and I am wondering about the text segment and the memory adresses.
In one example(assembly using ARM) where the code was compiled there were adresses to global variables. Does this mean that the executable is always loaded in the same place in the text segment?, so that the ... |
Let A[1...n] be an array of n distinct numbers. The ordering of the numbers is any permutation of [1,2,...,n]. An array Inv_A is defined as follows: Inv_A[i] = number of elements A[j] such that j<i and A[j] > A[i]. Give an optimal algorithm that computes the above array Inv_A. For example if A = [3,1,4,5,2] then Inv_A ... |
Given the following:
A set of input types $I$ = {a, b, d, ...}
A set of functions $F$ (With associated costs, and possibly identical signatures) = {($c_1$, a -> d), ($c_2$, (a,b) -> e), ($c_3$, e -> (d,f)), ...}
A set of desired output types $O$ = {f, g, h, ...}
I would like to build a system that can return the lowe... |
While studying Shannon's notion of perfect secrecy I came upon the idea that a bit is perfectly random if it happens to be 0 or 1 with an equal probability. What does this mean? Also, what can we say about the determinism here?
|
Given a set of nodes $N$ on an undirected, weighted graph $G$ and a query node $n$, what is the fastest algorithm for finding the node in $N$ that is closest to $n$?
Furthermore, say we are doing many of these queries, so have many $n$'s, is there some data structure that could speed up this computation?
Thank you for ... |
Given two strings ABC and CBA, find A, B and C.
Input:
abcacab, cabcaab
Output:
ab, ca, cab
The time complexity of brute force is O(n^3). Are there any better algorithms to solve this problem? Thanks!
|
My algorithm homework revolves around matching 4 "O"'s or 4 "X"'s on a diagonal, horizontal, or vertical. Hopefully that makes sense...
This is what the data looks like below (2D tuples) where I need to recreate a function that returns "O" or "X" or False depending on what is found.
xwins = ((None, None, None, None, No... |
I was reading the proof of time-complexity for the Edmonds-Karp algorithm here (https://brilliant.org/wiki/edmonds-karp-algorithm/).
Everything in the first part of the proof (The section Monotonically increasing path length) makes sense. However, the last part of it is not very convincing (the part I have highlighted ... |
Let's say we want to find the smallest positive integer x for which some property A holds. We know that such an integer exists. However, we have no knowledge about the scale of x (i.e. x could be 7 or 5'142 or 17 Quadrillion or whatever).
We have a function f that returns true when evaluated at values larger or equal t... |
Suppose I have a Turing machine that takes as input any string of length $n$, where $n$ is odd, and the Turing machine returns the middle character of the string.
What time complexity class is this in? Is it in $O(n)$ because the tape head must scan $n/2$ places to the right, counting as it goes, or is there a quicker... |
I want to know the major methods to prove the correctness of a program/algorithm. Recommendations on books are appreciated too. This is a general question. TIA.
Edit: I'm not looking to detailed answer of each and every method. Instead, solicit recommendations/topics to start reading up my own. Name-dropping of methods... |
I want to solve a problem of object tracking along time. The problem is - I have a sequence of images, and I need to find and track the creation of the objects, than their movement, and than their disappearance. There can be up to 3 objects overall, and sometimes there are less, or none. Another limitation is that for ... |
The MIU system, famous from Douglas Hofstadter, is a semi-thue system with the following rules:
Xi → Xiu
mX → mXX
XiiiY → XuY
XuuY → XY
and a start axiom "mi"
I have tried to find a formal grammar that generates all words that can be derived from the semi-thue system, but did not succeed. Is there a canonical way to co... |
I am looking for elementary cellular automata rules and initial conditions that give rise to interesting cycles (Cyclic boundary conditions, such that the leftmost entry is the neighbour of the rightmost entry).
After running a rule with some starting state, the state of the CA might (will?) start repeating in "cycles"... |
I'm doing an exercise about the MIPS pipeline with the following characteristics:
-Branches and Branch targets are calculated in the E-stage.
-There is forward logic from the output to the input of the E-stage.
-You can read an operand from the register file only the cycle after it has been written to it.
The task is t... |
I don’t understand this state diagram. What if $n=0$? Then our input string is the empty string. We begin at $q_1$, push \$ onto the string, move to $q_2$ but then fail. So the language recognized by this PDA is $n \geq 1$. If, however, we change the label on the vertical arrow to $\varepsilon, \varepsilon \rightarrow... |
For now, assume that P != NP. Is there a "complete" class of problems between P and NP-hard, and if so, what is it called? The two key words here are
between
complete
By between, I mean that it runs in super-polynomial time (not in P), but sub-exponential time (NP-hard is believed to take exponential time or greater)... |
I have been trying to solve questions like this before but I have stumbled in difficulty to track the the space of the cache.
so there is an example of a question like this:
Given the code:
int A[1024,1024],B[1024,1024],C[1024,1024]
for(int i=0;i<1024;i++){
for(int j=0;j<1024;j++){
for(int k=0;k<1024;k++... |
I have one LP problem (LP1) to solve, where a term in a constraint is to be substituted after solving another LP problem (LP2) (with a different variable vector). Suppose I call the dimension of the variable vector in LP1 as $n$ and in LP2 as $m$. I know that the complexity of solving an LP problem is $O(n^3L)$ ($L$ is... |
I am currently reading up about esoteric programming languages and came across a COS theory question stated as follows:
Esoteric programming languages can be categorised in a variety of different ways. For each of the
following categories identify one advantage and one disadvantage associated with languages falling
wi... |
Given vectors $A, B \in \mathbb{R}^{n}$, $w \in [0,1]$ and $x \in \mathbb{R}$, let
$$
Rank(A,B,w,x)=\sum_{i=1}^{n} \boldsymbol 1 \{w A_{i} +(1-w) B_{i} < x\}
$$
denote the number of elements in the $w$-weighted convex combination of $A$ and $B$ that are smaller than $x$. I would like to compute $Rank(A,B,w,x)$ for diff... |
Given two players $A, B$ and some natural number $n \ge 2$, let $\#(A,B,n)$ denote the following algorithm:
$A$ thinks of some number $a \in \{1,\ldots,n\}$
Until the game ends:
$B$ thinks of some number $b \in \{1,\ldots,n\}$
$B$ tells $b$ to $A$
If $a = b$ then the game ends
Is there a way to represent this algor... |
The complete question is as follows:
An edge of a flow network is called critical if decreasing the
capacity of this edge results in a decrease in the maximum flow. Give
an efficient algorithm that finds a critical edge in a network.
I believe some variation of Ford-Fulkerson would have to be used over here, however ... |
I have searched around for some time but couldn't find a similar example to my problem.
It looks common enough that I would expect it to be solved. It lies between search and optimization/regression.
The goal is to find a range of values for each feature, so that the subset of rows where every feature falls in the corr... |
Suppose that you were writing down the syntax rules for something like C++ as a context-free grammar in Backus–Naur Normal Form
How can you distinguish between the pipe character as symbol in C++ or as a Backus–Naur symbol?
Equivalently, how would you tell whether the | character represented a meta-logical operator or ... |
Suppose that you were reading some production rules for a context-free grammar in Backus–Naur Normal Form
What does the asterisk (*) mean?
In the example below, what is the difference between <fun-def*> and <fun-def>?
<program> ::= <fun-def*> int main(void) { <block> }
<block> ::= { <var-def*> <statement*> }
<fun-def... |
I'm really having rough time understanding the time complexities of nested loops. So, please help me out in this code. The code is on sliding window with changing length:
def smallest_subarray_sum(s, arr):
window_sum = 0
min_length = math.inf
window_start = 0
for window_end in range(0, len(arr)):
... |
Let $k,n \in \mathbb{N} $ and non empty sets $X_1, X_2, \dots, X_n \subseteq \{1,2,\dots,k\}$.
Define the change counting cost function $f: X_1 \times X_2 \times \dots \times X_n \to \mathbb{N}$ by $f(x_1, x_2, \dots, x_n) = \sum_{i=2}^n\delta(i)$
where $\delta(i) = 1$ if $x_i \neq x_{i-1}$ and otherwise $0$
How can we... |
In any given year,a male automobile insurance policyholder make a claim with probability $p_m$ and a female automobile insurance policy holder will make a claim with a probability $p_f$ where $p_f \not= p_m$.
The fraction of the automobile insurance policyholders that are male is $\alpha, 0 < \alpha < 1. $ A automobil... |
Given an optimization problem $P$, if we know that this optimization problem is NP-hard, is it necessary to check the complexity of the corresponding feasibility problem, i.e. the complexity of checking if the problem admits a feasible solution? Because in the case of $P$ the problem is not always feasible.
|
Assuming we are observing an algorithm.I am confused as to how one needs to proof correctness.
What exactly the correctness represent for a given algorithm?
And why do we have to proof correctness, in case, correctness itself describes or points out that the algorithm does exactly what we want it to do. Basically the w... |
(from 'An Introduction to Formal Languages and Automata' by Peter Linz)
What I do not understand, is why we have done our best to make sure that the condition (8.2) holds. Why is this restriction important/useful?
|
Suppose given two $n$ bits numbers $A$ and $B$. Also suppose there is a machine that compute multiply two $\sqrt{n}$ bits numbers in $O(1)$. What is time complexity of multiplying two $n$ bits number in a such case?
I think we can use divide and conquer Karatsuba algorithm
such that our recursion tree will has heigh... |
In one of my lessons about turing machines I have been taught that the function g is not computable:
\begin{cases}g(n)=f_{n}(n)+1 & \text { if } f_{n}(n) \text { is defined } \\ g(n)=1 & \text { if } f_{n}(n) \text { is undefined }\end{cases}
Proof:
If $g$ is computable, then it can be computed by some Turing machine.... |
I understand that total inversion in a sequence is the number of swaps that need to be done, to sort the sequence. And the best approach to solve this problem is to count swaps in a merge sort of the sequence.
Now I can think of another problem whose application I need. Imagine I have two unsorted sequences with permut... |
I'm trying to understand whether integers are an abstract data type.
The Wikipedia article starts out by saying that integers are not an ADT:
In practice, many common data types are not ADTs, as the abstraction
is not perfect, and users must be aware of issues like arithmetic
overflow that are due to the representatio... |
(Note: cross-listed on stack overflow: https://stackoverflow.com/questions/73362856/looking-for-name-of-a-priority-queue-data-structure-based-on-bit-boundary-bucket)
I'm looking for the name of a data structure. I came up with this idea but suspect it should already be known, and don't know what to search to find it.
T... |
I'm writing a DFA minimizer using Hopcroft's algorithm. While testing some regular expressions, I came out with an issue in the algorithm's output relative to two particular regular expressions:
a(b|c)*
a(b|c*)
P.S.: the assumption is that both regular expressions are valid, but if that's not the case please let me k... |
Schaefer proved that deciding even cycles cover ( 2-factor with even cycles) in cubic graphs is NP-complete. I am interested in the complexity of odd cycles cover in cubic graphs.
Is it NP-complete? Is it polynomial time solvable?
P.S. Cycle cover is a set of vertex disjoint cycles that cover all nodes such that each ... |
In this question it is stated that a CRC detects burst errors of length greater than the CRC length with probability $1-2^{-r}$, where $r$ is the length of the CRC.
Why is there no dependence on the length of the burst?
|
Consider an algorithm $f(x)$.
Are there formal systems or programming languages that only allow $f(x)$ to be defined if $f^-1(x)$ exists?
|
I am struggling to wrap my head around this compiler technique, so let's say here's my factorial function
def factorial(value: int) -> int:
if value == 0:
return 1
else:
return factorial(value-1) * value
It is recursive, but not TCO friendly yet, so, as the theory goes, the first thing to try h... |
I am bit confused while reading a standard textbook of my curriculum, where it is mention time complexity for knapsack problem is O(nlogn), and rationale they provided is we need O(n) to calculate (value/weight) value for each weight provided and next we need to sort it using O(nlogn) using any standard sorting algorit... |
Let $a_i$, $b_i$, etc., be a literal, i.e., a variable or the negation of a variable.
3-SAT concerns formulas in CNF form: $(a_1 \vee a_2 \vee a_3) \wedge \dots \wedge (b_1 \vee b_2 \vee b_3)$ (3-CNF). The problem of whether or not such a formula has an assignment of its Boolean variables such that it evaluates to $1$... |
We are given $k$ segments $(s_1,e_1),(s_2,e_2),(s_3,e_4),...,(s_k,e_k)$ where $s_i\le e_i$.
Now we are given a query interval $[L,R]$ to find the largest segment $(s_i,e_i)$ contained within $[L,R]$.
By the term largest we mean among all the segments contained within $[L,R]$ return the one whose $e_i-s_i$ is maximum.
A... |
Exam Question:
A five-stage pipeline has stage delays of 150,120,150,160 and 140 nanoseconds. The registers that are used between the pipeline stages have a delay of 5 nanoseconds each.
The total time to execute 100 independent instructions on this pipeline, assuming there are no pipeline stalls, is _______ nanoseconds... |
I have a 3D scan of an object with multiple faces, for example a standard 6 face die. The scan is a point cloud file of the die.
I am able to convert the point cloud into a mesh and retrieve faces from the mesh.
But what I'm not able to figure out is how to smooth the faces so instead of having thousands of faces I end... |
It is well known that classical regexes recognize exactly regular languages. But in practice, many programming languages have extensions to the regex syntax which potentially broaden the field of recognized languages. (For example, recursive regexes, lookarounds, ...)
Are there any papers or is there literature that ex... |
I want to optimally assign $m$ jobs equally to $n$ workers, where $m>n$. Assume $m = an$ for some integer $a$, so that each worker must get exactly $a$ jobs. (The rectangular linear assignment problem, as defined here). I know this can be done by duplicating the workers to have $a$ copies of each, and then solving usin... |
I am asking this question because for some reason ascii codes from range 128 - 255 have a size of 2 bytes but their composition is 8 bits which makes them a "byte". So I am confused as to why this certain ranges have 2 bytes when all of them only consist of 8 bits for example :
127 → 01111111 (1 byte)
>>> len(chr(127).... |
Just a fun puzzle that occurred to me. Given the function below which converts decimal integers to binary strings, is it possible to predict which decimal numbers will lead to binary strings with no zeros?
I.e. is there a way to ensure this function only returns strings of 1s without building the string and checking?
s... |
A sequence of positive real numbers S1, S2, S3, …, SN is called a superincreasing sequence if every element of the sequence is greater than the sum of all the previous elements in the sequence. E.g: 1, 3, 6, 13, 27, 52.
Given a sorted list A, I want to iterate over all combinations of A, which are superincreasing.
How ... |
I am preparing a list of algorithms for which big theta expression for (worst case) runtime is not known. This is for a class to demonstrate the point that tight analysis of an algorithm may not be easy at times. I am interested practically useful and hopefully simple (not required though) algorithms - importantly the ... |
In my problem of interest I have an arbitrary, finite set $S \subset \mathbb{Z}^3$. And I would like to cover $S$ with a set $C \subset \{T | T \subset \mathbb{Z}^3 \textrm{ is an axis-aligned cube of size } \ell\}$ of minimal cardinality.
I know there exist approximation algorithms with logarithmic-ish approximation f... |
Suppose I have L bits. First, I want to multiply the L bits with L orthogonal codes of length N, and then I want to add all the vectors.
So, first, I have to do a scalar multiplication with a vector and then an addition. Please refer to the figure for more clarity.
What will be the Computational Complexity (in terms o... |
Entries need to be stored in a database. There is Insert(entry) RPC, which adds a new entry in a database, and Delete(entry) RPC, which deletes an existing entry from a database. Neither RPC can be blocking, because that adds undesired latency. Both RPCs are scheduled to run asynchronously when required, from different... |
In almost all websites and papers, the complexity of LP problem is given in the number of iterations (such as https://or.stackexchange.com/a/5924). I was wondering if there are any references where worst-case "time" complexity is discussed. Like, the time to solve LP problem is bounded above by...?
|
While doing the exercise about questions about transforming NPDA to CFG, I encountered the following question:
Find a CFG for the following NPDA $M = (\{q_0, q_1\}, \{a, b\}, \{A, z\}, \delta, q_0, z, \{q_1\})$, with transitions:
$$
\begin{align}
\delta(q_0, a, z) &= \{(q_0, Az)\} \\
\delta(q_0, b, A) &= \{(q_0, AA)\} ... |
One of the most compelling arguments people cite for believing $P \ne NP$ is that there are many problems of both theoretical and practical significance for which an efficient solution has eluded many intelligent people's concerted efforts for a very long period of time.
The strength of this argument seems to depend on... |
Given computable function $f : LispTerm \rightarrow LispTerm$ is it possible to implement it in Lisp?
The $LispTerm$ is any term that is constructed using cons, nil and set-car!, set-cdr! (because it can be cyclic).
Of course Lisp is Turing-Complete, but that does not immediately imply an answer because Lisp would be T... |
For any grammar in Greibach normal form, every sentential form obtained from S by a partial left-most derivation is of the form xy with x terminals and y variables.
I think that this can be proven inductively based on the length of the derivation.
Base case: length 1
S -> a with 'a' being a terminal. This follows from ... |
I am looking at some social network analysis and I need to do link prediction. By link prediction I mean that I only have a subset of the relationships in the network, and I need to make predictions about the unseen relationships.
I am familiar with the more traditional or common methods for link prediction from
simple... |
I am a newbie to the world of algorithms design and currently working on a algorithm which is related to cell-phone user associating with cell-phone tower. Let $\mathcal{K} = \{1,\dots,K\}$ be set of cell-phone users and $\mathcal{J} = \{1,\dots,J\}$ be set of cell-phone towers. Let $k$ and $j$ be index of cell-phone u... |
Preparata & Shamos in "Convex Hulls: Basic Algorithms" (1985), give a linear algorithm for merging two convex hulls in $O(n+m)$ time, where $n$ and $m$ are the numbers of vertices in each input hull. Now, if you had a third convex hull to merge of size $l$, you could do that in $O(x+l)$ time, where $x \le n + m$, which... |
Given a finite set of equations in ANF, for example:
$$
\begin{cases}
(x_1 \land x_2) \oplus (x_1 \land x_3 \land x_4) \oplus 1 = 0 \\
x_3 \oplus (x_2 \land x_3 \land x_4) = 0 \\
(x_1 \land x_4) \oplus (x_1 \land x_2) \oplus (x_3 \land x_4) = 0
\end{cases}
$$
Is this P or NP?
The only assumption is that number of vari... |
I am following a LeetCode tutorial for Disjoint sets I have trouble understanding why the so called "Quick Find" method needs to take O(n) time.
I have implemented an data structure that has an optimised Union operation and it is O(1).
// Base class for all types of disjoint sets.
class DisjointSet {
public:
Disjoint... |
In our class we considered the problem written in the title. The below given time complexities where simply given, but not derived or explained. Therefore I tried myself to derive them, while I using math or simply intuition. I am able to explain, how one of the complexities comes about, but not the other one. I haven... |
The question is LALR(1) parsing of the following:
S->AA
A->aA
A->b
The link to the question is on this page:https://www.javatpoint.com/lalr-1-parsing
My question concerns I3, where despite a being read there is another production A->aA, a/b, where the a is not read.
I wish to know the reasons for this. If anyone can c... |
To represent complexity of an algorithm, Computer Scientist is used to using big-O notation.
How about complexity of boolean algebra?
Boolean algebra is commonly used in digital circuit design with using logic gates, practically useful in FPGA programming. Speaking about logic gates circuit, This topic maybe looks like... |
The birthday paradox is basically that assume there are 365 days in a year(ignore the effect of Febuary 29th), each person's birthday is uniformly random in these 365 days and independent with others. How many people do we need to have a more than 50% chance that two persons(or more) have the same birthday.
my understa... |
Statement : A half space is set of all points on one side of a linear separator, i.e., a set of the form $\{x \mid w^{T}x \ge t\}$. The VC-dimension of half spaces in $d$-dimensions is at least $d+1$.
Proof Idea. There exists a set of size $d+1$ that can be shattered by half-spaces. Select the $d$ unit-coordinate vecto... |
I'm trying to find examples of languages that don't seem regular, but are. A reference to where such examples may be found is also appreciated.
So far I've found two. One is $L_1=\{a^ku\,\,|\,\,u\in \{a,b\}^∗$ and $u$ contains at least $k$ $a$'s, for $k\geq 1\}$, from this post, and the other is $L_2 = \{uww^rv\,\,|\,\... |
I've seen arguments for $P \ne NP$ that rely on certain intuitions about how the real world actually is, generally making the point that it "makes sense" that there exist problems which have an easily verifiable solution that's hard to find.
For example, on his blog, Scott Aaronson has a "Reasons to believe" entry whic... |
I was reading this question over on the quantum computation stackexchange, and the top answer stated that you can't (strongly) simulate even a probabilistic turing machine, on itself. I was just curious if there are any computational models (that are probabilistic) that can be strongly simulated by themselves. If there... |
Let $L_1$ be a context-free language and $L_2$ be a regular language. Then $L_1 \cap L_2$ is context-free.
Part of a proof given in the book "Formal languages and automata":
Let $M_{1}=\left(Q, \Sigma, \Gamma, \delta_{1}, q_{0}, z, F_{1}\right)$ be an npda that accepts $L_1$, $M_{2}=\left(P, \Sigma, \delta_{2}, p_{0}, ... |
I'm preparing for my finals in "Advance Algorithms". I'm trying to solve the following question:
It is given that the current tree is a string of $n$ vertices, and a search operation is repeated twice, with each search looking for the key that resides at that moment in the deepest leaf of the tree. What is the depth o... |
I'm studying lambda calculus with De Bruijn indexes, and have these functions.
$$
zero := (\lambda\lambda.1)\\
succ := (\lambda\lambda\lambda.2 (3 2) 1)
$$
Now I want an algorithm to reduce $succ\ zero$
$$
\beta\ succ\ zero \\
\beta\ (\lambda\lambda\lambda.2 (3 2) 1)\ (\lambda\lambda.1)\\
\beta\ \lambda\lambda.2 ((\lam... |
Let's say I have some splay tree as following:
I want to recrate the exact same Splay tree using insert(key) method. Is there an algorithm that given some Splay tree traversal (or any other representation) will create the same Splay tree?
In other words, assume you are using some online tool to visualize your Splay tr... |
This is an old exam question, but I never found a solution or somebody who could explain it to me. Here is the problem statement:
Let $\Sigma$ be an alphabet with |$\Sigma$| $\geq 2$.
Show that for any Languages $L_1 \subseteq \Sigma^*$ and $L_2 \subseteq \Sigma^*$ there is a Language $L \subseteq \Sigma^*$ and the fol... |
I understood Sipser's proof of CFG to PDA but I am having a hard time understanding his proof of conversion from PDA to CFG while demonstrating the equivalence between the two.
He splits the proof (Lemma 2.27, page 121) in 4 parts:
Modify the PDA so there's 1 start state, 1 final state and every transition increments ... |
Genetic algorithm (GA) is general purpose metaheuristic often used in computational science, e.g. computational physics. However, some authors of computational physics software, e.g. [1], tend to specialize GA to the given problem on the level of variation operators. I do appreciate this approach and their work, but I ... |
I'm studying for my exams and a came through this exercise but I can't prove the result I found.
Given this piece of code:
int k = 0;
while (k < n/2) {
for (int l=k+1; l<=n; l=l*2) {
printf("\n");
}
k = k+2;
}
I am asked to calculate how many times printf() will be called.
I calculated by hand how ... |
I have an optimization problem.
The problem consists initially of the presence of several trucks, each one having different maximum capacities.
There are also multiple customer orders, each with a different weight.
The problem is to fill the trucks with orders, but initially prioritizing trucks with greater capacity, b... |
In standard agnostic learning, we assume that there is a concept class $H\subseteq \{h:\{0,1\}^n\rightarrow \{0,1\}\}$. Given samples from a distribution $D:\{0,1\}^n\times \{0,1\}\rightarrow [0,1]$, the goal is to output the best $h\in H$ for which $err_D(h)\leq C\cdot opt+\varepsilon$, where $opt= \min_{h\in H}err_D(... |
So basically my question is if i have for example 2.2 i need to create a python function to round numers to its higher 0.5 part, i mean
2.2 --> 2.5
2.3 --> 2.5
2.5 --> 2.5
2.6 --> 3
I cant use anything but maths operators
( +, *, **, //, %, - )
|
I believe its possible to achieve this with natural numbers.
The example below is for 2d to 1d conversions both ways, I do believe this generalizes to n-dimensions.
The mapping should work in a way that means that there is a total order of the elements on each side of the mapping, ie. moving through one space in order ... |
Given two DFAs, is it also a correct method to start with the combination of the initial states of both automata, then check where I can go for each symbol from these two states. Then add the combination of those states to the new automata and so on. So that I do not have to first take every possible combination of sta... |
My sister (a high school teacher) came and asked me the following question:
"Hi bro I'm having 28 new students in my class. They need to know each
other. So I want everybody to work together in small groups. I'm
thinking splitting them in groups of 4 and having 9 rounds. Then
everyone meets 3 people in every round and... |
Are both regular expressions correct for the following automaton?
$$(\lambda+ a a^*b(ab)^*)(\lambda + b(a+b)^*)\\
\ \\
(a a^*b)^*(\lambda + b(a+b)^*)$$
The first one is the solution provided by the teacher. The second one is my solution that I found by the algorithm where we use a generalized transition graph and rem... |
I can't seem to get a straight answer as to what a CPU clock is.
I know there are quartz crystal clocks that work by the bending of quartz that happens as an electrical current is passed through it. Do modern CPUs also use a crystal with the same property?
|
Exercise 3.4.9 of The Dragon Book defines Fibonacci strings as follows:
$s_1 = b$.
$s_2 = a$.
$s_k = s_{k-1}s_{k-2}$ for $k>2$.
Part (d) then poses the following question:
Show that the failure function of $s_n$ can be expressed by $f(1) = f(2) = 0$, and for $2 < j \le |s_n|$, $f(j)$ is $j - |s_{k-1}|$ where $k$ i... |
I need to give an example of a language $B$ is $NL-complete$ where $B^* \in L$.
I know $PATH$ is $NL-complete$ (but not limited to using other languages).
I am clueless about that. I know $L$ is not closed under $^*$ so there must a language like that.
Any help would be appreciated.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.