instruction stringlengths 35 29.1k |
|---|
How can I construct an LR($k$) grammar (which $k$ is not really of interest for now) for a given language, say:
$$L=\left\{w \in \{a, b\}^\star \ | \ \exists u \in \{a, b\}, v \in \{a, b\}^\star: w = vu \wedge |w|_u \operatorname{mod} 2 = 0\right\}$$
($|w|_u$ denotes the number of $u$'s in $w$).
Please note that I don'... |
Assume I have a multicore system and a critical section.
I understand how disableling interrupts on a single core systems solves the critical section problem.
So assume I could disable interrupts on all cores atomically (Why is that not possible?).
Why would that solve the problem?
As I understand, there would still b... |
I got a bit of how Shannon explained to find the number of bits required to represent a message and Shannon's Entropy.But it's natural to know that to code alphabet letters you need 5 bits of information starting from 0000 to 11001.
Is that because at his time no one knew how to represent bits in information that Shann... |
Prove or disprove
$\exists L_{1},L_{2}\subseteq\Sigma^{*}:\quad L_{1}\ne L_{2}\wedge\overline{L_{1}\cdot L_{2}}=\overline{L_{1}}\cdot\overline{L_{2}} $
Where $\cdot$ means concatenation, and over line is complement. Also, Let $\Sigma=\{a,b\}$.
|
I was trying to analyze radix sort in terms of time and space. Assume that we are given $n$ 32-bit integers which we would want to sort by looking at the least significant digits first.
$k$ is the total amount of bits that you will be working with at every step. So at first you look at the first $k$ bits, and sort the ... |
For the following $2$ cases:
(1) $V = \emptyset, E = \emptyset $ (i.e. nothing at all)
(2) $V = \{v_0\}, E = \emptyset $ (i.e. only 1 root node $v_0$)
Are they considered a valid tree? It seems like different literature have different definitions.
I recall that I have read a data structures and algorithms book that de... |
Supposed you have $\langle a_1,a_2,a_3,a_4,a_5\rangle$ = $\langle 6,16,13,9,6\rangle$, how would you find a shortest possible sequence of comparisons that determines the order of elements?
|
Crossposting due to recommendation.
I formulated a MIP problem which I didn't expect to be unimodular. The problem is to find a minimum complete sequence in a strongly connected digraph. That is, minimize the number of edges such that connectivity is preserved, using only previously existant edges. This will be a Hamil... |
In a previous question of mine, I asked how efficient is the Least Significant Digit first radix sort algorithm for sorting 32-bit integers. It turns out that the bounds are:
Time: $ \Theta (\frac{32}{k}(n+2^k))$
Space: $\Theta (2n + 2^k)$
I have read various articles online about the efficiency of sorting the numbers ... |
I have a function $f: X \to \mathbb{R}$ where the domain $X$ is a (small) discrete set, such as $X = \mathbb{Z}^d \cap [-10,10]^d$ (i.e., the set of $d$-dimensional integer vectors all of whose coordinates are in the range $-10..10$, inclusive).
I'm interested in computing a non-trivial lower bound on the value of
$$\m... |
When you have a cache mis, you need to fetch a block from RAM. If said block is 64 bytes big, do you need to have buses that are 512 bits (= 64 bytes) wide to transfer data from the RAM to the cache? And when writing to RAM do you write to the whole 64 byte block?
|
Say that I am given a cone, as specified by the extremal rays whose facets form its convex hull, what is the most efficient algorithm that finds the linear-rank inequalities whose intersection defines the interior of the cone? Also, what is its run time? I have a situation where I have on the order of several thousand ... |
I am learning the basics of data classification using competitive learning, and am somewhat confused regarding the way this is implemented.
I understand at the start an amount N of prototypes is randomly positioned in the input space. (Ie: weights of output neurons are randomly generated). Subsequently training the dat... |
I have definitely checked out many different related posts. I have also done different sample problems from online sources as well from a similar problem. However, I am stuck on the problem below specifically.
Given the following relation $R$ and the set of functional dependencies $S$ that hold on $R$, find all candid... |
Here is a passage from Kozen's Automata and Computability (pages 145-146) that I'm confused about:
Now we show how to convert an arbitrary grammar to an equivalent one (except possibly for $ \epsilon $) in Greibach normal form.
We start with a grammar $ G = (N, \sum, P, S) $ in Chomsky normal form. This assumption i... |
Let $\texttt{a[]}$ be a finite array. We want to check whether every number between $\texttt {min(a[])}$ and $\texttt {max(a[])}$ appears exactly once.
An obvious solution is sorting the array in time $O(n\log(n))$ and go through the sorted array in linear time and check that $\texttt{a[k+1] == a[k]+1}$ for $0\leq\tex... |
let's say we have a set of players that we want to match into teams of aproximatly same strength, so that no team is much stronger than another team.
Each team consists of two players. One player is taking a defense position, another player is taking an offense position. The teams can decide for themself which of the p... |
Here is the pseudocode for LSD radix sort from http://www.cs.princeton.edu/~rs/AlgsDS07/18RadixSort.pdf
public static void lsd(String[] a)
{
int N = a.length;
int W = a[0].length;
for (int d = W-1; d >=0; d--)
{
int[] count = new int[R];
for(int i = 0; i <... |
Linear programming (LP) is in P and integer programming (IP) is NP-hard. But since computers can only manipulate numbers with finite precision, in practice a computer is using integers for linear programming. Because of this, shouldn't LP and IP be in the same complexity class?
|
I need to find the time complexity of the following simple algorithm.
Calculate the time complexity of the following algorithm:
void f(int n) {
int i, x;
for (i = 1; i <= n; i++)
if (i % 2 == 1)
x++
}
It obvious that the time complexity of this algorithm is $\Theta(N)$, but how I prove it formally?
I ... |
I was learning about Büchi Automata and couldn't understand a part where they were describing "Non-empty $\omega$-regular languages contain periodic strings"
Let $A$ be a Büchi automaton and $s ∈ L^\omega(A)$. There is an accepting run $r$ of $A$ on $s$ such that $q ∈ \text{Inf}(r)$, for some $q$. Then, there exist fi... |
I know that this problem is solvable in linear time with a merge but I want to get a sub-linear algorithm.
What I came up is that, if a[k] < b[k] then the $k$th element can not be in the sub array a[0..k-1] or in b[k+1..n].
But I am not able to construct the recursive relation.
What I came up is
find(i,A,B):
k=i/... |
S. Wolfram has in has book "A New Kind of Science" listed 256 simple rules of cellular automata. Which of these rules could via iteration essentially contribute to render an input sequence more random in a certain sense?
Rule 170, for examples, simply produces a left
shift and evidently is not of use in this, if I don... |
Show that proving 2SAT is not NP-Complete would prove that 3SAT is
not in P.
Or eqivalently -
Show that proving 3SAT is in P would prove that 2SAT is NP-Complete.
I can see there is an easy reduction from 2SAT to 3SAT and it seems like it is the key here, but I can't quite prove the statement above. Can anyone h... |
Here, it is well known that the minimal number of givens for a size $9 \times 9$ board of Sudoku requires 17 "givens" in order to be solved (i.e., no puzzle can be solved with $\le 16$ givens).
What is the minimal number of givens for a size $n^2 \times n^2$ board? Is there a table of "best-known" minimal values?
I'm s... |
I was reading the documentation for Julia's Dataframe package, and the package implements Dataframe by a series of a columns each of a single type. From reading the docs, it looks like that's how R implements Dataframes as well. Is there any reason this is a better way than having a Dataframe being a collection of tupl... |
I'm not sure if this is on topic, but I've seen some hardware related questions here so I'll post it here anyway. If it's off topic I'll take it off.
Compile this C code:
int main() {
unsigned long long int i;
for (i = 0; i < 30000000000ull; ++i){}
return 0;
}
with gcc cycleTimer.c. Then run /usr/bin/time -f "%... |
Suppose a program was written in two distinct languages, let them be language X and language Y, if their compilers generate the same byte code, why I should use language X instead of the language Y? What defines that one language is faster than other?
I ask this because often you see people say things like: "C is the f... |
I was working in my project when I was struck by the question of whether it would be necessary, or at least cautious, prevent overflow and underflow in the calculation of these two distances.
I remembered that there is an implementation of the calculation of the hypotenuse to prevent this. Most languages implementers... |
This paper adds effect handlers to a number of languages, including Haskell - and also adds a form of effect typing to Haskell. But what's the point of the latter? I know that effect types can be used in a metaprogramming context (e.g. in a compiler) to prove the soundness of optimisations, but are there any uses of ef... |
Say I had an input $\langle3,17,15,9,1\rangle$, could I for example begin by comparing 1 with 3 so that 1 appeared at the start of the sorted sequence straight away or would I first have to compare 3 and 17 and then continue working from left to right with consecutive numbers? If the latter is correct, do I then have t... |
Given some strings, is there some algorithm (and program that implement such an algorithm) that can create a regex which matches some of the given strings and not the other given strings?
Note that the given strings are not all the strings that will be met by the regex.
I hope the regex can generalize well on other s... |
How can TSP be an NP-optimization problem ?
The definition of an NP-optimization problem $\Pi$ states that for each instance $I \in \Pi$ , the set of feasible solutions $S_\Pi(I)$ is non-empty and that the size of each $s \in S_\Pi(I)$ is polynomial bounded in $|I|$, where $|I|$ denote the size of $I$.
However, in th... |
I'm having a really hard time understanding some of these concepts. I've read them over from several different sources and still can't reach the a-ha moment.
I need to prove a language $L$ is not Turing-recognizable by giving a reduction from the following language:
$$D = \{\langle M\rangle \mid M \text{ rejects input ... |
Given a matrix $A \in \mathbb{R}^{n \times p}$ and a vector $x \in \mathbb{R}^p$, I am interested in computing the value of the mean matrix-vector product:
$$v = \frac{1}{n} Ax$$
If I did this using standard matrix-vector multiplication, then it would take $O(np)$ operations. I am wondering if there exists an approxima... |
Haskell's Data.Sequence uses Hinze-Paterson 2-3 finger trees to represent finite sequences. The types are defined below for concreteness. Currently, the library offers a stable sort via a list-based merge sort, and an unstable sort using a binary heap. I was thinking about whether it would be possible to write an effic... |
It seems that the distinction between fibers and threads is that fibers are cooperatively scheduled, whereas threads are preemptively scheduled. The point of the scheduler seems like a way to make an otherwise serial processor resource act in a parallel way, by "time-sharing" the CPU. However, on a dual-core processo... |
Given the limitations of greedy (i.e., not always finding the optimal solution), does sampling the data space in a randomized manner or some structured manner reduce or remove the limitations of greedy algorithm?
I understand the answer to this is problem-specific, but given a problem that shows the limitation of greed... |
While preparing for my data structures final I came across this problem:
A - a given array of integers of length n.
Propose data structure which supports the following operations:
Init(A) - initialisation of the structure given the array A. Worst case complexity: O(nlogn).
LengthOfLongest() - returns the length of the ... |
this is my first question on this site.
I recently, study on NP. I have some confusion about this Topic, and want to propose my inference and some one verify me.
I) each NP problem can be solved in Exponential Time.
II) if P=NP then NP=NP-Complete.
III) The following problem is in NP: given a natural number, determ... |
I am recently learning about automaton and I was confused at an exercise that was given to me.
In the lecture, we were given this exercise:
Given a FA with transitions
$$\begin{array}{c|ccc}
& a & b & \epsilon \\ \hline
q_1 & \varnothing & \varnothing & \{q_2\} \\
q_2 & \{q_3, q_4\} & \varnot... |
Suppose I want to generate a $n$-dimentional (random) Lattice, and then output a list of all orthogonal vectors of length $d$. What are the possible algorithms to do this, in poly-time?
one way certainly, is to output the weighted orthonormal vectors, $d.e_i$, where $e_i = \{0, 0, \cdots, i, \cdots, 0, 0\}^T$, but let'... |
I am currently taking a course in computer networking and I am curious about the following situation:
Given $n$ packets and a window size of $n$ (i.e., the number of packets is equivalent to the window size), what would happen in the following scenario?:
Packet 1 is sent by Host A and the corresponding ACK is received.... |
I'm aware that there must be something wrong with my reasoning, but I'm not sure what and neither are a few other CS people I've asked.
So here goes:
Take the following problem for example:
Let $x[n]$ be a real valued discrete signal of length $N$.
It is known that the signal is of the form $$x[n] = sin(an) + sin(bn) ... |
I am taking an algorithm analysis class and am stuck on one of my homework problems and would appreciate it if I could receive some guidance.
The problem I'm stuck on is proving that the empty language and $\{0, 1\}^*$ are the only languages in P that are not complete for P with respect to polynomial-time reductions (p... |
I've come across a problem which at first appeared to be a markov process however the transition matrix of the graph is non-stochastic. That is, the probabilities among edges leaving a node do not sum to 1. However,the probabilities on edges entering the node do sum to 1. Therefore the transpose of the transition matri... |
The transitive reduction problem is to find the graph with the smallest number of edges such that $G^t = (V,E^t)$ has the same reachability as $G=(V,E)$.
When $E^t \subseteq E$ it is NP-complete. When $E^t \subseteq V\times V$ but not necessarily of $E$, this problem is polynomial time solvable. I am wondering about th... |
I ran into a fun interview question, yesterday. Can anyone help me?
Suppose a binary tree with six nodes is given, such that each node has
only a left child. With how many "right rotate" operations (without any left
rotates), we can convert this tree to a tree in which each node has only
a right child?
|
The Quadratic Knapsack problem, introduced by Gallo, is an optimization problem in the following form:
$max \sum_{i=1}^n{\sum_{j=1}^n{q_{ij}x_ix_j}}$
$s.t \sum_{i=1}^n{w_ix_i} \leq c$
$x \in \{0, 1\}^n$
Where $n$ is the number of items, $c$ is the capacity (positive and integral) of the knapsack, $w_i$ are the positive... |
The transitive reduction $G^t = (V,E^t)$ of a graph $G=(V,E)$ is the smallest graph with the same reachability as $G$ with the property $E^t \subseteq V \times V$.
The minimum equivalent graph $G' = (V,E')$ is the smallest graph with the same reachability as $G$ with the property $E' \subseteq E$.
Consider the case whe... |
I should prove that $(A^+)^* = A^*$ in a very formal way, any hints?
|
Suppose that $A$ is a regular language. How can I show that $A^2 = A \cdot A$ is a regular language? Is there a construction?
|
Natural numbers are defined inductively as (using Coq syntax as an example)
Inductive nat: Set :=
| O: nat
| S: nat -> nat.
Is there a standard way to define integers (and maybe other sets like rationals and reals) constructively?
|
So we have a lot of line queries in the plane, and for each line query we want to know the number of segments that intersect that line (are stabbed by the line) for a given set of segments in the plane *(not necessarily axis aligned). The set of segments is fixed but the number of query lines could be large. I was thi... |
Given a set of strings $\{s_1, s_2, \cdots, s_n\}$, is there a way to encode them to a program $P$, such that given some string,$s$, the program can test the membership efficiently (deterministically or probabilistically), BUT no adversary can ever learn/extract any (member) strings from the program (in polynomial time... |
I am writing a paper in which the worst-case analysis of a certain randomized algorithm is correct with probability $1-1/n$ (where $n$ is the size of the problem). I find myself writing, time after time, the following sentence:
"With high probability, in the worst case, the performance of phase A is at most X".
The ... |
This question is not necessarily related to Christofides algorithm per se, I just ran into it when reading about it.
I assume that a minimum spanning tree must have an even number of odd-degree vertices, since Christofides algorithm uses this fact to find a perfect matching between "the set of vertices with odd degree ... |
How does one determine what memory cells (addresses) are being read into a cache?
For example if we read at adress "C000EAFCH", which memory cells will be read into the cache if the cache is 64 byte and each cacheline is 8 byte?
If we use direct mapping, would one say that there are the 4 previous bytes and the 4 next ... |
The common examples of NP-hard problems (clique, 3-SAT, vertex cover, etc.) are of the type where we don't know whether the answer is "yes" or "no" beforehand.
Suppose that we have a problem in which the we know the answer is yes, furthermore we can verify a witness in polynomial time.
Can we then always find a witness... |
I have found the following example:
As an example consider the case when the input space $ {\mathcal{X}}$
consists of images of $ 16\times 16$ pixels, i.e. $ 256$ dimensional
vectors, and we choose $ 5$th order monomials as non-linear features.
The dimensionality of such space would be
$\displaystyle \left(\be... |
According to wikipedia, Cocktail-sort has an average performance of $O(n^2)$, whereas Comb-sort's average performance is $Ω(n^2/2^p)$, where $p$ is the number of increments.
There's no explanation given for this substantial difference between two similar algorithms, both variants of Bubble-sort. Can anyone help explain... |
I have only intro CS under my belt, so I'm looking for some fast advice. I want to write a scheduling algorithm for the following scenario.
I have customers who have selected how many hours they want and what times they are available (choosing in 4 hour increments). I have 1 service person I then need to schedule to ma... |
Here's what I have as the tweaked format I'm to use:
S EEE MMMM (excess 8 format)
s = sign bit, E = exponent bits, M = mantissa/fraction bits
Otherwise, it follows the IEEE 754 in principle.
The values:
(-1)^s x 0.0: e == 0, && m == 0
(-1)^s x 0.M x 2^-2: e == 0, && M != 0
(-1)^s x 1.N x 2^(e - 3): 0 < e < 7
(-1)^s x ... |
Can someone explain why pagerank defined for undirected graph with no damping factor is equivalent to the degree?
$\sum_{j\in N(i)}{\frac{p(j)}{d(j)}} = d(i)$
I looked up every book I could, but they all say it's trivial and skip the proof, making me feel stupid.
|
In 1962, you could win a prize of \$ 10 000 (about \$ 80 000 in today's money) if you found the solution to an Euclidean travelling salesman problem defined on 33 cities.
http://www.math.uwaterloo.ca/tsp/history/pictorial/car54.html
Looking at the picture, the problem seems pretty easy. However I failed to find more de... |
According to Wikipedia:
...metaheuristic is a higher-level procedure or heuristic designed to
find, generate, or select a lower-level procedure or heuristic
(partial search algorithm) that may provide a sufficiently good
solution to an optimization problem...
So a metaheuristic is something like a shaman (maste... |
I had a question that asked for the DFA that accepts the following language:
{w | every odd position of w is a 0 }
Should this DFA accept the empty string, since it doesn't have an odd position?
|
I'm reading a paper for school and I have come across a passage that I don't understand. It says "If we allow the query to access the entries of the array through an oracle, it is possible to obtain a data structure of sublinear size".
Searching for information on what Oracle Access is has given me nothing but stuff ab... |
Intuition:
Suppose I have an array of nonzero integer values $A[n]$ and a partially constructed Fenwick tree of this array: $F[k], n>k$. I can see why inserting the next element would be worst case $O(\lg n)$. The number of elements accessed from $F[0:k]$ to calculate $F[k+1]$ is equal to the number of trailing zeroes ... |
The Knapsack problem has a well-known FPTAS based on rounding and then using the pseudopolynomial dynamic programming algorithm. When the valuations $v_i$ are private, we also need the assignment rule to be monotonic (i.e., if a player gets included in the knapsack, then if he increases his bid/valuation, he should sti... |
Reading a bit about the subject of Multi-Bit tries and IP matching in:
High Performance Switches and Routers H. Jonathan Chao, Bin Liu. Page 33
Network Routing: Algorithms, Protocols, and Architectures (The Morgan Kaufmann Series in Networking) April 12, 2007
by Deepankar Medhi. Page 507.
And they both mention path... |
The Problem:
Suppose you have a simple polygon (edges don't cross). Find the union of of all 1x1 squares that fit in the polygon. To be clear, I am asking for the union of all points that are in some square that fits into the polygon. Maybe the border of this union can be expressed as a shape whose edges are line se... |
I am contemplating the Church-Rosser property and I clearly misunderstand it, but I do not exactly know why. If $x$ and $y$ are such that $x \overset{*}{\leftrightarrow} y$, then $x \overset{*}{\rightarrow} y$ and since $y \overset{*}{\rightarrow} y$, we have that both $x$ and $y$ reduce to $y$ (or $x$, for that matter... |
Can anyone explain me what (problem-)kernels are and what's the use of them? My slides say:
The kernel of a parameterized problem $L$ is a transformation $(x,k) \mapsto (x',k')$ such that:
$(x,k) \in L \Leftrightarrow (x',k') \in L$
$|x'| \leq f(k)$ for some function $f$
$k' \leq g(k)$ for some function $g$
transfo... |
Say I have some problem of $O\left(n^k\right)$ complexity.
If I were to solve the problem on a computer $x$, it would take time $t$.
Now I have a new computer $x'$, which has double the computing power of $x$.
How long would it take $x'$ to solve the same problem in terms of $t$?
|
Let $K$ be the halting set and suppose $K \leq_m A$ (under some function $f$), that is, $K$ is many-one-reducible to $A$.
How can $f(K)$ be a finite set?
Why if $B$ is recursive, is $f^{-1}(B)$ also recursive?
|
I'm currently developing my degree thesis, and the lab's idea is to design a new micro architecture, and then, be able to compile stuff for this architecture. So the question is, how do you instruct a compiler to generate your new assembler???
The general idea is to be able to compile with gcc and run netbsd or similar... |
Can anyone help me demonstrate these two statements?
$$ n! = o(n/2)^n $$
$$ n! = o(n/3)^n $$
I am sure about the first one but I don't know how to demonstrate it. As for the second one I am not sure whether it is true or not.
|
There's something I don't really understand about the Slotted AHOLA protocol, and I hope you can help me: what happens if a station wants to send two packets at the same time? Will it be considered as a collision? If not, when will the first and second package be sent?
I did some research here but all I found was prob... |
Consider the following problem:
You are on a road trip, and there are $n$ cities along a road, labeled
$1$ to $n$. Conveniently, these cities all lie on a single road, and
the distance between two adjacent cities is one mile. We are currently
at city $1$, and would like to drive to city $n$. Each day, we can
d... |
I don't recall hearing that nodes in red-black trees can't have one nil child and one non-nil child. However, I did hear that red-black trees have a worst-case height of $2log_2(n + 1)$, where n is the number of nodes, and I don't see how this could be the case if nodes can have one nil and one non-nil child, as a tree... |
What is the complement of $\mathrm{ACFG} = \{ G \mid G \text{ is a CFG and }L(G) = \Sigma^* \}$?
I think it is $\mathrm{ECFG} = \{ G \mid G\text{ is a CFG and }L(G) = \emptyset \}$.
It makes sense to me because the complement of the empty language is the universal language?
Am I correct?
|
Pretend you want to search through a max-heap to find a specific element. I know there is no such option but still... Would it take worse case O(n) or O(logn) time? I am assuming O(n) since the property of a max-heap doesn't really help us unlike a bst. Thanks.
|
I have two trajectories of a moving object. Each trajectory is composed of poses at discrete time. Each pose is a translation vector and a rotation matrix.
Each trajectory defines the same path (with noise) but expressed in some arbitrary frame of reference. I need to find the relative transformation that aligns both t... |
I have been trying to get to grips with what an exponential object is using a poset as an example.
So in the poset...
{2, 4, 6, 8, 9, 12, 14, 30, 36, 48, 60, 72, 84} x is related to y iff x is a factor of y.
I understand eg: hom(- x 60) is isomorphic to hom(-, 84^60)
so...
2x60 = 2... and 2->84
4*60 = 4... and 4->84
et... |
Lets say I have a few million random items. Each item has 6 attributes: Type, Cost, Strength, Stamina, Agility and Intelligence. Type is one of 4 different possibilities, the other 5 are various numbers
Now I must produce a set of 4 items where the inputs are X (the maximum cost of all items) and Y (one of the latter 4... |
As you know, an Oracle Turing Machine (OTM) is a "black box" which somehow can tell us whether a given Turing machine with a given input eventually halts. By Church's Thesis it is impossible to design an algorithm which is able to solve such a problem.
If we will never get such a black box then why is it important and... |
Let $n > 1$. For an integer $k$ with $0 \leq k \leq 2^n-2$ the cyclotomic class $C_k$ of $2$ modulo $2^n-1$ is the set given by
$$C_k = \{k, k\cdot 2, k \cdot 2^2 , \ldots, k\cdot 2^{n-1} \pmod {2^n-1}\},$$
where the entries are reduced modulo $2^n-1$. Note that either $C_k = C_i$ or their intersection is empty. A set... |
Is there a conventional symbol for "points to" or "is a pointer to". I've been using a short right arrow; for example "a is a pointer to b" would be (approximately)
a -> b
but I wonder whether a short double right arrow would be better:
a => b
Best of all would be to know, and use, a universally-accepted standard sy... |
I am looking for a workload which is hard to paralellise/distribute between multiple machines.
For example, integer factorization does not go 10 times faster if you have 10 machines to split the load, but is there a better example?
|
I looked at Linear Programming, and it are problems like this:
You know that Cabinet X costs 10 cents per unit, requires 6 square feet
of floor space, and holds 8 cubic feet of files.
Cabinet Y costs 20 dollars per unit, requires 8 square feet of floor
space, and holds 12 cubic feet of files.
You have been given 140 d... |
Given an undirected tree (i.e. a tree without any designated root) of even number of nodes.
The task is to remove as many edges from the tree as possible to obtain a forest of trees,
where each such tree contains even number of nodes.
And return/output number of removed edges as an output/answer.
Counting maximum numbe... |
I'm having some trouble understanding part of Skienna's algorithm for edit distance presented in his Algorithm Design Manual. I'm posting the recursive version, prior to when he applies dynamic programming to the problem, but my question still stands in that version too I think.
He provides the following code:
#define ... |
Let $n > 1$ and let $\mathbb{F}_{2^n}$ be the finite field with $2^n$ elements. The trace function $T(x) = x + x^2 + x^{2^2} + \cdots + x^{2^{n-1}}$ is an onto linear transformation from $\mathbb{F}_{2^n}$ to $\mathbb{F}_2$. There are $\phi(2^n-1)$ primitive elements in $\mathbb{F}_{2^n}$ (generators of the cyclic mult... |
Edit: Solved, see comments
I don't understand how the inorder traversal traverses through the whole tree. According to wikipedia, the pseudo code for the inorder traversal is:
sub P(TreeNode)
If LeftPointer(TreeNode) != NULL Then
P(TreeNode.LeftNode)
Output(TreeNode.value)
If RightPointer(TreeNode) != NU... |
I'm interested in learning about some of the algorithms available for multiplying non-square matrices, yet despite exhaustive Googling efforts I have been unable to find any discussions of such algorithms except for a couple of extremely general pieces of pseudocode that I found on Wikipedia and MIT OCW.
If anyone coul... |
I know that Symbolic Model Checking is state space traversal based on representations of states sets and transition relations as formulas like in CTL using models like Kripke Model. I know the theory. But I'm finding it hard to understand the actual application. Where exactly is it used? What exactly does it do and how... |
I came across a very hard interview question in last month’s Ph.D. entrance exam. It was asking which one of the languages is inherently ambiguous. Short answer says 2). Why is the language in 2) an inherently ambiguous language?
1) $L = \{a^n b^{2n} c: n\geq 0\} \cup \{a^{2n} b^n d: n\geq 0\}$
2) $L = \{a^n b^m c^p: n... |
I am reading a book on a computer science topic but lack some of the prerequisite background. Normally when I run into terms I don't understand I simply look them up, but for Universal Search I simply haven't been able to find an explanation suitable for a reader without a background in statistics/computer science.
I'v... |
I prepare for local complexity contest and review some old Interview questions banks. I get stuck in one problem and no idea how we can solve it. please share your idea or help with this question:
Suppose $C$ is a set of all one-variable computable functions,
$C^{(n)}$ is a set of all one-variable computable functi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.