instruction stringlengths 35 29.1k |
|---|
Some computational problems have different complexity on different graph classes. For instance, 3-edge coloring is NP-complete on cubic graphs but polynomial on cubic bipartite graphs.
What are the graph problems that have different complexities on directed and mixed graphs.
A mixed graph can have both directed and u... |
I have an algorithm broken down into the pseudish code below. But the gist of it is, we go through every person in a list, we then ask them to talk to all of their friends. Every time we choose a person to eval in the list, it costs $log N$ time. Every time that person talks to a friend it costs $log N$. What is the ti... |
for i = 0 ... log(n) - 1
for j = 2^i + 1 ... 2^(i + 1)
[code with Big-Theta(1) running time]
Given this piece of code the outer loop runs log(n) times. But I'm confused as to how to try to calculate the running time of the second loop so as to multiply them. Thank you for reading.
|
The following formulas are said to be defined in WS1S logic.
$Closed(Z, R) := ∀x ∀y(x ∈ Z ∧ R(x, y) → y ∈ Z)$
$(z_1, z_2) ∈ R^∗
:= ∀Z.(z_1 ∈ Z ∧ Closed(Z, R) → z_2 ∈ Z)$
However since WS1S formula requires bounded second order variables to be finite, I am not sure if the second formula is valid. $Z$ which is bounded he... |
I am familiar with mathematical (gradient-based) optimisation methods, some heuristic methods like GAs or linear programming methods like simplex algorithm.
I am not too familiar with graphs / trees and their search.
But it does seem like all possible solutions can be represented as a graph and a graph search algorith... |
Given two languages $L_1$ and $L_2$, is there a known way to show that $L_1\not\leq_T L_2$?
In other words, is it possible proving that there is no Turing reduction from $L_1$ to $L_2$?
|
I'm not sure what the following algorithm does but it seems that it calculates the shortest paths from a node $t$.
Initially we're given a graph $G=(V,E)$ with non-negative weights $c(e) \ge0$ for each edge $e\in E$ and we're given a node $t\in V$.
The algorithm is as follows:
Initialize array $A$ such that $A[v] = 0... |
This question was asked in peter linz exercise. I have tried languages such as $\phi,\epsilon,\Sigma^*$.
|
How to proof UNIQUE-SAT is in $\Delta^p_2$ or in $P^{sat}$
1) when given a bool formula can I ask oracle whether the given formula has at least one satisfying truth assignment and whether it has at least two?
2) Is UNIQUE-SAT in NP?
|
My problem is as follows. I am working on an experiment where I need to align a 3D vector with spherical coordinates $\vec{v} = (r, \phi, \theta)$ (red) to an infinite 1D line (blue). That line lies, at some unknown angle $\xi$, in an infinite 2D plane, with unknown vector span (green).
To do this alignment, I can in... |
Till now I have believed that a LL language is a language generated by a LL grammar. Same goes for LR.
Now I know some of the hierarchies such as $LL(1)\subset LR(1)$. I used to think that the hierarchy is valid for language as well as grammar i,e if a grammar is LL1 then it must be LR(1); If a language is LL(1) then i... |
From Database Management Systems, by Raghu Ramakrishnan, Johannes Gehrk
Let R be a relation schema, F be the set of functional
dependencies (FDs) given to hold over R , X be a subset of the
attributes of R, and A be an attribute of R. R is in third
normal form if, for every FD X -> A in F, one of... |
For general linear programming (LP), i.e. optimization of a linear objective over a general polyhedron, to the best of my knowledge/recollection one can use the simplex algorithm (or hypothetically, although it's not done often in practice, the ellipsoid algorithm).
Matroids are well known for the property that the gre... |
It is quite straightforward to understand $\#P$ closure under addition and multiplication since there are canonical $NTM$ constructions.
Is there illustrative non-trivial example to understand $NTM$ construction for closure under binomial coefficients?
|
Currently we are discussing applying Johnson's algorithm on undirected graph with negative edge weights. And the graph may contains cycles, but the sum of weights of any cycle is guaranteed to be non-negative.
If we consider the undirected graph as bi-directed, then any negative-weight undirected edge will create a ne... |
Consider a finite set of colors and a given an unweighted graph with the following properties:
1) Graph is connected.
2) All vertices of the graph has a color in the given set of colors.
3) No two adjacent vertices have the same color.
Define a flip as the following: change the color of a given vertex V AND all reachab... |
Why not to some constant like 3 or 4 dimension? I suspect that it is because Cholesky Decompostion will work only for $n \times n$ matrix $B$ where $B^TB = P$ where $P$ is a semidefinite matrix. Is it true? Or there is something else?
|
I have this initial function \begin{split}(\overline{A}+\overline{B})(\overline{D}+\overline{C})+AB\overline{(\overline{C}+\overline{D})}\end{split}
Which i reduced to \begin{split}{\overline{AB}*\overline{CD}}+ABCD \end{split}
The first part is easy to do with NAND but the OR ABCD part i have no ideia how to do...I su... |
Hi I'm doing some exercices on reductions and one of them is like this:
My problem rather than doing the reduction is understanding it. For the positive case I want that if Mx(x) never stops then p's domain has to be strictly included in q's domain which has to be stricly included in p's range. Am I wrong? Therefore ... |
I am new in Computer Vision. Suppose you have 8 points (players in a basketball court) in a 2D image (png photo), that is we know the pixel coordinates of each. I would like to compute camera position w.r.t. the field. We have the actual dimensions of the field. Also, I can write the equations of two or three transvers... |
Does anyone know of an algorithm who is able to return how similar a DFS Tree is from another DFS Tree? (Or any kind of tree in general)
I'm not looking for a true or false. Instead, I would like it to return something in the form of "DFS A is ~87% similar to DFS B"
Thanks!
|
For any integer $k$, does there exist a decision problem in $\textbf P$ that can be proven to require $\Omega(n^k)$ steps?
|
I want to solve the following problem:
You have a list of numbers, for example [10, 33, 7, 7, 12].
The goal is to find the permutation of this list that maximizes the function $\sum_i a_{i-1} a_i a_{i+1}$, where indices are cyclic (taken modulo the number of elements).
My initial thought was to simply sort the list b... |
I need to come up with an algorithm that iterates through an array and if any element appears m times, then the array needs to be modified so that it only appears min(2, m) times. For example, if A = [2, 2, 2, 3, 4, 4, 5, 5, 5] and m = 3, A = [2, 2, 3, 4, 4, 5, 5]. It is easy to do with extra space or nonlinear time bu... |
I understand how to calculate the probability of a hash collision.
I am designing a DB and have a potential case where a record could have the inherited hash of its parent plus its own hash, meaning I could potentially query two hashes to determine probable record matches.
If I have 1 billion records, a 64-bit hash wil... |
Consider the problem of designing a data structure that provides the interface functions $\rm{pop}, \rm{push}, \rm{findmin}$, all running in constant time. This problem may be solved by (e.g.) having the $\rm{push}$ method compute the new minimum as well, and place it on the stack together with the pushed element.
Is ... |
I want to calculate the time complexity of the listed algorithms, please correct if I'm doing something wrong:
The question is, do some operations like multiplying, dividing, or plus really affect on time complexity ?
// Time complexity is O(log n)
void calculate(n: Int) {
while (k < n) {
k *= ... |
I'm trying to explain the basics of Bitcoin to my parents.
One of the core components of bitcoin, is signing transactions to make sure your identity can't be impersonated, and thus the need to explain a simplified asymmetric cipher.
What's an extremely simple asymmetric cipher I can use as an example?
How can this simp... |
I want to construct a FA for the language
$\{w \in \{a,b\} | $length of w is either even or divisible by 3$\}$.
I've been playing around with some FAs, but I can't seem to create one that does the job. I can easily create one that accepts words with even length, and also one that accepts words with lengths divisible by... |
One thing I understand is that the complement of every Turing recognizable(but not decidable) language is non Turing recognizable.
What about the complement of non Turing recognizable language? Is the complement of every non r.e a recognizable language.
I don't know how to approach this problem.
But one idea I had was... |
I have a DAG and I wish to find the minimal set of vertices that have a path to all other vertices.
My solution was to simply find all the vertices that their incoming degree is 0.
However, if there are two vertices in the DAG that have an indegree of 0 and that point to a common vertex then one of the two vertices is ... |
Options are:
Signed magnitude
One's complement
Two's complement
Excess notation
This is the question from an 'example of a previous exam' I've been given at university. Answers were not provided.
As far as I understand only one answer must be chosen, but I'm not seeing which one.
My attempt at solution
As we see fro... |
Implemented is done in C++.
Supposing we have defined a class T with no restrictions and three functions cond, next and f returning bool, void and anything respectively, are
for(T k = T(); cond(); next())
f();
and
{
T k = T();
while(cond()) {
f();
next();
}
}
So, I would like know that time complexity of... |
Exactly $1$-in-$3$ SAT ($X_3SAT$) is a variant of the Boolean satisfiability problem. Given a set of clauses, each clause having three literals, is there a set of literals such that each clause contains exactly one literal from this set?
$X_3SAT$ is known to be $NP$-complete. It remains $NP$-Complete even when it is mo... |
If $f(n)=\Omega(g(n))$ and $h(n)=\theta (g(n))$ then does this implies $f(n).g(n)=\Omega(g(n).h(n))$
I saw a proof where they have proved If $f(n)=O(g(n))$ and $h(n)=\theta (g(n))$ then this implies $f(n).g(n)=O(g(n).h(n))$.
So I thought may this should also hold. I have taken some examples and the formula holds on a... |
If I understand it correctly, an algorithm that computes the value of a real function $f$ has computational complexity $O(g(n))$ if the following holds:
When we compute $f$ to precision $\delta$ requires on the order of $g(n)$ steps.
However, what if we have an algorithm that first "finds a more efficient algorithm to... |
INOI 2017, Problem 2, Training
Ash and his Pokemon Pikachu are going on a journey. Ash has planned his route for the journey so that it
passes through N cities, numbered 1, 2, …, N, and in this order.
When they set out, Pikachu has an initial strength of Sin as well as an experience value (XV) of 0. As they
travel th... |
How do you define $\oplus P\cap PP$?
$L\in\oplus P$ iff $\exists\mbox{ NTM }M:\forall x,\#acc_M(x)\mod2\equiv0$.
$L\in PP$ iff $\exists\mbox{ NTM }M:\forall x,\#acc_M(x)>\#rej_M(x)$.
Consider the classes $C_1,C_2,C_3$.
$L\in C_1$ iff $\exists\mbox{ NTM }M:\forall x\#acc_M(x)>\#rej_M(x)\mbox{ and }\#acc_M(x)\mod2\equ... |
Consider language $L = \{<M> |L(M) \subseteq L(0(0\cup1)^*) \}$
where $<M>$ is a valid encoding of a turing machine.
I know that the language is applicable for Rice Theorem.
Now, I understand that in this case the language group in $RE$ is:
$C = \{L\subseteq \Sigma^*|L\subseteq L(0(0\cup1)^*)\}$
However, I'm not su... |
If I have numbers ranging from 1 to n, and I generate all the permutations of these numbers. Now, I create Binary search tree from these permutations. For a value n i want to know how many BSTs would have same structure. for example for n=3; we have:
1,2,3
1,3,2
2,1,3
2,3,1
3,1,2
3,2,1
In this 2,1,3 and 2,3,1 pr... |
From Sipser Gacs we know $x\in L(M)$ for a machine $M\in BPP$ $\iff$ $$\exists t_1,\dots,t_{|r|}\forall r\in\{0,1\}^{|r|}\vee_{i\in\{1,\dots,|r|\}}M(x,r\oplus t_i)=1.$$
From Adleman we know $x\in L(M)$ for a machine $M\in BPP$ $\iff$ $$\exists r\in\{0,1\}^{|r|}M(x,r)=1.$$
Why is this just $BPP\subseteq P/Poly$ (look... |
Over the alphabet $\Sigma=\{a,b\}$, we define
$$L=\{a^pb^m: p\text{ is prime }, m>0\}+\{a^r:r\geq 0\}.$$
I must show that this laguage is not regular using the pumping lemma. I guess I should apply it to a word of the form $a^pb^m$, and my intuition is that I should come to the contradiction of $p$ not being prime. Bu... |
Where can i find a proof related to the subject mentioned?
|
Consider the following context-free grammar:
$T \to (*) \mid (T*) \mid (*T) \mid (T*T)$
This effectively forms a notation for binary trees: A binary tree is a $*$, with optional children on either side, all surrounded by $()$. This is clearly unambiguous, because you can distinguish between the presence and absence o... |
I am going through the following lecture notes on LR parsing :
https://www3.nd.edu/~dthain/courses/cse40243/fall2016/chapter4b.pdf
For the following grammar :
The following LR automation has been done :
and the following is the LR parsing table drawn for it :
In the table I can see that the alphabets "R" ,"G" and "... |
I just want to know whether there exists a horn formula that is equisatisfiable to $(p\lor q)$. I would also be interested to learn if there exists an equivalent as well.
|
In the Floyd-Warshall algorithm we have:
Let $d_{ij}^{(k)}$ be the weight of a shortest path from vertex $i$ to $j$ for which all intermediate vertices are in the set $\{1, 2, \cdots, k\}$ then
\begin{align*}
&d_{ij}^{(k)}= \begin{cases}
w_{ij} & \text{ if } k = 0 \\
\min\{d_{ij}^{(k-1)}, d_{ik}^{(k-1)} + d_{kj}^{(k-1)... |
I want to create a regular expression for the language
$L=\{ w \in \{a,b\} |$ w has neither aa nor bb as a subword$\}$.
I've tried various things, but I can't seem to get the correct regular expression.
|
If I have the following two languages:
$L_1= \{ w \in \{a,b\} |$ $w$ has neither $ab$ nor $ba$ as a subword$\}$
$L_2= \{ w \in \{a,b\}^* |$ $w$ has neither $ab$ nor $ba$ as a subword$\}$.
Is there any difference between $L_1$ and $L_2$? I understand the impact of the Kleene star, but I don't see what difference it make... |
Can a 3 color DFS be used to identify all cycles in a directed graph not just detect them?
In other words if I have a directed graph with multiple cycles, can I run a function on them such that the function returns the list of nodes that compose each simple directed cycle in the graph and not just a boolean true or fa... |
I am working on exercise 12.4-5 of CLRS (Cormen et al, Intro to Algorithms 3rd ed)
Consider RANDOMIZED-QUICKSORT operating on a sequence of n distinct input numbers. Prove that for any constant k > 0, all but O(1/nᵏ) of the n! input permutations yield an O(n lg n) running time.
By RANDOMIZED-QUICKSORT, they simply me... |
I am doing some past exam papers and I found two interesting questions which I cannot answer due to them not being extensively covered in the lecture notes given to me by my lecturer.
The questions go like this:
"Explain the mechanism a SIMD computer uses to support conditional statements like if and while."
SIMD is... |
I've been asked a question about B+ Tree.
The question is: Suppose we have object of the following type:
class Obj {
private:
int value;
int key;
public:
Obj(int uniq_key , int value)
}
and I am creating a Generic B+ tree which will sort objects in it leafs nodes by keys and not by values. (The keys are uni... |
Consider the sequence $s_1 = (1, 0, 1, 0,\dots)$. It seems "regular" in a way that, e.g. $s_2 = (1, 2, 3, 4,\dots)$ is not.
I'm not sure how to formalize this intuition though. One thing which jumps out at me is that $L =\{(0 1)^n\}$ is a regular language, and $s_1$ is in some sense the limit of the strings in this la... |
Note, while I know how to program, I'm quite a beginner at CS theory.
According to this answer
Turing completeness is an abstract concept of computability. If a language is Turing complete, then it is capable of doing any computation that any other Turing complete language can do.
And any program written in any Turi... |
I read the lecture 4 of CS162 (UC Berkeley: https://inst.eecs.berkeley.edu/~cs162/sp17/static/lectures/4.pdf), but I got little bit confused about the meaning of the keyword "buffered" they used when mentioning the following informations:
Kernel buffered reads
Kernel buffered writes
Data buffered automatically by C-li... |
Brian Randell, in his article The COLOSSUS, explains how computing ushered in the 20th Century, by the development of the Colossus computer. He cites a passage from the Passages from the Life of a Philosopher, illustrating how Charles Babbage described the Analytical Engine :
That the whole of
the conditions which e... |
I recently got asked the following question:
A set of $n$ cities are numbered from 1 to $n$. Given a positive integer $g$, two cities are connected if their greatest common divisor is greater than $g$. The number $n$ may be as large as $10^5$.
Alice has a list of $q$ cities that she'd like to visit. Given Alice's list... |
I've looked through CS SE and I've found a page that said you could find use BFS to find a MST if the edges are unweighted, but what if the edges are directed?
Given a directed graph between V vertices, I'm trying to find the minimum directed edges I need to add in order for every vertex to be connected to every other... |
I'm interested in using a random projection as a locality sensitive hash. In every example of this I've seen, it is suggested to pick a random hyperplane and produce a binary number corresponding to which side of the hyperplane a data point lies. I want to use locality sensitive hashing with a random projection, but I ... |
I've written a political quiz based on data from the public whip. They group politicians' votes by policy; each vote can belong to many policies. There are too many policies for me to ask a question for each one, and anyway some are duplicates and some policies' votes are subsets of other policies. In the past, I've... |
I came across following problem:
$S→ER$
$R→∗E\{print(′∗′);\}R∣ε$
$E→F+E\{print(′+′);\}∣F$
$F→(S)∣id\{print(id.value);\}$
Here $id$ is a token that represents an integer and $id.value$ represents the corresponding integer value. What does this translation scheme prints for an input "$2∗3+4$"?
Here are things ... |
Recursion schemes are structured methods for expressing recursive functions, of increasing interest due to their ubiquity in functional programming. For example, catamorphisms (familiar in the guise of 'fold' on lists) can be defined for all inductively-defined (i.e. algebraic) data types and in the particular case bel... |
I'm trying to solve algorithm problem, so far no luck
Lets imagine A is an employer and there are N employee currently on line (queuing) for receiving their paycheck of the month, and each of the employee are given the same base salary, $1000 each, but their bonuses are based on their performance and where they are rig... |
given the language LRE= { 〈M〉 | L(M) ∈ RE }
prove that the language can be found in R( which means it's decidable).
if i use reduction, how can i use for example ADFA language to solve it?
and is there any other way to prove it except for reduction?
i'm studying to an exam so it would help me a lot.
|
I cant find a way to implement a certain solution. Let me flesh out the problem.
Somebody gives you X amount of money and sends you to the shop to buy Y amount of items. You must spend as much money as you can and buy as many items as you can. You cant have more money they X. You cant buy more than Y amount of items. S... |
Solving $T(n)=4T(n/4) +(n/\log n)^2$.
When I looked at the question I thought that this can be solved by the 3rd case of the master theorem since $f(n)$ is polynomially larger than $n^{\log_ba
}=n.$ But someone said that this is not polynomially larger since it has $(\log n)^2$ in the denominator.
Then I tried the subs... |
An example.
I have bought a currency while the rate was 1.0. As soon as the conversion rate has increased to 2.0 I would like to sell the currency. Now, that would be an easy task to do. But we are not searching for "easy" tasks, are we?
What if there was a way to determine, whether the rate is still growing or not? Fo... |
You are given a number $k$ which specifies the number of consecutive balls you can paint in a go. You are given a string $S$ of length $l$. $l$ is the number of balls and each character in the string specifies the color of the $i^{th}$ ball. I want to know whether it is possible to color all the balls in the given patt... |
I was given a question about SOM.
There is a SOM which have 4x4 neurons and each neuron's x1 and x2 values (coordinates) given. Also neighborhood function and weight update rule given. How can i find and show the regions which are clustered by each neuron?
Thanks for answers.
Regards...
|
NFA (nondeterministic finite automata) accepts only finite words while a NBA (nondeterministic Büchi automata) accepts infinite words (and hence $\omega-$regular languages).
I think the example automata accepts finite word like $A,B,A,B$. But it also accepts infinite words like $A,B,A,B,...$.
How can i know if the exam... |
Say I have three sets:
A = [banana, apple, grape]
B = [1, 2, 3, 4]
C = [Alice, Bob, Carol]
I need to design an algorithm that gives me the Cartesian Product A x B x C, but with any number of sets and any number of elements in each set. Another requirement is that the order of the elements in the Product is such:
A x... |
The Halting problem proof can be seen as the following programs:
Ends(P, I) is a program that detects (returns true or false) if the program P will halt or
not with the input I
Diag( P ): is a program that
2.1 Halts if P( P ) doesn't halt
2.2 Doesn't halt if P (P) halts
If we use (2) with input Diag it state:
Diag... |
I'm referring to a question already asked on stackoverflow: https://stackoverflow.com/questions/25988965/does-depth-first-search-create-redundancy
However I'm not quite convinced by the answers provided there.
Some iterative DFS implementations that I have seen (such as the one provided by Wikipedia) allow vertices to ... |
Question: If you were on an island(Vertex) which are connected to multiple other islands, and to get from island A to B it takes time T and does damage D to your boat. What is the fastest route from A to B such that the total damage is strictly less than a given value H.
I tried using Dijkstra's algorithm to build a su... |
Two transactions $T_1$ and $T_2$ are given as:
$$T_1: r_1(X)w_1(X)r_1(Y)w_1(Y)$$
$$T_2: r_2(Y)w_2(Y)r_2(Z)w_2(Z)$$
where $r_i(V)$ denotes a read operation by transaction $T_i$ on a variable $V$ and $w_i(V)$ denotes a write operation by transaction $T_i$ on a variable $V$. The total number of conflict serializable sche... |
I have the language
$\{ w \mid w \text{ contains an equal amount of symbols } a \text{ and } b\}$.
I want to show that the language is in the class $\textsf{P}$. To do this, I must give an implementation level description of the relevant Turing machine. I'm not very knowledgeable on Turing machines, but I think I woul... |
In several papers on type theory it's possible to see some sort of numerical notation for types based on the number of possible constructors for the type. For example, the unit type is usually written as $1$, as there's only one possible constructor for it; similarly, they use $2$ for booleans, $x + y$ for disjoint uni... |
Disclaimer:
First of all I've had a lot of trouble finding the right stack exchange site for this question and I don't know if it's correct here either.
The Problem:
I'm working on a search algorithm for a django powered website which allows people to write articles on various subjects and search for articles on the we... |
I am struggling to create a smart algorithm. Currently I have produced one which is super-ugly and not efficient because I am casting numerics to strings back and forth, not really useful to share it here.
The point of algorithm is to get a number 10^x which is smaller than a given one.
Examples:
600 => 100
34.54 => 1... |
I've been trying to get better at writing algorithms and came across a problem that was something like this:
Given a list of words:
search_list = ["this", "is", "an", "issue"]
Find the closest occurrences of all of these words in another list, and return the first occurrence and last occurrence:
given_list = ["this", ... |
Cormen et al.'s "Introduction to Algorithms" says the following about the division method hash function $h(k)=k \text{ mod } m$:
A prime not too close to an exact power of 2 is often a good choice for $m$. For example, suppose we wish to allocate a hash table, with collisions resolved by chaining, to hold roughly $n=2... |
I am very much confuse that why complexity of this program is O(n)?
int j = 0;
int i;
For (i = 0; i < n, i++) // O(n)
{
For (i = 0; i < n, i++)//O(n)
{
While (j < n)// O(n)
{
Statement; j++;
}
}
}
I am totally new to Algorithms. Any help and explanation will be app... |
I stumbled upon this inequality over a course on Information Theory :
If $Z\in\mathbb{N}$ with finite mean, then $H(Z) \leq E(Z)\times h(\frac 1 {E(Z)})$ where $h$ is the binary entropy function
I have been trying to prove it using the log-sum inequality :
$ \sum_i a_i \log \frac {a_i}{b_i} \geq (\sum_i a_i) \log ... |
Less Hashing Same Performance: Building A Better Bloom Filter (Kirsch and Mitzenmacher) mentioned that we can use
$ g_i(x) = (h_1 (x)+ih_2 (x))\pmod{p}$, where $h_1(x)$ and $h_2(x)$ are two
independent, uniform random hash functions on the universe with range
${0, \dots , p − 1}$, and throughout we
assume that ... |
I have encountered the term many times, in various CS education materials:
L2 CS162 (UC Berkeley):
Memory-mapped I/O
L4 CS162 (UC Berkeley):
Memory mapped files
L24 CS61 (UC Berkeley):
“Memory mapped I/O”: Device control/data registers mapped to CPU
address space
Even, after googling "mapping", I got the art... |
For some recursive questions that require recursing on an input with a small piece removed (hence linear in the size of the input), can we reduce run time by recursing on two halves of the input each time?
For example, take this recursive reverse_string function ...
def reverse_string1(s):
if len(s) < 2:
... |
I was asked to solve this code on piece of paper while having a debate in the class. We are all new to DataStrct/Algo. I came up with the answer $O(n^{48})$ which was proved wrong. I am not convinced with the answer they gave me which was $O(n^6)$.
void main()
{
int i;
for(i=1, i<= n^2; i++)
for(i=1, i<=... |
I study graph theory on my own using Diestel's Graph Theory book (with Algorithmic graph theory in mind). I don't understand what local property, global property, locality mean given a graph $G$.
For example, on the page 5 it says
The average degree quantifies globally what is measured locally by the
vertex degree... |
I found online solutions which prove the closure of NP under intersection in the following way: given machines $M_1,M_2$ for accepts nondeterministically languages $L_1,L_2$, we construct the following machine $M$ which accepts nondeterministically $L_1 \cap L_2$:
$M$ = ”On input $w$:
Run $M_1$ on $w$. If $M_1$ reject... |
Given a DFA, it is possible to compute the automaton that recognizes the language of its substrings (you can compute it as the automaton that recognizes the suffixes of its prefixes).
I would like to compute, given a DFA, the automaton of the substrings from position i to position j.
For example, given the automaton of... |
Actually this is a exam paper question I found during studying pipelined MIPS architecture.My idea is designers allow to occur hazards because of the cost to make complex design to prevent hazards,so it may be better to allow them than preventing them...It's just my idea..
|
i have read about data hazards and then came across that mips architecture doesn't allow WAR AND WAW hazards can someone please help me understand it? the reason is not given in the book the MIPS pipeline is divided into :
1.IF(instruction fetch) 2.ID(decode the instruction) 3.EX(execute instruction) 4.MEM(write or rea... |
As we know for master theorem:
T(n)=aT(n/b)+Θ(nd) this formate is required..
But for
T(n)=2T(n/2)+2^n
If I want to apply theorem what will be value of d here?
We cant just take d=2 here..right?
|
So I stumbled upon a question here to find an asymptotic bound for the recurrence
$$
T(n) = 4T(n/4) + \left( \frac {n} {\log n} \right)^2 $$
The solution shows a solution using master method to prove the answer as $O(n)$
However, I tried to solve it using substitution as:
$$T(\frac {n} {4^i}) = 4^{i+1} T(\frac {n} {4^{... |
Consider the following naïve argument that any algorithm solving SAT must take $\Omega(2^n)$ time in the worst-case scenario.
Let $f(x_1,x_2,\dots,x_n)$ be a Boolean function in conjunctive normal form (CNF). The problem SAT is to determine whether there exists a $(x_1,x_2,\dots,x_n) \in \{0,1\}^n$ such that $f(x_1,x_2... |
FingerTrees as implemented by Haskell's Data.Sequence use a branching factor of 2-3 for Nodes, and have Digits of size 1-4. Imagine we want to make the branching factor much wider -- perhaps to amortize per-node overheads better, or to improve lookup performance at the cost of update performance.
For example, we might... |
I'm reading the introduction to Godel, Escher, Bach and and there's heavy discussion of mathematical sets which contain themselves. Being a far better programmer than mathematician, I put it into terms I'm more comfortable with and started to think about arrays which contain/reference themselves.
I know that recursion ... |
I am currently learning about a CPU's status register and was confused about the difference between the carry flag and the overflow flag. Then I found article [1] which explains it very well, but I stumbled across one paragraph I don't really understand:
The rules for two's complement detect errors by examining the si... |
I am currently getting really confused of two documents I read:
one is from Wikipedia that states:
The opposite is sequential access, where a remote element takes longer time to access.
and this Microsoft's document says:
Accessing data sequentially is much faster than accessing it randomly because of the way in whi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.