instruction stringlengths 35 29.1k |
|---|
Browsing Scott Anderson's blog, I found this list of theorem. Among them are:
If every second or so your computer’s memory were wiped completely
clean, except for the input data; the clock; a static, unchanging
program; and a counter that could only be set to 1, 2, 3, 4, or 5, it
would still be possible (given enough ... |
Tomorrow I'm going to be teaching a class on Aho-Corasick string matching. I'm pretty sure I know how to pronounce Margaret Corasick's name, but I don't actually know the proper pronunciation of Alfred Aho's surname.
Can anyone comment on the proper pronunciation so that I can properly give credit where credit is due?
... |
I imagined a sorting algorithm that sorts an array in O(r) time, where r is the range. Is this already an algorithm (if so, which?), or have I made a mistake calculating the running time (probably).
Create an array going consecutively from the smallest element to the largest element.
Loop over the unsorted array and f... |
One of the exercises I tried to make I failed miserably.
The question was as follows:
Show that the language $L = \{ w \,|\, n_a(w) \cdot n_b(w) = n_c(w) \}$ is not context-free. (with $n_a(w)$ being the number of a's in the word, same for b's and c's)
For answers I first looked at common words not accepted by contex... |
Many computer science programs require two or three calculus classes.
I'm wondering, how and when is calculus used in computer science? The CS content of a degree in computer science tends to focus on algorithms, operating systems, data structures, artificial intelligence, software engineering, etc. Are there times whe... |
given a language L,a DFA M that recognize L is minimal if M is the DFA with the minimum number of states. In order for this to happen M does not have neither unreachable nor equivalent states. The minimum DFA will be unique unless the names of states. Now my question is what is the difference between minimal and canon... |
I have heard the word "hash" being used in different contexts (all within the world of computing) with different meanings. For example, in the book Learn Python the Hard Way, in the chapter on dictionaries it is said "Python calls them "dicts." Other languages call them "hashes."" So, are hashes dictionaries?
The other... |
Can anyone simplify the meaning of families of types index by a type. It looks i get it but quite not understood it. What do you mean by a "family" ?
I understand index by a value (n length sequence) then what you mean by index by a type. Any example how you index by a type ? Thanks.
|
I have a graph data structure that represents a rail network. The nodes of the network are the train stations and the edges are the connections between stations.
Running PageRank on this graph gives me a way to rank the stations by importance. But I want to rank the connections between stations, the edges of the graph,... |
I'm trying to apply a Simulated Annealing technique to solve my (NP-complete) optimization problem. I'm using this book to help myself out.
In the section on Simulated Annealing and more specifically in the section on practical suggestions for beginners, the authors state:
Change in temperature stage: can take place a... |
Can someone give me the best search algorithm in a max heap?
In particular simply implemented as an array. I knew it has complexity of $O(N)$ but it can be done better. For example, if $A[i] < \mathrm{key}$ it's useless to search in the sub-tree with that root in the $i$th position.
|
Are there any theoretical machines which exceed Turing machines capability in at least some areas?
|
Will the following simple hash table construction algorithm be able to construct a
static hash table in $O(n)$ expected time, and will the worst case access time be $O(1)$? If not, what are the problems, and is there a simple solution?
Construction
Let's assume we have a static set of $n$ keys.
We also have a fully ran... |
In the picture below, I'm trying to figure out why there's a need of epsilon in there and what would be the difference if we didn't put epsilon.
|
I want to know whether there is a relation between parameterized algorithms and approximation algorithms.
Like there will exist a fpt problem for problem P iff it have some f-approx algorithm.
I would be also happy if some one can give me reference.
Edit: It's just observation from my aspect that c-approx algo have fpt... |
let L be a CSL. (my understanding/ memory/ expectation is) the problem
is L finite or infinite?
is undecidable.
where was this 1st proved/ published?
are there any cases in the literature of analyzing a CSL L in some "limited context" and determining whether it is finite or infinite? (also wondering about machine ... |
For strings $w$ and $t$, if they have the same length and comprise the same characters (namely, they are two permutations of these characters), then $w\sim t$. For a string $w$, define an operator $\operatorname {SCRAMBLE}$ such that
$$\operatorname {SCRAMBLE}(w):=\{t\mid t\sim w\}, $$
and for a language $A$,
$... |
The Problem :
Finding the number of occurrences of a certain pattern (or shape) in an image. In my example, the problem is about finding the number of spots (in variety of sizes) in an image. See figure 1 below:
What I'm looking for here is an orientation. What class of algorithms can lead to a solution for this type ... |
The title says it all, but I'm curious because it isn't obvious how a theorem prover came to be named 'Isabelle'. Was it named for a person? I couldn't find out by some Google searches.
|
(I've recently started studying satisfiability problems. I've tried to be as clear as possible, but I'm not sure if all of the terminology used is correct.)
Consider a collection of $n$ Boolean variables, $x_1,\ldots,x_n$ and a function $F$ on this collection of variables, $F(x_1,\ldots,x_n)$. An assignment of true an... |
I know that a recursively enumerable language minus a recursive language results in a recursively enumerable language, but I'm confused with the above question.
Aren't all recursive languages also recursively enumerable? Does this mean the answer to the question is that a recursive language minus a recursively enumera... |
I understand the principles required to program locks and I have run into the following problem:
In my Operating Systems course, as well as on Wikipedia, one of the notions associated with lock overhead is the time required to acquire and release locks. And it is also implied that coarser granularity leads to less over... |
I'm reading a Basics of Compiler Design and on page 84 it is making the following statement:
A language may well be LL(1) even though the grammar used to describe
it is not.
Can someone give such an example? I'm not really sure how this is possible. I thought grammars generate languages, therefore if a grammar is n... |
Let t be a fixed constant. I would like to convert a Boolean circuit C of depth t on n inputs over AND, OR and NOT gates (of fan-in 2, say) to an equivalent Boolean formula F on the same n inputs, in the sense that for each input vector x of length n, we have C(x) = 1 if and only if F(x) = 1. Some restrictions on the p... |
I am trying to understand the following network
A has two children - B & C (aka common cause)
All the variables are binary and can be either 0 or 1.
In data values are missing only for some records. Only values that are missing are values A.
How does the Expectation step looks like in this example? Is it P(A|B,C) and t... |
Given a graph with nodes $N$ and two sets of edges $E_1$, $E_2$ where no two edges from $E_2$ can be used consecutively, find the shortest path between $n_1, n_2 \in N$.
Is there a smart way to approach this problem other than a brute force search?
Edit: My first attempt involved trying to construct a graph that satisf... |
To get the regular expression I made a finite automata as the following (not sure if you can directly write regular expression without it):
The regular expression for the above according to me should be $(1+01^*0)^*$ but elsewhere I have seen it can be $(1^*01^*01^*)^*$. Why is it different?
|
I am aware that a similar question was already asked here and that the recent question A DFA for recognizing comments is also related but I am not satisfied with the answers.
The point is that
printf("/* This is not a comment */")
is a perfectly legal instruction in C and, as suggested by its name, the pattern to be... |
In all the presentations of an FPTAS for Knapsack I've seen, it is asserted that the optimal value is at always at least the value of the maximum-valued item (e.g. here, slide 12, where we have $V \leq V^*$, where $V$ is the value of the maximum valued item and $V^*$ is the optimal solution.).
Why is that? I mean, we c... |
I must show that this language is decidable but I think it's not
{D, Ρ} | D is a DFA and P is a ΡDA which L(D) ∩ L(Ρ) = ∅ }
Here what I think
I give a reduction from E(TM). I suppose that this language is decidable.
Let T be a Turing machine that decides it. Then we can construct a Turing machine T´ deciding E(TM), tha... |
I have to define a context free grammar for the following rules:
(i) A pair of square bracket tokens [] surrounding zero or more values separated by commas.
(ii) A value can be another array or a number.
A number is represented by the token NUMBER. So for example, [NUMBER, [NUMBER, NUMBER], NUMBER]. is valid.
I am stuc... |
I have a question where I am asked to find the size of a cache. I am given the following info:
a) the length of a memory address
b) the number of bits for offset, index, and tag fields.
I know I can use the numbers of bits to easily solve the line size and the number of sets. But as far as I know, there is no way for m... |
Suppose $A$ is an array of integers, $|A|=n$, $A=\{a_i|1\leq a_i\leq N, i=1\ldots n\}$.
The goal is to find an efficient algorithm $\cal{F}$ to find maximum element in $A$ with these restrictions:
$\cal{F}$ should not compare any $a_i$ with any $a_j$ ever.
$\cal{F}$ also should not add, subtract or exploit some fan... |
This was an exam question for my course and I am struggling to actually answer it in a way that is not fluff.
Here is my current answer:
CFGs describe how non-terminal symbols are converted into terminal symbols via a parser. However, a scanner defines what those terminal symbols convert to in terms of lexical tokens. ... |
I'm aware that for any given maximize/minimize LP problem, if its dual is unbounded then the primary is infeasible and vice versa. But what if there is no maximize/minimize objective function? For instance, if the problem were simply as follows:
$$x_1+x_2+x_3+x_4\geq 12 \\
2x_1-6x_2-3x_3+2x_4\geq 4 \\
-x_1+x_2-x_3-x_4 ... |
I need to find the substring that is from a 100,000 characters this substring must be most repeated and it need to be longest substring for example
TYUFRIETEYM0SQZLHBCTN0W1KA9HELAT4LTQ14W7ZW484GSK1XTNOBJ2R6AMGW9KU36G7ITMPF315Y7ESYPR1XE2C1953J0DXUNBJLNTDG7IHS63854SGSS7YDEFJYSFP0DLL54GK6NUZ5UU5FRIETEYCPNGHIJOX23QOVSCBYHK... |
Suppose we're given a string like "aabaccbbca", and want to find a short string that's not a substring of this string. However, we're limited to using the characters that appear in the string: in this case we can use 'a's, 'b's, and 'c's, but nothing else.
In that example case, there's no length-0, length-1, or length-... |
A set S of nonnegative integers is called an arithmetic progresion if there exist some integers n and p such that
S = {n + ip : i ≥ 0}
Let A ⊆ {a}∗ and consider S = {| x |: x ∈ A}.
(1) Show that if S is an arithmetic progression, then A can be recognized by a
DFA
(2) Show that if A can be recognized by a DFA, then S is... |
Let $L_1$ and $L_2$ be two languages over an alphabet $\Sigma$. The quotient of $L_1$ and $L_2$ is the language
$L_1/L_2 = \{x : \exists y \in L_2, xy \in L_1\}$
Show that if $L_1$ is regular and $L_2$ is any language, then $L_1/L_2$ is regular.
I've looked up online how to do this but it not very helpful. So far I... |
I'm trying to do a runtime stack on a simple code example that uses dynamic scoping. The code is this:
void g() {
int r = 10;
c = 2;
b = a;
}
void f() {
int b;
b = a;
a = a + 1;
g();
print a, b, c;
}
void main() {
int a, b, c;
a = 2;
b = 4;
c = 6;
f();
print a, b, c;
}
For the first ... |
I have this question for a homework. The question stems from the fact that you can determine whether a regular language is empty by using a Turing machine to count the states n in the given FSM. When you generate all strings from length 0 to n, if the machine accepts any of them then the language is non-empty. We don't... |
Show that the following languages are not regular in two ways: first by using
closure properties then by using the Pumping lemma:
$$\text{(1) L1} = {a^n b^k c^{n+k} : n >= 0; k >= 0}$$
$$\text{(2) L2} = {a^n b^k : n \ne k}$$
So far for
What I tried: Assume that L is regular. By P.L, there exists a P such that $w = a^... |
Although I understand the principles on which both ACLs and Capabilities operate, I do not see why on system restart it would be favourable to store privileges by using ACLs, instead of capabilities lists as it is suggested in the Operating systems course I am taking. In other words, why do ACLs have better persistence... |
Consider the alphabet E = ${[abc] : a, b, c \in 0,1,...,9)} $ Example [234], [567],
[897] are symbols of the alphabet. For a string $w \in $ let n(w) denote the number represented by $ w $: Example for symbol [345], n([345]) = 345.
1) Describe a DFA for the language of strings of the form $[x_0y_0z_0][x_1y_1z_1] ... |
I've been trying to figure out what technically makes a tool or program a compiler.
For example, I know that gcc will compile source code to object files or assembly, hence transforming a programming language to a different form by breaking it down into "words" with some lexer and reading the "grammar" of the words wi... |
I feel like I'm confusing myself perhaps but I'm having a bit of trouble figuring out how exactly this language works. I'm given the following regular expression
(a + b)* (abba* + (ab)*ba)
Can someone clarify to what union is compared to concatenation? Looking at
(a + b)*
Is it { $\epsilon$, a, b, ab, ba, aa, aab, ... |
Context
Let $S$ be a set of objects, each object $S_k$ containing a set of attributes $A_k\subseteq A$, where $A$ is a global set of attributes. Suppose each attribute $a_k\in A$ can take on integer values $[1,m_k]$. Suppose also that the objects in $S$ are unique, i.e. no two objects contain the same attributes and th... |
I stumbled upon the following statement:
By using a $ d $-ary heap with $ d = m/n $, the total times for these two types of operations may be balanced against each other, leading to a total time of $ O(m \log_{m/n} n) $ for the algorithm, an improvement over the $ O(m \log n) $ running time of binary heap versions of... |
If a language like $L$ is regular, then any homomorphism of $L$ is regular too. So, if $h(L)$ is not regular, then we can conclude that $L$ is not regular.
Assume that the language $L=\{yy:y \in \{0,1\}^*\}$ is given.
Can you provide a homomorphism for $L$ like $h$ that $h(L)$ is not regular?
Note : I don't want a simp... |
Let $~G~$ be unweighted unordered tree. I have some number of pairs of this tree's vertices $~(u_1, v_1), \dots, (u_n, v_n)$. I need to construct a smallest subgraph of original tree such that for each pair $~(u_i, v_i)~$ there is path connecting this pair of vertices. "Smallest" in the sense that the number of edges b... |
I am studying Automata and stuck in a question that says:
Is the following a regular set {a^p, where p is prime} U {even-length strings}?
As we see here this language consists of two sub-languages. The left side one is infinite, and by using prove by pumping lemma, we will wind up that it is not regular.
However, the ... |
I've been studying the proof of Farkas' Lemma, and given my rather fuzzy memory of Linear Algebra, am having some trouble with it. One version of Farkas' lemma states:
For any convex cone generated by vectors $a_1, a_2, ...a_m \in \mathbb R^n, C=\{x: x=\sum_{i=1}^m \alpha_ia_i,\alpha_i \geq 0\}$, any point $y \in \mat... |
"Independent Component Analysis" is this : someone is sampling a random vector $s \in \mathbb{R}^d$ such that all its components $s_i$ are mutually independent and $\mathbb{E}[s_i^4] < 3$ and the observer has access to only a transform of it as $y = Ws + b$ where $W$ is a full rank $d \times d$ matrix and $b \in \mathb... |
From This reference : Strict positivity
The strict positivity condition rules out declarations such as
data Bad : Set where
bad : (Bad → Bad) → Bad
A B C
-- A is in a negative position, B and C are OK
Why is A is negative ? Also Why B is allowed ? I understand why C is allowed.
|
I'm performing a simulation of protein-protein interactions. I'm using Python to code logic gates as functions to model protein interactions.
My model is basically a series of groups (g0 to g4) containing logic gates (see image). Initially, I set up a list containing my groups, and then for each group a dict that cont... |
My classmates and I were working on a problem on our introduction to algorithms homework, but we are having a lot of trouble wrapping our heads around it. Below is the problem:
We are given a string of yarn of length $n$ meters, and our goal is to cut this yarn into integer-length pieces. For every integer $1..n$ we k... |
I have a context free grammar such as the following:
$E→E+T | T$
$T→T×F | F$
$F→(E) | a$
Using the left-most derivation, the following can be derived:
$E⇒E+T⇒T+T⇒F+T⇒a+T$
$⇒a+F⇒a+(E)⇒a+(T)$
$⇒a+(T×F)⇒a+(F×F)$
$⇒a+(a×F)=a+(a×a)$
I know what the left most derivation is and I know what the grammar notation mean... |
I don't remember seeing any color conventions in Computer Science used to represent some abstract information or to simplify diagrams.
For instance, chemists have the CPK coloring which associates elements to colors.
Electrical technicians have the electronic color code for resistors and wire colors (black for neutral/... |
There are many algorithms that compute PI. Some are obviously complex, involving huge formulas and constants. Some formulas are not that complex, but involve operators such as division which is somewhat complex by itself. Is there any algorithm that is inherently simple and could be expressed very tightly on the untype... |
I am trying to understand Pattern Databases for designing heuristics. I am reading Richard E. Korf's book Heuristic Search. One of its paragraphs says
The obvious heuristic for Rubik's Cube is a three dimensional version of the Manhattan distance. For each cubie, compute the minimum number of moves required to correct... |
I was reading about how to use $A^*$ and was told that:
A heuristic is admissible if $h(u) \leq \delta(u,t)$, where $\delta(u,t)$ function indicates that the shortest path from $u$ to $t$.
I was wondering why such a condition guarantees that the shortest paths can still be computed.
Its clear to me if the heuristic i... |
Wikipedia informally describes NP-hard problems as "at least as hard as the hardest problems in NP".
It then states the formal definition: "a problem H is NP-hard when every problem L in NP can be reduced in polynomial time to H".
It doesn't seem obvious to me that those two statements are equivalent. In particular, it... |
One possible CFG containing twice as many zeros as ones can be,
S -> 0S0S1S | 0S1S0S | 1S0S0S | ϵ
(This CFG is redundant but it will do the job. So I am not interested in the redundancy. Other possible CFGs can be S→ϵ|1S00S|00S1S|0S1S0|S00S1 or S→ϵ|1S00S|00S1S|0S1S0|01S0S which some might say is better because of less ... |
Let $A[1 . . . n]$ be a given array of $n$ integers, where $n = 2^m$. The following two operations are the only ones to be applied to A:
Add(i, y): Increment the value of $A[i]$ by $y$.
PartialSum(k): Print the current value of $\sum_{i=1}^{k} A[i].$
One needs to perform these two operations multiple times in any ... |
In this paper, Karpinski and Zelikovsky introduce the SET COVER and the $\epsilon$-DENSE SET COVER problems as follows:
Set Cover Problem. Let $X = \{x_1, \ldots, x_k\}$ be a finite set and $P = \{p_1, \ldots, p_m\} \subseteq 2^X$ be a family of its
subsets. Find minimum size sub-family $M$ of $P$ such that
$X \su... |
The question is under the concept of LR parser.
Suppose the original grammar is
S->AA
A->aA|b
Is it necessary to add an additional rule S'->S to make it as augmented grammar?
In short, I want to know the use of augmented grammar.
|
I came across the problem:
What is the number of binary trees with 3 nodes which when traversed in postorder give the sequence A,B,C?
Now 3 being small number I was quick to draw all possible binary trees and come at the conclusion that there can be 5 such binary trees for given postorder.
C C C C... |
I want to represent a set of any substrings which come from an original string with constraint that all substrings should not be overlapped. To be more clear please consider the example below:
e.g.
orignal_string = "ABCDEFG" // this can be any characters.
substring = {"ABC", "DE", "FG"} // right.
substring = {"A",... |
How can we show that, for every infinite recursive language, it has a subset that is recursively enumerable but not recursive?
I think we need to show there's a list of natural numbers that can't be ordered but I don't know how to build such a subset.
Is there another way of arguing or another type of argument in order... |
I'm task to solve a problem in UVA and its problem 305 in particular well its easy to program it just brute forcing stuff. Part of the task is to find the big Oh of the program using frequency count
#include<stdio.h>
const int goodjoseph[] = {2,7,5,30,169,441,1872,7632,1740,93313,459901,1358657,2504881};
char k;
... |
Refering to this paper
Dependent ML: An Approach to Practical
Programming with Dependent Types
Have defined datatype 'alist ( int ) Its not clear why they have used int as a parameter rather than a nat directly.
datatype ’a list (int) =
nil(0) | {n:nat} cons(n+1) of ’a * ’a list(n)
fun(’a)
append (nil, ys) =... |
If i'm recalling from Robert Harper's lectures Homotopy type theory A dependent type is a family of type index by a type. If we allow index to be just a value can we gain something instead of allowing to be a type ?
Is that the same thing they did in DML?
Wikipedia definition states in this regards :
A dependent typ... |
I ran across the following problem from an online problem bank: there are up to $~10^5~$ queries each of which asks to compute the sum
$$\sum_{k = L}^{R} \sigma(k)$$
where $\sigma(k)$ is the sum of divisors of $k$. It is given that $1 \leq L \leq R \leq 5\cdot 10^6$.
My solution (described below) is based on Erathosthe... |
I am reading "Complexity and Cryptography" by Talbolt and Welsh. The book mentions the Berman and Hartmanis conjecture :
All $NP$-Complete languages are $p$-isomorphic.
Then the book says that if the conjecture is True then $P \ne NP$. I am unable to make sense of the proof the book gives, which is:
If $P=NP$ then a... |
A decision problem $C$ is $NP$-complete if $C$ is in $NP$, and every problem in $NP$ is reducible to $C$ in polynomial time.
Reduction means transforming an instance of one problem $A$ to an instance of another problem $B$, and by using an algorithm that solves $B$ we can obtain the solution to $A$ for our original ins... |
I need a data structure for storing a number $n$ of elements, each of whom is associated with some different time $t_i$. $n$ varies and while it has a theoretical upper limit, this is many orders of magnitude larger than what is typically used.
Through my application I can ensure that:
Inserted elements are always new... |
I'm having trouble grokking Cormen's Algorithms book on pg. 120. The context is the hiring problem (as it is called in the book). Here is the part that is tripping me up:
"Let X be the random variable whose value equals the number of times we hire a new office assistant."
and later on:
"...we let $X_i$ be the indic... |
As I have understood from all the internet sources I can get to, when you declare and initialize a variable in java, you are allocating this data, say an 8-byte float, in a particular memory cell in the RAM, with the address specified as the row and column number. Now, suppose I want to access this memory location and ... |
I was reading about AVL tree rebalancing from Behrouz Forouzan's book. The book first defines Left High and Right High tree:
Left High (LH) tree is a tree tree with the height of the left subtree more than that of right subtree.
Right High (RH) tree is a tree with the height of the right subtree more than that of lef... |
In scheme, a procedure application is considered as a control structure. Why is this?
|
Given $k$ sorted arrays, the size of each array is $n$ and we want to sort them to one sorted array. assume that $k=2^p$ i.e $k\in\{ 2^1,2^2,2^3,2^4,\dots\}$
I the first step we will merge (the first and the second arrays),(the third and the fourth arrays),(the fifth and the sixth arrays),... till we get sorted arrays... |
I'm having a hard time understanding mixing time for Markov Chains on Complete Graphs (Kn).
We can define the probability matrix for Kn where Pi,j=probability of going from i to j (technically 1/degree(vi). This is assuming the edges have no weights and there are no self-loops.
Also, the stationary distribution pi exis... |
So here's an excerpt from Foundations of Computer Science by Alfred Aho and Jeffrey Ullman[1]. I've also found basically the same material in a few other places, and also in my discrete math textbook, but this is clearest one I've seen:
Example 3.2. Suppose we have a program whose running time is $T(0) = 1$, $T(1) = 4... |
I came across one problem, which read as follows:
We want to place the 13 letters A, B, C, D, E, F, G, H, I, J, K, L, M in a binary search tree with the minimum number of levels: 4. Because there are fewer than 15 elements, we have some flexibility as to the structure of the tree. Which letters can appear at the root?... |
What is an upright rectangle?
I came across the phrase in my homework -
"The bounding box of a set of S points is the smallest upright rectangle containing S. Describe and analyze an algorithm to compute the bounding box of n points in the plane using fewer than 3n comparisons."
Can anyone explain to me what is meant b... |
So far, I have looked around the internet for information how to find the time complexity for functions in lazy functional languages, but most of the resources on time complexity focus on strict imperative languages, and there seems to be very little about finding time complexity in lazy functional languages.
The forme... |
I am currently studying about polynomial time in Comp Theory. The definition for polynomial time given in my textbook as follows:
$$P= \bigcup_{k}TIME(n^k)$$
I have not seen the Union over k notation before. K is a constant. A quick introduction to the meaning of this notation would be enormously helpful.
Thank you
|
I'm sorry if this has already been asked before, but I couldn't find any similar questions. The situation is as such:
Assume there are x restaurants, each with a capacity q, and y people, each of which can only eat from one restaurant. The x restaurants can only serve the people within radius r of its location. Try and... |
Here the author describes the Random Access Stored Program machine and the problem of indirect addressing.
The author states:
But this does not solve the problem (unless one resorts to Gödel numbers). What is necessary is a method to fetch the address of a program instruction that lies (far) "beyond/above" the upper b... |
This is question 11 from GATE CS 2009.
Find the language generated by the following grammar over the input alphabet = $\{a,b\}$.
$S \to aSa \mid bSb \mid a \mid b $
The language generated by the above grammar over the alphabet {a,b} is the set of
(A) All palindromes
(B) All odd length palindromes.
(C) Strings that beg... |
Let $G = (Q, \Delta, W)$ be a finite weighted graph with $\Delta: Q \times Q$ and $W: Q \times Q \to \mathbb{R}^{+}$. Is it the case that there always exist a function $W': Q \times Q \to \mathbb{Q}^{+}$ such that $\forall S, S' \subseteq Q, \forall s, s' \in S$:
$$
\sum_{s'' \in S'}{W(s, s'')} = \sum_{s'' \in S'}{W(s'... |
We just finished our "Time constructability" lesson in class last week, and we, for example's sake, showed that $n^k, 2^n$ are fully time constructible, i.e. there exists a (multi-tape deterministic) Turing machine that for $n$ given, halts after exactly $f(n)$ steps, and just asked if we could now prove that $n!$ is f... |
Prove the following:
If there is a polynomial oracle reduction from $S1$ to $S2$:
a. If $S2\in\ P$ so $S1\in\ P$
b. If $S2\notin\ P$ so $S1\notin\ P$
The way I see it - If there is a polynomial oracle reduction from $S1$ to $S2$, you can solve $S1$ with $n^k$ questions to $S2$. If $S2\in\ P$, and $S2$ is solved with $... |
I have a task to reimplement this net (library system) into a 'finite' net, which ends after 5 'readings'. I have totally no clue how to achieve this, it was our first lesson.
Is there someone that could help me?
|
I am working with this problem:
What is the asymptotic running time of the following piece of code?
if (N < 1000)
for (int i = 0; i < N*N*N; i = i+1) A[i] = j;
else if (N < 10000)
for (int i = 0; i < N; i = i+1) A[i] = j;
else
for (int i = 0; i < N*N; i = i+1) A[i] = i;
Where the possible answers are:
A) line... |
I have came across following problem:
What is the maximum height of any AVL-tree with 7 nodes?
The recurrence giving number of nodes $n$ in the AVL tree for given height $h$ is as follows:
$n(h)=n(h-1)+n(h-2)+1$
$n(0)=1$
$n(1)=2$
So if we follow this recurrence, we get the height of the AVL tree with 7 nodes = 3 as... |
I want to construct a busy beaver TM which has the alphabet $\Sigma = \{1,2, X\}$ and $X$ is the blank symbol. I want to do this using 3, 4 and 5 states (means one just for halting, so 3 states = 2 'normal', 1 for halt). I am looking for kind of a system (theoretical pattern)
to do this...is there anything like that? ... |
Many years ago I briefly skimmed a physical book (or perhaps a preprint?) on programming in Racket that included lots of really unique uses of map and fold (reduce) in particular, although it had plenty of genuinely unique tricks with curried (curryed?) functions et al. -- all of these without (notable) loss of general... |
I am implementing worflow where the code in industrial programming languages (JavaScript and Java) should be generated from the formal (formally verified) expressions (from ontologies as objects and rule formulas as behaviors). What is the best pratice for such code generation? Are some frameworks available for this?
I... |
Given this piece of code:
FindMax(L):
k = len(L) - 1
max = L[k]
k = k - 1
while(k >= 0):
if(L[k] > max):
max = L[k]
k = k - 1
return max
How would you go about computing the average-case complexity with respect to the number of times $max$ is assigned? The way I've been taught to ap... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.