instruction stringlengths 35 29.1k |
|---|
GeeksForGeeks
We are given an array arr of $n$ element. We need to count number of
non-empty subsequences such that these individual subsequences have
same values of bitwise AND, OR and XOR. For example, we need to count
a subsequence (x, y, z) if (x | y | z) is equal to (x & y & z) and (x
^ y ^ z). For a single eleme... |
I have a lot of difficulty with the turing machines. I understand the theory well, but I need help with a lab exercise...
Design a SINGLE TAPE Turing Machine that accepts the language $a =
> b \times c$ (or $1^{^{mn}}= 1^{^{m}} \times 1^{^{n}} )$, this means
that this language only accepts unary multiplications.
Some ... |
Planar graphs are graphs which can be drawn on the plane without edges crossing.
Disk contact graphs are graphs obtained as follows. Place some disks in the plane without overlaps, allowing touching. Create a vertex per disk, and connect vertices by an edge if the corresponding disks touch.
As stated by graph classes, ... |
Question: I came a cross a problem where we have a set of numbers $W= \{x_1, \cdots, x_n\}$ where repetition of numbers is allowed. We would like to find out whether we can find out 3 disoint sets where the sum of numbers in each set is equal, e.g., $W=\{1,5,2,4,3,3\}$ can be split into 3 disjoint sets $(1,5), (2,4), (... |
Given a distance matrix for 50,000 points, how do I select $N$ points so that the sum of all distances between the $N$ points is maximized? $N$ could be as high as 100.
To calculate the sum of distances for all sets of $N$ points would be exponential, which would not scale to 50,000 points.
What is the fastest algorith... |
It is clear to me that if some heuristic $h(x)$ is admissible, then $A^*$ is guaranteed to find a least-cost path. But is it also possible that $A^*$ is optimal if $h(x)$ is not admissible? In other words, should this be an if and only if relation?
One example that I am considering is graphs in the Euclidean plane. Ins... |
Assume a given NFA for a regular language with $n$ states. It is clear that determinizing it may result in an DFA with $\Omega(2^n)$ states. However, the minimization might decrease the number of states. Is there a counterexample which would show that the minimized version might aswell be of superpolynomial size? I.e. ... |
I try to prove the equivalence between the two following properties of an NP-Complete problem $P$:
(A) $P$ is unary NP-Complete if it is NP-Complete even if we encode the integers of the inputs with unary encoding.
(B) $P$ is strongly NP-Complete if there exists a constant $c \in \mathbb{N}$ such that $P$ is NP-Complet... |
On a lot of messaging applications, regex search isn't enabled due to a "linear scan". I'm not sure why this is the case. Can someone explain?
|
The "graph homomorphism problem" can be stated as: given two graphs $G$ and $H$, determine if there exists a homomorphism $f$ such that $f: G \rightarrow H$. This is a famous problem that is well-known to be NP-complete.
Now I'm thinking about a related problem: given two homomorphic graphs $G$ and $H$, find $f: G \rig... |
I see the following notations used:
$O(1)$-approximation
$O(n)$-approximation
$\Omega(n)$-approximation
Can someone please explain what they mean?
I know what an approximation is with a normal constant approximation (2-approx, 2/3-approx, etc).
And I know what $O(n)$, $\Omega(n)$ mean, but I just don't understand wha... |
From my reading and research it appears it's one way, however my lecturer states that it goes both ways in his examples.
Let me show you what i mean by this.
He claims that a binary tree built from a heap with numbers 1 - 7 appears as:
1->2->3
2->1->4->5
3->1->6->7
4->2
5->2
6->3
7->3
Whereas i would say it appears as:... |
Prove that if for every proposition $\psi\left(p_{0}, \ldots, p_{n}, p\right)$ there exists
$\phi\left(p_{0}, \ldots, p_{n}\right)$ in which $\psi\left(p_{0}, \ldots, p_{n}, p\right) \rightarrow\left(\phi\left(p_{0}, \ldots, p_{n}\right) \leftrightarrow p\right)$ is a tautology then $\phi$ is a definition of $p$ in te... |
Is it possible to build a linear bound automata that decides A(NFA)?
A(NFA)=Accepting Non deterministic Automata - language that contains the encoding of all the NFAs together with the strings that the NFA accepts
I tried to look online, in summaries and handouts and even in several books (including Sipser's book), but... |
Below are the two problems Im working on and my attempt at a solution (understanding the question). My first question is am I interpreting the question from the symbols right, second can you help explain what I need to do for these questions? Ive been reading through chapter 4 of Sipser 3rd ed. Intro to theory of compu... |
We define an $i$ - access PDA as a PDA that can manipulate the top $i$ characters in the stack, where $i>0$.
Given a transition function of the form $\delta(p,x,c,d) \to (q,c')$, where $d \le i, d > 0$, we read it as "When in state $p$, upon reading an input $x$, the stack has depth at least $d$, with $c$ at the $d$th ... |
Let
$$ x_{k+1} = x_k + u_k, \qquad x_0 = 5 $$
where $k \in \{ 0,1,2,3 \}$, define the return function
$$ - \sum_{k=0}^3 \left( x_k^2 + u_k^2 \right) $$
with the following inequality constraints on the control inputs
$$0 \leq x_k + u_k \leq 5$$
where $u_k \in \Bbb Z$. I would like to apply dynamic programming to find an... |
I am not asking about if it is possible to build a computer using only NAND gates, since that question has been asked infinite times. I wonder if it is possible to replace the “ALU” in the cpu of a computer, with just a single NAND gate. And, then implement the rest of the ALU with software.
CPU seems to basically get ... |
I have seen that most standard college textbooks of Database Management Systems use this method to classify whether a schedule is view serializable or not.
I know the definitions of Conflict Serializability and View Serializability, but I am unable to think of a generalized proof that the above flowchart is actually c... |
Let's say I have a list of intervals on a number line. The "depth" of a point on this number line corresponds to the number of intervals in the list that contain it [the point].
So for instance if I have the intervals [(1, 8), (3, 12), (4,6)], the deepest points comprise the interval (4, 6).
What is the fastest algorit... |
Learning Computer Graphics -
Can similarity transformation be linear transformation?
Similarity T is a rigid transformation (translation and rotations) with uniform scaling.
so I guess a similarity transformation can be linear. Am I missing someting?
Thank you
|
Suppose $A$ and $B$ are both languages over $\Sigma=\{0,1\}$. We use $n_0(x)$ and $n_1(x)$ to represent the number of $0$s and $1$s in the string $x$ respectively. Consider the following two operations:
$$
A\cong_0 B=\{x\in A\mid\exists y\in B,\ \text{s.t. }n_0(x)=n_0(y)\}\\
A\cong_{01} B=\{x\in A\mid\exists y\in B,\ \... |
The model is as followed:
Consider an infinite horizon discounted problem $(0 < γ < 1)$ in which the state space is finite, with $n$ states, and there are only two possible decisions: stop or continue.
If at time $t$ you are at state $s$, and you decide to stop, you incur a stopping cost $γ^t g(s)$, and
move to a cost-... |
Hello everyone I am new to the site, I have a question that was in the test and did not understand the parts that are in the question. This question from a test I failed to pass, in a machine learning course.
the question:
Suppose that $ F\subseteq\{0,1\}^\Omega $ is some collection of Boolean functions over $\Omega $... |
I need to know the analysis of time complexity of this case?
for k=1:(N-1)
for i=1:N-1
for j=1:N
if (Groups22(i,j)==Groups2(k,I)& AA(i,j)==AA(k,I)& BB(i,j)==BB(k,I))
Groups22(i,j)=nan;
end
|
Is it consistent with the current knowledge that there is an algorithm solving a 3-SAT instance in $n$ clauses in quasilinear time in $n$?
|
Everybody knows that if you try to register to a website with an email that does not exist, the website labels the email as "invalid". How do they know that?
|
We define an operation three on strings as three(c1c2c3c4c5c6...) = c3c6... then the above-described definition is extended to languages. Prove that the class of regular languages is closed under this operation.
|
I've been trying to create a function in TypeScript for converting to and from base58. I'm pretty familiar with base conversion generally: divide a number by a target base, and take each remainder as a digit of the conversion from right to left, until it equals 0.
But this took me into Bitcoin's source code, which does... |
I have a set $X$ of $n$ points in a $poly(n)$-dimensional $L^\infty$ space. Does there exist a way to map the points into $poly(n)$-dimensional $L^2$ space so that the distances between points in $X$ are approximately preserved?
Formally, let $S_1$ be the original $L^\infty$ space with $dim(S_1) = O(n^k)$ ($k$ is known... |
One advantage claimed for scapegoat trees over other balanced trees like AVL or red-black(RB trees - just mentioning AVL henceforth) is not needing to store additional balance information.
But can't an AVL tree node do without additional storage for balance information?
(I'm not considering possibilities to hide it in ... |
We say that a language $L$ is prefix-free if for every word $s\in L$ there does not exist a nonempty string $w\in\Sigma^*$ such that $sw\in L$ (i.e. no word in the language is a prefix of some other word in the language). For any given language there is a smallest prefix-free sub-language constructed by finding any tw... |
I'm trying to devise an algorithm to seat people at a table. The basic premise is as follows:
Given a list of $n$ tables, each with a different number of seats (e.g. $2, 4, 4, 5$), and a dictionary of who a person would like to sit next to:
Person A wants to sit next to Person B and Person C.
Person B wants to sit nex... |
as the title says does having a mutable transition function make the Turing machine more powerful
by mutable I mean we have a set of transition functions that we can choose one of them arbitrary based on the current state and symbol
in definition of Turing machine from wikipedia instead of $\delta$ we have
a set $\Delt... |
I have a set of 2D geometric figures in Cartesian space, as shown in the image. Each geometric figure has a start point and an end point (among other characteristics). For closed geometries, such as a circle, the start and end points are the same and for open geometries, such as lines, both points are different.
I nee... |
I need an algorithm to optimally stack a set of bricks in a 2D plane so that the resulting wall is as vertically short as possible. Bricks are defined as a pair of integers $(x_1, x_2)$ corresponding to the horizontal span of $\textit{width} = x_2 - x_1$ and are of equal height. Bricks cannot be translated left or righ... |
For entropy, the most common one is Shannon entropy, however, it ignores time series of data. For instance, data 0x00001111 and 0x01010101 are given the same entropy. It is obvious that the second data is more disordered than the first one which mean the entropy of the second one should be larger.
So, I find the second... |
I'm currently studying the ALU architecture (of a Hack computer) and how it works.
As part of my assignments, I have been asked the following question:
If we want the ALU to compute the function y-1, what should be the value of the zx (zeroed) and nx (negated)?
a. zx = 1, nx=1
b. zx = 0, nx=1
c. zx = 1, nx=0
d. zx = 0,... |
I have a database $D$ of n-dimensional numerical vectors, and I want to do an incremental KNN (IKNN) search over the vectors in $D$. More precisely, given a query vector $v_q \in D$ I need to find $k$ vectors $v_i \in D \setminus \{v_q\}$ sorted by value of $Euclidean(v_q, v_i)$ from low to high where $Euclidean(v_q, v... |
Given a random $3SAT$ instance $(S_0)$ with $C_0$ clauses, $I_0$ variables.
Objective: For any given value $C_1$ ($C_1<C_0$), create an 'equivalent' $3SAT$ instance $(S_1)$ with $I_0$ variables, $C_1$ clauses such that:
For any set of values for variables $I_0$, $S_0$ is satisfiable iff $S_1$ is satisfiable.
What is th... |
I need to cite a reference that the minimum makespan problem on ($>2$) identical machines is NP-hard. I've seen Garey and Johnson cited as a reference, but it I'm not sure which of the problems is exactly equivalent to this one.
|
Given the following language:
$$
L=\left\{\,(\,C,\,\{v_i\}_{i=1}^m, \,x\,) \enspace :\enspace \substack{C(x) \text{ is a boolean circuit with } m \text{ gates} \\i\text{'th gate value is } v_i \text{ on input } x} \right\}
$$
I need to find out to what known class $L$ is complete to with respect to logspace reduction... |
In number theory progress is sometimes guided by people stating a specific Diophantine equation that they don't know how to solve.
Is there anything similar in the field of Boolean satisfiability?
More specifically what is the smallest 3-SAT instance (measured by fewest number of variables) that people have tried to so... |
We want to write n in terms of multiplication of numbers from A = [1,...,n] such that the total cost is maximum. The cost of choosing the ith number is cost[i]. Note that cost[1] = 0 and we can choose 1 number multiple times.
For example :
n = 12
A = [1,2,3,4,5,6,7,8,9,10,11,12]
cost = [0,1,2,0,0,0,0,0,0,0,0,20]
12 = 1... |
I'm basically trying to figure out if the following problem has a common name and/or a standard solution in computer science.
Let assume we're given $N$ two-dimensional tuples $(x_i, y_i)$. This data is fixed/static and we want to pre-compute a data structure that allows to run interval queries returning the max or min... |
I need to say Is language $a^mb^nc^n, m \not= n$ context free
I managed to find a grammar for $L1 = $ { $a^lb^mc^n | l=m$ or $m = n$ }, but I couldn't find the one I needed. Maybe it is impossible, but than why? If it may be helpful, that is the grammar for L1 wich i found: $A \rightarrow \epsilon |aAb, B \rightarrow \... |
I came across this question in a job interview and I couldn't solve it.
In a n*m matrix some cells are blocked.The robot can only move in direction of (x-1,y+2) or (x+2,y-1). Is it possible to reach B from A? If yes how many minimum paths exists?
|
Consider an array $X$ with shape $H \times W$. Let $Y$ be the other array of the same shape and $Z$ is an array of shape $h \times w$.
We want to construct an array $R$ of shape $(H-h + 1, W-w+ 1)$ by the following rule:
$$\displaystyle R[k, l] = \sum_{i, j} (X[i,j] - Y[i,j])^2 +$$
$$ \sum_{i=0}^{h-1}\sum_{j=0}^{w-1}[... |
I'm trying to understand this algorithm : https://en.m.wikipedia.org/wiki/Expected_linear_time_MST_algorithm
As described in the wiki article, it works in 5 steps to find the MSF for a graph $G = (V, E)$:
Do two iterations of Boruvka resulting in a graph $G'= (V', E') $
Select each edge from $E'$ with probability $1/... |
This Question can be found in the book: ODS: An Introduction (Chapter 6)
Suppose we are given a binary tree with pre-, post-, and in-order numbers assigned to the nodes. Show how these numbers can be used to answer each of the following questions in constant time:
a. Given a node n, determine the size of the subtree r... |
The task:
You are standing in front of a gigantic forest of syntax trees. One tree looks more fascinating than the other. In front of the forest is a sign:
"Every tree in this forest arises from a derivation with exactly two steps and has exactly 2021 leaves."
If you can figure out how many different trees are in the f... |
Given an undirected connected graph $G = (V, E)$ with weights $w : $E → $R$$^+$, define for a spanning tree T the value $λ$(T) = $max_e$∈$T${w(e)} (the maximal edge weight in T ).
I need to find a linear deterministic algorithm of finding a spanning tree T with minimum maximum edge e. We were given a hint of using bina... |
Let's say you have this mapping of symbols and codewords:
$$
\begin{array}{cc}
\hline \text { Symbol } & \text { Codeword } \\
\hline \text { A } & 101 \\
\text { B } & 100 \\
\text { C } & 01 \\
\text { D } & 00 \\
\text { E } & 110 \\
\text { F } & 111 \\
\hline
\end{array}
$$
How is it possible to determine the prob... |
A full $m$-ary tree with $n$ vertices and $i$ internal vertices has $n = m \cdot i + 1$ vertices and
$l = (m − 1)i + 1$ leaves.
How can I prove it?
I know that $m$-ary tree is a rooted tree such that every internal vertex has no more
than $m$ children. The tree is called a full $m$-ary tree if every internal vertex ha... |
The text Introduction to Algorithms by Cormen, et. al. defines the Ackermann Function $A$ as follows:
For integers $k \geq 0$ and $j \geq 1$, we define the function $A_k(j)$
$$A_{k}(j) = \begin{cases}
j+1 &\quad\text{if } k=0\\
A_{k-1}^{(j+1)}(j)&\quad\text{if } k \geq 1\\
\end{cases}$$
The inverse of th... |
I am studying LALR(1) parser and I have this question:
Consider the following Grammar
S - > V = E
E - > F | E+F
F - > V | int | (E)
V - > id
Construct the LALR(1) parsing table for this Grammar.
While generating the item-set DFA for this problem, I encountered a problem in the fifth set.
According to this website, htt... |
I am working with a piece of software code which transforms a character array into a single integer. For example, if I have the array [ a, b, c ], then it becomes 97 + 98 + 99 = 294, for ASCII 'a' = 97, et cetera.
So this code converts an arbitrary-length sequence of characters into a single number. The transformation ... |
I have a graph and don't know how nodes in it are connected to each other.
I know the number of nodes in the graph.
I know the degree of each node in the graph.
I know that given any node $A$ that any other node $B$ is $n$-connected (where $n$ may vary per $B$) to a sub-graph containing $A$. So if I trim $n$ specific ... |
How can we construct the algorithm to evaluate the logarithm of a real positive number bit by bit in the base 2 system?
I have first expressed any number as $x\cdot2^n$, where $x \in [1,2]$, by shifting the binary points. But after that, I am not sure what to do.
|
I am learning how to extend a basic Hindley-Milner type system to support overloaded variables by following Geoffrey Seward Smith's dissertation.
The proposed type inference algorithm makes use of the "least common generalization" (or LCG) of an overloaded variables types and cites this Reynolds paper as providing an a... |
Let $G$ be a non-complete weighted (only positive weights) undirected connected graph. I'm trying to find a path such that it visits all nodes at least once (repeating nodes is allowed), and it's the shortest one. Length of the path is defined as the sum of weights of all traversed edges, including the repeated ones. T... |
Say I have two noisy / lossy streams of symbols of the same data. Essentially, I want to match up the two streams as best as possible. For example, say I have:
s1 = 1 2 6 3 8 0 4 3 2 7 6 2 ...
s2 = 1 2 3 6 3 9 3 2 7 6 2 ...
and I'm essentially trying to end up with this:
s1 = 1 2 6 3 8 0 4 3 2 7 6 2 ...
| | ... |
My problem is the following: I have $N$ inner products to compute in parallel every second.
Each of the vectors in those inner product is composed of $7$ bits.
I want to know for which $N$ it starts to become computationally intensive to do that, let's say that a supercomputer would have struggle to follow it.
I know t... |
It is known that Graph Isomorphism is important in chemistry (studying molecule structures) and in chip design. Are there other applications of significant practical importance, and how much money is involved?
Is the industry interested in new efficient algorithms, or WL and DeepWalk are enough? Having a new efficient ... |
My professor gave an introduction to the arithmetic hierarchy via Turing reductions, stating that, for instance, $\Sigma_2 = \text{r.e.}^\text{r.e.}$ (namely an $\text{r.e.}$ pseudocode with access to an $\text{r.e.}$ oracle) or $\Pi_3 = \text{co-r.e.}^{\text{r.e.}^\text{r.e.}}$. Later, the equivalent formulation via a... |
When you release your IP address using the ipconfig/release command and then renew with ipconfig/renew, the computer will request and receive the same address you had previously.
Why is this so?
How would you (what commands would you use) so that your computer will not request the same address?
|
Let $H_{1}$ and $H_{2}$ are two hypothesis classes over some domain $X$1.
If both $H_{1}$ and
$H_{2}$ have the uniform convergence property, then do $H_{1}$ U $H_{2}$ have uniform convergence?
|
People have recently started talking about "differentiable programming". I have listened to some people talk about this at a philosophical level, but I don't see the practical difference between this and just existing Autograd libraries like PyTorch.
I understand that (at least according to some interpretation of "diff... |
I found this paper http://nomis80.org/ctmf.pdf, that describes an efficient algorithm for applying a median filter to an image. Though this works for non-HDR images, I am not sure how well it scales in HDR scenarios. The concern is that if the dynamic range is extended, it is no longer true that the number of intensity... |
I am looking at the proof of the Cook-Levin theorem in Computers and Intractability: A Guide to the Theory of NP-Completeness. In particular, I find one thing unclear. He constructs the statement that is satisfied if and only if transition from step $i$ to step $i+1$ is correct. It goes as follows:
So essentially thes... |
An undirected tree has $n$ nodes and some nodes contain a fruit. How many ways can we remove edges from the tree such that each sub-tree has exactly one node with fruit in it?
I found this question in an algorithm book without any hint.
My approach : Let $C[i]$ be the number of ways we can cut the edges if node $i$ was... |
There is a common leetcode problem that asks
Given $n$ non-negative integers $a_1, a_2, \dots, a_n$, where each represents a point at coordinate $(i, a_i)$. Then $n$ vertical lines are drawn such that the two endpoints of the line $i$ are at $(i, a_i)$ and $(i, 0)$. Find two lines, which, together with the x-axis form... |
I have a problem related to a common dynamic programming problem LIS. I got LIS function that takes arr as an input and returns the length of the longest increasing subsequence.
def LIS(arr):
n = len(arr)
# initialize LIS values for all indexes
lis = [1]*n
# Compute optimized LIS values in bottom up ... |
Operating System MCQ Question:
If a system has 1 GB RAM with a page size of 8KB and operating system occupies 16 MB of RAM, how many page frames does the system have for user process?
a. 129024
b. 120924
c. 131072
d. 119864
|
In optimization, particularly evolutionary computation, we often try to optimize (through either minimization or maximization) non-smooth, non-differentiable, discrete functions that aren't readily visualized (for example through function plotting).
Given this, it's often challenging to picture the shape of the resulti... |
Intuitively, this seems impossible (because negation is forbidden in the head), but i am not sure.
A naive (and wrong) example is
p :- p
But, this just means
¬p or p
We can get the assignment p=true, so no contradiction.
Could you give me an example of contradictory horn clauses without goal clauses if it is possible... |
I would like some advice in this homework question. There is a three players game, in which each player ($A, B$, and $C$) is given a $n$-length array of integer values. There are $n$ rounds in this game. At every $i$-th round the players have to choose one value among $A[i]$, $B[i]$ and $C[i]$, which is going to be the... |
C's char array can hold an ASCII string, such that a user can query individual characters by indexing the char array, modify them or do what ever they want to, its pretty straight forward. I have browsed through many questions+answers on stack(exchange|overflow) on topic of unicode strings in char arrays but haven't fo... |
https://atcoder.jp/contests/past202004-open/tasks/past202004_f
I am trying to solve the following problem:
We have $N$ tasks. Let today be Day $1$. You can do the $i$-th task on or after Day $A_i$, and finishing the task gives you $B_i$ points.
Each day, starting with today, you choose one task and finish it. For each... |
I have this graph that I created and am wondering how DFS and BFS would work on something like this. I made this graph undirected and am going off the premise that if possible, a vertex should be visited in numerical order
|
I have the following problem:
let $(a_1,b_1)$ and ($a_2,b_2)$ be to geodesic lines on the sphere, i.e. great circle arcs.
I need to determine, if the two arcs intersect.
I already have a working solution namely: this blog post.
The idea is the following: Calculate the two intersection points of the great circles and af... |
If a $\mathsf{PSPACE-Complete}$ problem (say $\mathsf{TQBF}$) has an algorithm that has the runtime $\mathsf{NP^{NP}}$ it follows that $\mathsf{PSPACE=\Sigma^P_2}$.
Does that also imply $\mathsf{\Sigma^P_2 = \Pi^p_2}$?
Moreover, does that imply $ \mathsf{\Delta^p_2\subset \Sigma^P_2}$ or is that question still open?
|
Though the concept can be for many RTS games but lets use the specific system of 'age of empires'. For simplicity one resource will be considered. Food.
So in the game there are villagers who gather resources. And resource food is used to create new villagers.
Lets say it costs x (ex: 50 unit) amount of food to create ... |
It is agreed upon that the time complexity of BFS is $O(|V| + |E|)$.
Breath first search usually is used within a connected component. The connected component with the least $|E|$ given a fixed $|V|$ is a tree graph where $|E| = |N| - 1$. Therefore $O(|E|) \ge O(|V|)$ given a connected component.
Why is the runtime com... |
I understand how CPUs work in general in RiscV, but things got a little complicated with pipeline and I don't get it why we need registers at all. For example, let's look at:
When the ALU's input was Reg File's output before adding support to pipeline, so what has changed now?
We can still do that same as when the clo... |
I was wondering about a kind of grammar where we can expand rules of the form A -> X|Y|... with A being a nonterminal and X and Y being strings of nonterminals or terminal symbols, but the expansions of X and Y (and all other rules under A) must all be the same. Is there a name for this? It feels like it is probably a ... |
How would you determine if these arithmetics are sentences or not?
-(x + 2) > y
i++ == 2
i++ == 2 is this sentence True where i = 1
I understand it as if the expression can be determinated as true/false, and there are no free variables, it is a sentence. But in my mind only the last one is a sentence since the variabl... |
Suppose we are give a natural number $n$, the value of $\sin(x)$ and $\cos(x)$. How efficiently can we compute $\sin(n x)$?
My Thoughts :
The $\sin (n x)$ expansion will have $O(n)$ terms. The power terms will take $\log(n)$ time each to compute. But there will be a term $nC_n/2$ so if $n=10$ this will be $10/5$. How... |
We say that an undirected graph $G=(V, E)$ is special if for every vertex $v\in V$ and edge $\{u, w\}\in E$, it holds that $\{v, u\}\in E$ or $\{v, w\}\in E$. In other words, a graph is special if for every vertex $v$, the set of the vertices that are not neighbors to $v$ is an independent set.
Is the vertex cover prob... |
In order to calculate the Kolmogorov complexity one has to "count" the minimum amount of operations it takes for a certain task(from here). Since the game of life (or cellular automata) outputs are non predictable and not compressible the amounts of rules applied should equal the Kolmogorov complexity? Or does the fact... |
Given integers a, b, and c all <=n, is there an efficient algorithm to find an integer y
such that a | c + b*y? One brute force approach will be to check for all y = 0 to n
and if there is a solution, there must be a solution within this range.
That will be O(n)
|
In the third edition of "Introduction to Algorithms" by Cormen et al ("CLRS"), section 17.4 ("Dynamic tables") is an overview of amortized analysis as it relates to managing the array-backed storage of a table of values.
I'm particularly concerned about the analysis of the TABLE-REMOVE algorithm: either I'm misundersta... |
And I assume these new data structures are more context/field-specific?
|
This is a homework question. Let $G = (V, E)$ be an undirected graph. Let $u, v, w \in V$, find a path from $u$ to $w$ that passes through $v$. I know that I can solve this by running BFS on $u$ and then on $v$. If $v$ is a reachable from $u$, and $w$ is reachable from $v$, then I just output the shortest path from $u$... |
This question relates to the 2nd edition of Probability and Computation by Mitzenmacher and Upfal.
The authors then use the Law of Total Probability
My question concerns the line that begins with $\leq$. Shouldn't that be replaced with $=$ because the authors proved that the event $\mathbf{AB} \bar{r} = \mathb... |
This question isn't very technical, but I'm in desperate need of help and I thought this would be the best place to post this question. I'm in an computer science course, data structures and algorithms and we have dealt mainly with singly / doubly linked lists as our main data structure, skip lists and time complexity.... |
We all know that We estimate our running time by drawing a graph and Big O and Big Theta is our worst and average running time respectively and we graph our function like :
$ O(g(n))= f(n)$ and create a range $0<f(n)<cg(n)$
and for $\Theta(g(n))$ $0<c_21g(n) <f(n)<c_2g(n)$
here What does g(n) means precisely and how do... |
I would like some hint in this homework question. I have to write the max-flow problem (with souce $s$ and sink $t$) as a linear program. I have to do this by defining variables on each $s - t$ path, which is different than the typical approach of considering as variables the flow of each edge.
So far, I thought on the... |
Suppose $f_1(n)=n\log^*n$,$f_2(n)=n\log h$ that $h$ is number of vertices of convex hull.
Can we conclude that
$$f_1+f_2=O(f_2)?$$
Edited:
Note that, $h$ is a function accroding to $n$ that $h\leq n$, and according to the input $n$ it can be less than $n$ such as constant.
$n\log h$ is running time of an ouput senseti... |
For a regular language $A$ with the alphabet $\{a, b\}$. Is $L$ a regular language, where $L$ contains strings of $A$ but sorted with $a$ and $b$?
In other words, formula: $L = \{ a^{\#_a(x)}b^{\#_b(x)} \mid x\in A\}$, where $\#_a(x)$ is the number of $a$'s and $\#_b(x)$ is the number of $b$'s.
$A$ is a regular languag... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.