instruction stringlengths 35 29.1k |
|---|
In Naive Bayes we often do additive smoothing as a fail safe. Consider the following expression:
Lets say
$$P(X_i) = \frac{count(X_i) + \alpha}{\sum_i^n count(X_i) + \alpha*total\_size}$$
How to tune the parameter $\alpha$ here. I observed that my classifier accuracy increased for value from $1$ to $N$ (where N is an I... |
The question for my homework is to create a two-tape DFA for accepting two string such that u is 2x the size of v.
I am just confused on where to go with this, i understand this in a base sense but i can't figure out how i would find if it is 2x V after getting beyond V
|
Using randomized approach we can guarantee that the equality problem has O(1) complexity (in communication).
With other definitions of of equality (not strictly equal), is there a general approach to design a randomized algorithm with bounded error? Or how to determine if there is no way such an algorithm can be design... |
I am having troubles trying to create this two-taped Turing Machine, I understand how I would get it to accept 2 strings of equal length. But to move forwards, I dont know how I would check to see if |u| = 2|v|
|
Let's say someone is using Dragon Dictation, Google Speech, or some other free form dictation software (it will recognize anything they say to the best of its ability). I have some reasonably large set of words and I'm certain the speaker is trying to say one of these words. However, the voice recognition system is not... |
I am relatively new to algorithms, I wrote one pattern matching algorithm and its running time is $O(n^2)$, I tried it by step count method, direct method and also the constant method which all yields same results. Anyhow now I am writing the upper and lower bound for that, the equation which I get is
$$20n^2+11n+1$$
I... |
I hardly remember on a lecture, where it was told, that the distance of the practical actual running-speed of a processor to the previous tic is used, to generated a true random entropy for seeding. But I cannot find any source for proving this memory right.
So my question arises: Is this a way to generate a true rand... |
The naive algorithm for generating all unique substrings involves traversing all the string from 1..n, thus takes $\mathcal{O}(n^2)$, but it also involves maintaining a list for all generated substring to check everytime for repetitions.
So the total time can't be $\mathcal{O}(n^2)$, since there is an added checking of... |
Komi is the additional number of points given to the non-starting player in the game of Go.
For 19x19 board, currently it is 6.5 under Japanese rules, 7.5 points under Chinese rules. In the past it was lower, even 2.5 points.
A question arises: what value it should be so that it is a fair game?
Draws allowed.
(This ha... |
Question:
Suppose we have 2 algorithms $Alg1$ and $Alg2$ for the same minimization problem. We know that $Alg1$ is a $2$-approximation algorithm and $Alg2$ a $4$-approximation algorithm.
Is the following statement true?
There must be an input $I$ such that $Alg2(I) \geq 2 \cdot Alg1(I)$.
My answer:
I think the stateme... |
The Longest Common Subsequence (or Substring) problem (LCS) asks, given two strings $s_1$ and $s_2$, to find one string which is substring both of $s_1$ and $s_2$ and it is of maximum length.
Each instance of the problem (i.e. each choice of $s_1$ and $s_2$) can have multiple optimal solutions.
The size input of the p... |
Shellsort is a generalization of insertion sort that allows the
exchange of items that are far apart. The idea is to arrange the list
of elements so that, starting anywhere, considering every hth element
gives a sorted list. Such a list is said to be h-sorted. Equivalently,
it can be thought of as h interleave... |
Let's assume that I have an MDP $M$ which has a number of maximal end components. I also have a random policy (scheduler) $\pi$ that can convert the MDP $M$ into a Markov chain $m$. Can I argue that all recurrent classes of MC $m$ has states that belong to MDP $M$'s maximal end components?
|
By Stirling's Approximation $n! = \sqrt{2*\pi*n} * [n/e]^n * e^\alpha$
Therefore $T(n!) = O(n^n)$
$O(n^n) \neq O(2^{n \lg n})$
Is this correct? Is there another way to get this result if it is correct? Thanks.
|
Are there any type systems similar to rust that don't depend on subtyping ? Can we express that one value must be consumed or dropped before another? For instance if I had an array of huge values on the heap and I would like to operate on a single item using a reference to it, the compiler would need to be sure I had f... |
First let me explain what I mean by algorithmically derivable.
An algorithm must be able to come up with the proof without prior knowledge of the proof, in the same way mathematicians and computer scientists are able to create new proofs without prior knowledge of the proofs.
Our proof deriver enumerates all possible a... |
I got stuck with a question and would like to have a little guidance for the solution.
I need to prove that the next problem is undecidable:
Input - A program
Problem - Does the number of possible inputs for which the program halts is larger than those for which the program won't halt?
I tried to build a reduction th... |
The Terms are much used in actual IT (Information Technology). Is it possible to make a difference or are this terms nearly synonyms for the same fact?
|
I know a lot of computer languages and they all use tokens. E.g. in very early BASIC you could say LET answer = 42, which is composed of seven tokens, LET, answer, =, 42, and three space tokens.
It seems that every character must be part of some token, including comments, which can be considered free-form tokens after ... |
Problem: Suppose we had a directed graph $G(V,E)$ with strictly positive edge weights, a nonempty set $A$ (special vertices) such that $A \subseteq V$, a positive integer $C$, and a starting vertex $S \in V$. Find the shortest path starting at $S$ and containing at least $C$ vertices in $A$ (cycles are OK). If no path ... |
I came across this question. Palindromes are not regular: It is easy to prove it using pumping lemma. The problem is I want an explicit proof without pumping lemma. I came up with a solution. It goes like this.
Let us assume a language L which is palindrome so L can be expressed as x.xR where xR is reverse of x. If x ... |
It is often stated that nondeterministic Turing machines cannot recognize any more languages than ordinary Turing machines. In particular, it is stated that there is no NTM that can take as input a DTM/input string and state whether that DTM will halt.
Is this proven, or is this an assumption under the same banner as t... |
Boolean circuits are non-uniform models of computation in that they require a different circuit for each length of input. The typical way of uniformizing a family of Boolean circuits is to define a Turing machine that can output, for some input length N, the correct Boolean circuit for that N.
However, I wonder if it i... |
Consider the language defined by the following grammar:
$$
\begin{align*}
&S \rightarrow E \\
&S \rightarrow \epsilon \\
&E \rightarrow E+E \\
&E \rightarrow E-E \\
&E \rightarrow \mathsf{STRING} \mid \mathsf{LOCTRAN}(E , \mathsf{DIGITS})
\end{align*}
$$
How can I prove that this language is not regular using the pumpi... |
In the well-known communication task EQUALITY, Alice has a string $x$ of $n$ bits, Bob has a string $y$ of $n$ bits, and their task is to determine whether $x = y$. In the public coin model, there is a probabilistic protocol which uses 2 bits, is always correct when $x = y$, and is correct with constant probability whe... |
I know there's some easy proof for this, but why is $A \leq_T \bar{A}$ ? ... Suppose that $\bar{A}$ is c.e. and could loop, does this mean that the oracle $TM$ $M^{\bar{A}}$ could also loop?
But shouldn't $\leq_T$ mean that $M^{\bar{A}}$ be decidable?
|
I have a balanced binary tree that stores a number in each node, initially zero. I want to build a data structure that will support the following two operations:
Given a vertex $v$ in the tree and a real value $w$, add $w$ to all nodes in the subtree under $v$.
Given a vertex $v$ in the tree, find the smallest absolu... |
Given a sequence of pairs $(a_1, b_1), (a_2, b_2), ..., (a_n, b_n)$ such that $a_1 \le a_2 \le ... \le a_n$ (i.e, sorted in ascending order by $a$'s), we solve the longest increasing subsequence problem for $b$'s. Now suppose the length of the longest increasing subsequence is $X$.
If we now sort the initial sequence b... |
We can make all the gates using nand or nor gates. My teacher told us that nand gates are cheap too, then why do we need other gates at all?
|
Functional programming does not have mutation. Mutation is usually harmful, however mutation is sometimes beneficial. e.g. Creating a [random number] generator.
In the same way that goto is considered harmful, but now we have structured languages that give us access to a safe set of goto patterns. Is there a safe set o... |
$T(n) =
\begin{cases}
2: & n=0\\
5: & n=1 \\
2T(n-2) - T(n-1): &n \geq 2
\end{cases}$
I have found a few examples including https://math.stackexchange.com/questions/1316301/if-tn-tn-1-2tn-2
But I am still lost about how to solve this one.
|
I was trying to come up with a formula for the number of swaps used in selection sort. So we know that selection sort gives the minimum number of swaps to sort an array.
The formula I came up with is given an unsorted array and it's descending or ascending order. We find the number of elements dissimilar to the sorted ... |
Is there a machine or algorithm available to solve the board game "Chinese checkers"? If there is please let me know about relevant material. I have already searched over internet unfortunately i am unable to have relevant details about it.
|
I'm trying to solve a puzzle where I need to calculate the average weight between every node in the graph.
For example, for the following graph:
The results is calculated like this:
1 -> 2 = 3;
1 -> 3 = 7;
1 -> 4 = 5;
2 -> 3 = 4;
2 -> 4 = 2;
3 -> 4 = 7;
Average = 3+7+5+4+2+7 / 6;
NOTE: I'm visualizing the problem as a... |
I am new to complexity theory and want to know what is structural complexity theory? what are problems theorists try to solve in this field and what is its future?
From the wikipedia:
The structural complexity theory or simply structural complexity is the study of complexity classes, rather than computational complexi... |
This question has been handled various ways, but let me show my case.
I want to find out, if the given list is empty with these constraints:
TRUE = (L a b . a)
FALSE = (L a b . b)
NIL = FALSE
ZERO = FALSE
ONE = (L x y . (x y))
TWO = (L x y . (x (x y)))
PAIR = (L a b s . (s a b))
EMPTY = (PAIR NIL NIL)
EMPTY? = (L... |
I'm taking an introductory course in AI and we've been given the assignment to solve a puzzle using different search algorithms on a state space (BFS, DFS etc). I understand the theory and everything, but I'm not sure what information I should store in the nodes of the tree.
Assume that I have a matrix to represent the... |
For the following assume that values A, B, C, D, E, and F reside in memory. Also assume that instruction operation codes are represented in 8 bits, memory addresses are 64 bits, and register addresses are 6 bits, and data values are 32-bit integers (4 bytes each).
Output
Here are some calculation results
I don't unde... |
I'm trying to solve optimization problems of the form: $\min\{cx|Ax\preceq b,\;x\geq 0\}$, where $\preceq$ means lexicographic order; that is, the set of linear inequalities need only to be satisfied lexicographically. I'm guessing these inequalities are treated conditionally by means of binary variables thus transform... |
We're given a big rectangle, and a list of small rectangles contained inside it, with their vertex coordinates.
We want a list of the minimum number of lines defined by a pair of points (x,y) that cut up the big rectangle into the small ones.
For example for this case:
The minimum number of cuts would be 7, and they... |
I'm following an online course which has the following (multiple-choice) quiz question:
Which of the following statements cannot be true, given the current
state of knowledge?
Some NP-complete problems are polynomial-time solvable, and some NP-complete problems are not polynomial-time solvable.
There is an NP-compl... |
I am a novice in complexity calculation. I need to calculate the overall time complexity.
My attempt is given below:
Here, N = number of data points (N>300), C = Number of clusters (2<C<30)
For line 3 to 10, time complexity, TC1 = O(NC)
For line 11 to 12, time complexity, TC2 = O(C)
For line 18 to 22, time complexi... |
I am currently working on a project to build and train a neural network to play DotA 2 (at least be able to play like a really bad human).
The thing is all the neural network I have built before were made to play small games like 2048 or snake so the inputs were pretty straight-forward. (e.g for 2048 each input neuron ... |
Suppose that $L$ is a regular language and $0<\alpha<1$ and $\alpha \in Q$. Define $L_\alpha$ as
$$L_\alpha = \{\omega \in \Sigma^* \mid \exists \omega_1 \in \Sigma^* .\omega\omega_1 \in L,\frac{|\omega|}{|\omega\omega_1|}=\alpha\}$$
How do I prove that $L_\alpha$ is regular?
Here is my attempt. If we assume that $D$ ... |
Given a set T={A,B,C}, I need to know the cardinality of all ordered sequential n-grams and the total cardinality of all subsets of those n-grams. To be clear, the subsets MUST retain order as they appear in the original set.
The ordered sequential n-grams of the set T above are {{A},{B},{C},{A,B},{B,C},{A,B,C}} and ... |
From P5 in this paper: https://hal.inria.fr/hal-01094195/file/CIC.pdf
Using this purely functional part, it is possible to encode many int
eresting notions. For instance
∀
C
:
Prop
, C
is a logical proposition (a term of type
Prop
) which encodes absurdity (
⊥
) : there is
no closed term of typ... |
After perusing the web and cs.stackexchange in particular, I've come across many different wonderful resources in Computer Science - from Sipser's "Introduction to the Theory of Computation" to books on Languages or volumes on Cryptography.
However, what I couldn't find was a general introduction to Computer Science, a... |
By the completeness of FOL, one can show that a sentence $S$ in FOL is valid, i.e. that it holds true in every model, by exhibiting a proof of $S$. Such a proof string is a certificate of the validity of $S$.
To show that $S$ is not valid, one can either exhibit a counterexample model in which $S$ doesn't hold, or find... |
Preface
We can define a system of logic by conjunctions of rules that system must follow. For example, if we wanted to define transitivity of numbers:
$$F_1: \forall a,b,c. a < b \land b < c \rightarrow a < c$$
We could similarly define associativity:
$$F_2: \forall d,e,f. (d + e) + f = d + (e + f)$$
Then we could defi... |
Consider the following regular expressions
letter = a + b + c + d
LETTER = A + B + C + D
digit = 4+5+6+7+9
R1 = (LETTER + digit + !) • (letter • digit)∗• (letter + digit)
R2 = (LETTER + digit + ?) • (letter + digit)∗• (LETTER + digit)
R3 = (digit + ? + !) • (letter∗• digit∗)∗• (LETTER + letter)
R4 = (digit • letter + ... |
I have following unfinished proof of a lemma:
Goal forall (P : Type -> Prop) (Q : Prop),
((forall x, (P x)) -> Q) -> (exists x, P x -> Q).
Proof.
intros.
eapply ex_intro. intros. apply H. intros. eapply H0.
The problem is the last eapply failed, with the message
Error:
In environment
P : Type -> Prop
Q : Prop
H... |
I have read in Wikipedia (and other sources) about the limited backtracking algorithm of Even, Itai & Shamir for solving 2-SAT problem in a linear time, but the approach doesn't seem to be linear, there is no demonstration nor algorithm implementation to check it.
Here is the algorithm description from Wikipedia: Even,... |
I'm trying to write a function in Python that takes it argument as a Python list and returns a boolean value based on the truth vale of the proposition $E(x) \to \exists y \text{ s.t. } x=2y$, where here the proposition $E(x)$ means 'x is even'.
print(check_prop([-2,-1,0,1,2,3])) gives an output true
print(check_prop(... |
I've looked at Hungarian algorithm and Knapsack problems and neither quite hit the nail on the head. I've been trying to best rephrase my question while searching for answers and haven't got anywhere.
I have agents j and tasks i. Each agent can have between 1 and 4 task preferences (each with the cost 0-3), but must ha... |
I am implementing a hash table that may need to grow and shrink as the number of stored keys varies. I have a hashcode function that uniformly hashes keys to positive 32-bit integers. The table itself will use a smaller array of approximate size M.
If I wanted to use the hash function to produce a value between 0 and ... |
I am pretty new to Neural Networks and I have two questions about hidden layers:
1.
What is the purpose of hidden layers? I was wondering this because obviously you can get every result you want with just one weight per input, as you're performing a multiplication.
2.
How should I choose the number of hidden layers and... |
I'd like to know why when choosing how to optimize an algorithm that there almost always (always?) exists a time/space tradeoff.
Definition: https://simple.wikipedia.org/wiki/Space-time_tradeoff.
My favorite example is a karnaugh map for simplifying boolean logic. It abstracts boolean logic away with just clever geome... |
A set is countable if it has a bijection with the natural numbers, and is computably enumerable (c.e.) if there exists an algorithm that enumerates its members.
Any non-finite computably enumerable set must be countable since we can construct a bijection from the enumeration.
Are there any examples of countable sets th... |
I am writing a method which evaluates multiple status enumerations and determines an overall status. I'm looking for what this process might be called and perhaps some theory on it.
It may be best to provide an example. Consider an alarm system, where individual sensors report one of three states:
Alarm
Safe
Unknown
... |
It might seems weird, but, Are there any undecidable problems concerning regular languages? I mean questions concerning the regular languages, not the problems like "Is the language of a TM regular?".
Clarification: By the questions regarding regular languages, I mean that the problem consists of regular languages, i.e... |
I am trying to write an algorithm for finding best path for an electric vehicle to navigate through network of chargers.
A graph with Vertices representing charges and Edges representing distances among them is provided
Assume that car drives at constant speed (ex. 80 mph) and has a fixed maximum mile Range when its f... |
So I was asked to prove (or not) whether, in gale shapley algorithm, everyone can end up married to their second partner of choice or not. I think not but then I am not able to come up with a proof.
Thanks! :)
|
I am going through Wirth's Textbook on Compiler design . After proceeding though
some pages , I realized I have taken for granted my understanding of some
of the terminologies that have been used . For example ,the following terms :
the examples mentioned in the lines in the screenshot refer to the following set of ... |
Computational Complexity Theory is complex. My understanding of polynomial time is in relation to other time complexity classes, such as non-deterministic polynomial time. This is fine for engineers and mathematicians, but I'm looking for a simple definition of the term, suitable for laypeople.
Would it be incorrec... |
What is the difference between switches, flags and options when you want to specify something on the command line? Are they all synonyms?
Are there any reasons why some terminals require:
-op1 --option2
and others:
/option1 /option2
and when processing data, some require:
--data file.txt
and others:
/data=file.txt
... |
My professor said exponentials will always have higher time complexity compared to polynomials. My question is, do exponentials also have higher time complexity than factorials?
I plotted a chart in Matlab to check it myself.
When range of x is small, from 1 to 10, I get the following chart,
%Matlab script
x = [1 : 10... |
To give a clear definition:
1) No wire delay
2) Any number of bits(including infinity) doing NAND(and therefore all the lead-out logics) operation cost O(1) time
3) There are only finite layers(so you can't find a logic chain longer than a fixed value)
4) There may be an input of countable infinity size
To define calcu... |
I was trying to solve the following problem:
You are given a grid of size N×N that has the following specifications:
Each cell in the grid contains either a policeman or a thief.
A policeman can only catch a thief if both of them are in the same row. Each policeman can only catch one thief.
A policeman cannot catch a t... |
How can one assign n people pairwise to n-1 tables, in a speed-date fashion, such that no two persons meet twice and each person is at each table exactly once? Does this problem have a name?
The problem in full
Given n people (n is even), assign them in pairs in n-1 rounds. Each round represent a list of n/2 pairs, eac... |
I'm currently trying to learn about computer vision stuff and I want to try it on a simple project of real time tracking of figures of players in a foosball game while the camera can be moving a little bit above the table. The first goal I want to achieve is detecting (and tracking) the bars on which the figures are at... |
Given integers $g, h, k, n$ how to find the smallest integer with $k\ 1$-bits that is the sum of two integers with $g, h\ 1$-bits respectively. Moreover, all three numbers (summands and sum) can have at most $n$ bits, i.e. the result is the n-bit number with $k\ 1$'s and $(k - n)$ zeros, for instance $\underbrace{0...... |
Let's say we have array of $K$ integers, and we have given $N$ intervals in the form $l_{i}, r_{i}$, both inclusive, the interval $i$ means that all elements in the range $[l_i, r_i]$ are covered. Our task is to check for any of those $N$ intervals is the interval $i$, or the range $[l_i, r_i]$ being covered twice or m... |
As part of an assignment for an AI class that I'm taking, I'm need to solve a puzzle on a 4x4 grid using breadth-first search (each element can take on 12 different values). There is a maximum of 4 moves for each state. Needless to say, after 30-or-so moves, the number of nodes (each representing a state) in the queue ... |
Conceptually, to track the multitude of "state positions" arising in an NFA while it is processing a given input string, a quantitative notion of memory/cache/storage is required per "fork" of execution over the automaton, for keeping track of the states where the computation is currently "at".
What is the typical theo... |
In Haskell, Monad is a class of type constructors which act on types that have the following functions implemented:
(>>=) :: m a -> (a -> m b) -> m b
(>>) :: m a -> m b -> m b
return :: a -> m a
and they satisfy the following "laws:"
return a >>= f = f a
m >>= return = m
(m >>= f)... |
Given a set of 2D polylines such that each polyline:
May have self-intersections;
May intersect some of (or all) the other polylines,
How do I efficiently find all pairs of intersecting segments and the coordinates of each corresponding intersection point? (We may assume that no three segments intersect in the same p... |
I'm having a problem coming up with a regular expression for a language L = {a,b} with out the substring bab or abb?
I can come up with the one for just one substring, like
a*(b* aaa* )* b* a* to eliminates the bab and b*(a+ab)* to eliminates the abb substrings.
But putting them together is a huge animal :(
|
This question is related to: Landau Notation, Definitions: Limits vs. Cormen's.
Consider functions $f, \ g : N \rightarrow R^{\geq0}$.
For small-$o$, the definition:
$$f(n)\in o(g(n)) \iff \forall c>0,\exists n_0>0, \forall n\geq n_0: f(n) < c \ g(n)$$
Can also be expressed as a limit (i guess this assumes the limit e... |
I am lost in formulating a mathematical model for my linear integer program. My problem is; how to include inventory and backlogging.
The following is given:
1100 units can be produced each month
Unit production cost = \$7
Inventory unit cost = \$2
Annual expense = \$10.000
Sales unit price \$12
We have given the dema... |
Suppose that $P^{SAT} \not\subseteq coNP$. Prove that $P\ne NP$.
What I did:
Suppose that $P=NP$. Then, $P = coP = NP = coNP$.
We know that $P^P = P$.
Then, by assumption: $P^{NP} = NP = coNP$
Since $SAT$ is $NP$-complete we get: $P^{SAT} = coNP$ in contradiction to the assumption.
So $P\ne NP$.
I've been told that my ... |
I've got a theoretical exercise at my university which belongs somewhere between alpha blending and ray casting – to be honest, I’m not sure. It says, that we are looking at a voxel (1-centimeter distance) which consists of different colors (sand: yellow, stone: red, oil: green and water: blue) where sand and water are... |
Some of the logics admit Gentzen-style sequent calculus. Are there universal algorithms that allow to find proof (derivation of the proof) in sequent caculus for every hypthetical theorem?
Some of the proof assistants support formalization of general sequent calculus that can allow to define sequent calculus for the co... |
How would I prove that these two regexes are equal to one another? $$ (a \cup b)^* = (b^*(a\cup\lambda)b^*)^*$$
I'm permitted to use the following regular expression identities.
|
I have a table like below. Each row has store id, discount % for one of their coupons. Each store could have multiple coupons but (store+discount %) is a primary key. I would like to find out top 10 coupons (by decreasing order of discount %) but would like to get only 2 coupon from the same store. What is the most eff... |
I am recently learning the theory behind Coq and learnt that positivity condition guarantees termination of the program. But my question is, what would you think of the following definition?
Inductive t : Set := b : t | c : ((t -> unit) -> unit) -> t.
Sure it won't compile in Coq, but would it jeopardize termination g... |
So for a project I am working on. I need to take a string representation of a floating point number, lets say "1.5" and do arithmetic on it with another floating point number. The catch is I cannot use floats to do this, since it specifically says in the requirements for my homework that I can't do this. How I am suppo... |
Hey, this is a question from my handouts, but how would I go about writing a recursive program that would return the number of pairs of an ancestor and a child, whose sum equals to n, given that the program takes inputs of (tree t, sum a)
for example given this tree and 13, it will return 5 in the end, 13+0, 15-2, 6+... |
There is an integer array and 2 variables Q and M.The output required is the number which has the maximum frequency in the array, but the catch is that each number in the array can be increased/decreased by M and that too Q number of times.
In case of multiple answers print the first one.
eg:
array:1,2,3,4 and Q=1,M=1
... |
Do we have knowledge bases only because the logics are not automated enough? I.e. - is it true, that the ideal situation would be that we use the set of logical formulas as the knowledge base together with the deduction services of the relevant logic as the reasoning services for this "knowledge base". But not all the ... |
Say you need to write a function such that you have string a and string b.
The function argument is a concatenation of string a and string b.
The function prints string a and string b separately. I'll explain.
For example one can think of a naive solution such that 'x' will be a separator character and so if we want to... |
I'm thinking these familiar concepts of DO and LET/LET* in the context of Lambda Calculus (LC).
LET is an abbreviation for this LC expression:
(LET a 1 b 2 e) = (λ a . (λ b . e) 1 2)
and LET* is an abbreviation for this LC expression:
(LET* a 1 b 2 e) = (λ a . (λ b . e 2) 1)
where e is the body of the function. LET* ... |
Let's say I start with:
$A \rightarrow Ba$
$B \rightarrow dab | cBb | Acb$
Now I want to make this grammar LL(1), so I need to get rid of the left recursion. I'll work with $B \rightarrow Acb$.
I'll replace where $A$ occurs with its production:
$B \rightarrow dab|cBb|Bacb$
And that gives me a direct left recursion, whi... |
Normally, Simulated Annealing (SA) is used in TSP problem to find the near-to-optimal solution, and the graph structure in TSP is a complete graph. Therefore, I want to know whether or not I can use SA for finding the shortest path/optimal solution in a non-complete(connected undirected) weighted graph in the 2 dimenti... |
Given matrix $M\in\Bbb F_q^{n\times n}$ with rank $r$ what is the complexity of converting to row-echelon form?
Is it $O(n^3\log q)$ or $O(n^3q)$ bit operations?
Technically $O(n^3)$ row operations in $O(\log q)$ bit words should be $O(n^3(\log q)(\log\log q)^2)$ bit operations in worst case when $q$ is prime.
What ... |
In short, is this similar to how $a^nb^n$ is not a regular langauge?
$L$ = {$ { a^nsb^n : s \in L(a^*b^*) ,\ n \ge 1 } $}
For instance, if we have the string $w=a^psb^p$, and we know that $|xy| \le p$, there would simply be a disproportianate amount of a's or b's regardless of where we put $y$ ?
|
I'm new to Coq, and my (rather limited) understanding is that inductive types are like algebraic datatypes in Haskell, so there is a constructor data T = A a with some arguments, and the result A a is a T: specifically a T, so I understand stuff like this:
Inductive List := Nil : List | Cons : nat -> List -> List.
whe... |
I'm confused about how we can use the Myhill-Nerode Theorem to solve this problem, some pointers would be very helpful
Let $Σ = {\{a, b}\}$ and $C_k=Σ^*aΣ^{k-1}$
Prove that for each k, no DFA can recognize $C_k$ with fewer than $2^k$ states.
|
I need an algorithm that gives me integer numbers with the following features:
Numbers must be in a given range $[n..m]$;
Numbers must be returned in pseudo-random order (random at visual inspection is enough; it is more important that numbers are well distributed over the given range);
Numbers may not repeat before e... |
My understanding is that a machine with finite states cannot keep track of the n's being the same in $L$ = {$ { a^nsb^n : s \in L(a^*b^*) ,\ n \ge 1 } $}, similar to the case with how $a^nb^n$ is not a regular language. For instance, if we take a string $aaaa ab bb$, where the fifth a and the following b are $s$, how ... |
Consider the algorithm below
Precondition: n is a non-negative integer
function f ( n )
{
temp = 0
if (n != 0)
{
for (i = 1; i <= 3; i++)
temp = temp + n * f(n-1)
return temp
}
else
return 1;
Solve for the closed form by repeated substitution
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.