instruction stringlengths 35 29.1k |
|---|
If I have a locally finite graph (every node has finite number of neighbors) with positive edge weights, is it possible for there to be a path between some start node and goal node but no shortest path between them?
I think that it can only happen if the goal node is somewhere in the infinity, but then we wouldn't be s... |
In Algorithms, 4th Edition, I read that after the partitioning step one element is in its final position.
The entry a[j] is in its final place in the array, for some j.
No entry in a[lo] through a[j-1] is greater than a[j].
No entry in a[j+1] through a[hi] is less than a[j].
And this comes from Algorithms, 4th Editio... |
I found an implementation of Quicksort here, and now I cannot understand why it works with those left and right bounds.
Right now the link above is unavailable due to some problems with their hosting provider.
public class Main {
public static void main(String[] args) {
int array[] = new int[] {
... |
Let $R$ be a commutative ring. Let $f(x_1, \dots, x_n), g(x_1, \dots, x_n)$ be two multidimensional polynomials in $R$ with maximal total degree $\delta$.
How fast can we compute the product of $f$ and $g$, i.e. the resulting coefficients of each term?
I have only been able to find a non-trivial algorithm for when $R$ ... |
Given an unsorted array of $n$ integers, I need to find an $O(n \log k)$ algorithm that finds the $k-1$ items that divide the sorted array to $k$ equal (up to $\pm 1$ items) parts.
For example, if $k=3$, the items we want would be at indices $n/3$, $2n/3$ in the array after we sort it.
I know that you can select those ... |
I'm having a hard time tackling the following problem (perhaps some key data is missing). We have a constraint:
$A+B= C$
One is supposed to represent this one constraint using three binary constraints. Is this even possible? No domain is given, but even if it was, I really don't see how this could be achieved...
|
Prove/ Disprove:
For every nontrivial $A,B\in R$, $A\le_m B$
For every nontrivial $A,B\in RE$, $A\le_m B$
trivial set is the empty-set or $\Sigma^*$.
So basically the question is if for every two nontrivial sets there is a computable function from $A$ to $B$.
I'd be glad to get hint/guidance since I'm kinda stuck a... |
I'm playing with Akka FSM.
The declaration of a an Akka FSM consists of states + data mantained during the states (the akka doc is more clear than me) + events that trigger transitions between states.
Can we say that such a formalism is Turing-complete? I can't think of a problem that can't be solved this way.
|
I need to find a tight bound on the number of comparisons in a d-ary heapsort, in terms of d and n (the length of the array we want to sort).
Since inserting n items to a heap takes O(n) , and each delete-min takes O(d log n/ log d), I was thinking the bound is O(n d log n / log d). Am I right? If so, how do I prove th... |
I have a specific question and not sure what tools I can use to finish my projects. I know this may has been well solved, but I am quite new to the image recognition and detection area and don't know what tools I can use to productionize this work.
We are trying to find, for example, navels in humans pics:
I have 1000... |
I am new to automata theory.
Could you give me a little hand with the correct use of the pumping lemma?
I understand now how to proof a language is not context-free, but how do I use the pumping lemma to proof it is?
Do I find one way to break the word into: uvwxy so that v and x can be pumped? Is that enough and can ... |
Given a B+ tree with M=3. We assume that the tree is static and it is not necessary to update the B+ tree. Also we know that all key-value pairs are stored in the leaves of the B+ tree. Internal nodes contain copies of keys stored in the leaves.
For simplicity we can assume that an internal node with d children holds ... |
how do I prove that for every 2 languages $A,B\in R$ where $A,B \notin \{ \emptyset , \Sigma^* \}$
I can do a reduction $A \leq_m B$?
[EDIT]
My try:
$A$ is decidable therefore it has a turing machine that decides it - $T_A$
For every x, we can check whether $T_A$ accepts x or not, if it accepts then we run over the al... |
The house robber problem of leetcode can be described as followed :
A robber enters a colony of houses numbered from 1 to n. Every house has a number printed on the top of it. That number is the amount of money inside that house. However, there is one constraint. If the robber robs the i-th house, he can't rob house... |
Is there any efficient algorithm which is able to generate nearly uniform samples of permutations in case of position restrictions?
Consider $N \times N$ restriction matrices $R$, that is matrices over $\{0,1\}$. Each such $R$ defines a set of permutations $\Pi_R$ according to
$\qquad\displaystyle \pi \in \Pi_R \iff \f... |
Given a collection of sets $C= \{S_1,S_2,\cdots,S_n\}$ such that each set $S_i \in C$ is sorted and has at least $k$ elements.
What is the most efficient algorithm for finding the intersection of these sets: $\bigcap_{S_i \in C}{S_i}$
|
Suppose that $x = (x_1,\ldots,x_n)$ is a binary vector and $f(x)$ is a boolean function. Furthermore suppose $y = (y_1,\ldots,y_m)$ is a binary vector and that $F(x,y)$ is a binary formula of size $k.$ Here by size I mean the number of leaves in $F.$
Suppose I have vectors $S = \{s_1,\ldots,s_n\}$ such that for any ... |
I am trying to wrap my head around these asymptotic notations. Given $f(n)$ and $g(n)$, one can write $f(n) = \Omega(g(n))$ as shorthand for $f(n) \geq c*g(n), n\geq n_0$. But what happens when $n<n_0$. What can we then say about $f(n)$ and $g(n)$? Do we just assume that $f(n)$ is a constant and the relation still work... |
Let's consider the following MIPS (using pipelined arch.) assembly code:
lw r1,0(r2)
sub r4, r1, r6
and r6, r1, r7
or r8, r1, r9
the r1 value used in the second and third instruction will not be ready to use until the end of the 4th cycle of the pipeline, while the 2nd and the 3rd instruction need it at the 4th and 5... |
I have a file that has a number (a positive integer) on each row.
Given a number $q$, I want to find a value that's a sum of some 8 numbers in the file, and is as close to $q$ as possible.
So, supposing that I have a file that looks like this:
345
3
2
3453
1234
6
7
34
12
1111
48
413
If the giv... |
Using Herlihy's model and definition of the wait-free hierarchy, a queue (a shared object with enqueue and dequeue) has consensus number 2, because we can initialize the queue with some value, and the first process to dequeue it "wins".
However, it is also possible to do wait-free consensus with queues that start off ... |
Is this language Context Free?
$L=\{a^{n+3} b^{2m} \mid n \neq m \}$
I think that I could split the languages into $L_1$ and $L_2$ with the conditions $n<m$ and $n>m$, provide 2 CF grammars and then to make the union. But I don't know how to put the condition $n<m$ to the grammar or how to think about the conditions. T... |
The standard knapsack problem solution is O(nW) where we will increment the weight +1 at a time to get to the solution.
Is there any approach to the knapsack problem that does not require incrementing weight +1 at a time.
e.g. One way that I can think of is to divide all the numbers by its common
Capacity = 100 we... |
I try to construct a TM that accepts the language $\{ ww \mid w \in \{a,b\}^* \}$.
Between the words $w$ is no delimeter, so I don't know, how my TM can know where the first $w$ ends and the second $w$ begins.
Is there a trick for this?
|
We have two strings $a,b$. I want to find string $c$ that includes $a$ as a subsequence and includes $b$ as a subsequence and the length of $c$ is minimal. Is there an efficient algorithm for this problem?
For example, if $a=1011$ and $b=0100$, the minimal string that include both: $c=101100$. As you can see string $... |
Given an undirected graph $G$ and two pairs of vertices $(s_1, t_1), (s_2, t_2)$, the disjoint paths problem (DPP) asks for two vertex-disjoint paths, one from $s_1$ to $t_1$ and the other from $s_2$ to $t_2$.
The problem has been shown to be in $P$ even for the generalization with $k$ disjoint paths, where $k$ is a c... |
A test is consisted of $N$ multiple choice questions, each has $k$ possible answers.
A test solution is the sequence of answers $S\in[k]^N$.
Given is a black box which receives a solution as input and returns the number of correct answers. After failing a test, the student may take the test again, and the questions do ... |
As far as I know, for two undirected graphs $G = (V, E) $ and $H = (V', E')$, the following criteria is necessary for them to be isomorphic:
$|V| = |V'|$
$|E| = |E'|$
$G$ has $j$ nodes of degree $k$ $\Leftrightarrow $ $H$ has $j$ nodes of degree $k$
Are there more that are that obvious? Thanks in advance for your hel... |
I would like to find out if this language is context free or not:
$\qquad L=\{a^{i}b^{j}c^{k} \mid i<j,i+2j+3<k\}$.
I've tried to apply the pumping lemma taking out $w=a^n b^{n+1}c^{3n+6}$ which is in the language, where $n$ is the natural number given by the lemma. I can write $w=uvwxy$ such that $|vx|≥1$ and $|vwx|≤n... |
The Lowner–John ellipsoid is a minimum volume enclosing ellipsoid of some convex body $K$. This ellipsoid is unique (as is the maximum volume ellipsoid contained in $K$). I'm looking for algorithms based on those ellipsoids, or any significant practical use that requires finding them explicitly.
|
Looking for k shortest paths that do not share edges. i.e if the paths were represented as sets of edges, their intersection has to be empty.
We could use Dijkstra to find the 1st "disjoint" (edge unique) shortest path from the origin to all vertices. However, to naively find the 2nd disjoint path, one would need to cr... |
I am trying to wrap my head around ontologies and their related counterparts (RDF, OWL, etc.).
My understanding is that an ontology, at the end of the day, really boils down to some database storing objects/entries, where each entry has a set of known attributes as well as relationships to other entries.
If that's true... |
I'm having trouble proving that $S_2$ is closed under union and complement, even though in this Wikipedia article it says that:
It is immediate from the definition that $S_2$ is closed under union and complement.
I think that my problem is due to the fact that $S_2$ is defined slightly differently in my assignment. H... |
Just for fun I am trying to write a program to sort the 13 cards (from a standard pack of 52) in a Bridge hand by performing human-like moves on the hand.
A sorted bridge hand is arranged by suit, with alternating colors of suit (if possible), and the cards are sorted by decreasing rank within each suit. For example
... |
Suppose $Σ=\{0,1\}$; then $Σ^*$ is the set of all strings over $Σ$.
Is $Σ^*$ over $Σ$ finte?
|
There are multiple references about the relational algebra for modeling queries (SELECT) but I have found very very little on the expanded algebra that would include concepts in all of DML such as INSERT, UPDATE, DELETE and maybe even MERGE, DECLARE, SET (as defined by MS SQL Server, whenever I must choose). I'm looki... |
As i know the MU0 processor instruction format is as follows:
so the opcode is 4 bit, can anyone explain why it has only 8 instructions, if it could have 16 instructions, 2^4 = 16 ??
|
In the step of removing unit productions when converting a grammar to Chomsky normal form, I sometimes found that the variables may end up having the same production bodies. Is this possible? If so, can we consider these variables identical? For example, given:
S->aAA|aA|A|a
A->bBBB|bBB|bB|B|b
B->bSSS|bSS|bS|S|b
So
S... |
Is there an efficient algorithm to visit/enumerate all unique connected subgraphs of a labelled graph?
E.g., when the graph is a path, $v_1v_2\dots v_N$, there are $N(N-1)$ unique connected graphs: for any $1\leq i<j\leq N$, the subgraph $v_i\dots v_j$. For graphs with denser edge structure, the number of unique conne... |
I need some help with proving the complexity of the following problem
(I'm new here, so please excuse my "newbie-ness")
Given: an AVL tree with keys: $1,2,..,n$, such that each node $i$ in the tree has the parameter $w_i$ (which is an integer)
The task: To make an algorithm which returns an array of size $n$ such that ... |
I have a triangle and the value of the pixel intensity at each of the three corners of the triangle. I want to interpolate to find interpolated pixel intensities for a set of points inside the triangle. How can I do this?
The method I've tried is to do an value determination based on the distance of that fill-in poin... |
Is there a way to compute the size of a maximum matching
in an unweighted bipartite graph
more efficiently (e.g. faster) than computing a maximum matching?
It is a long shot but
it is often an interesting problem to avoid throwaway computations like these.
Motivation
The problem I am trying to solve is match-2
where... |
It is well known that the class of CFLs is not closed under intersection as follows e.g. from the following example:
$$L_1 \cap L_2 = \left\{ a^mb^mc^n \mid m,n \ge 1 \right\} \cap \left\{ a^mb^nc^n \mid m,n \ge 1 \right\} = \left\{ a^ib^ic^i \mid i \ge 1 \right\} \not \in \mathcal{L_2},$$
where $L_1,L_2 \in \mathcal{L... |
I have to design an algorithm to do the next task:
I have one array of booleans. For example:
Array: [0 1 0 0 1 0 1 1]
I want to obtain all the existing combinations of 1's, having in mind that it is allowed only a maximum of one 0 between 1's.
For example, in the previous case, we would have the outputs (I am using ... |
I was trying to generate maximal length pseudo random sequence using an linear feedback shift register (LFSR).
I have read from many sources that the length of the pseudo random sequence generated from the LFSR would be maximum if and only if the corresponding feedback polynomial is primitive.
I have tried to generate... |
Since a sufficiently large hash table takes constant time to both insert and retrieve data, should it not be possible to sort an array by simply inserting each element into the hash table, and then retrieving them in order?
You just insert each number into the hash table, and remember the lowest and highest number inse... |
Let's take the zip compression for example, from what scraps I can gather on the Internet, the 2 major simplified ways it works is by looking for arrangements of bits that repeat throughout the file, and by compressing certain bit orders.
So for example, we have 010111111111110101
A zip file would look something like:... |
I am currently attending the concurrent programming course in my university and we recently started talking about the concept of a monitor. While I understand the necessity of mutual exclusion, I do not understand why I would use a monitor for that.
As I understand it, a monitor guarantees that exactly one or no proce... |
Here's something that has puzzled me lately, and perhaps someone can explain what I'm missing.
Problems in NP are those that can be solved on a NDTM in polynomial time. Now assuming P$\,\neq\,$NP, PSPACE$\,\neq\,$NP etc. this means that there are NP-complete problems that cannot be solved in polynomial time on a DTM. W... |
In the TSP problem, we usually assume a complete graph. If we can only visit each city once, we need a complete graph to ensure that there will be a path from every city to every other city. This is easy to accomplish as if there is no straight path between A and B, we can simply assign a new edge whose length is the s... |
Please see below pseudo-code for finding the max-height of a b-tree
maxDepth()
1. If tree is empty then return 0
2. Else
(a) Get the max depth of left subtree recursively i.e.,
call maxDepth( tree->left-subtree)
(a) Get the max depth of right subtree recursively i.e.,
call maxDepth( tr... |
I just can't figure this question out:
Given an array of N elements, its values range are from 0 to 100.
Write a function that prints the array's elements sorted by repetition.
Time complexity : O(N)
For example: Array: [20,60,10,80,100,0,20,20,30,35]
The function should print: 20 20 20 60 10 80 100 0 30 35
|
I have a boolean function $f: \{0,1\}^n \to \{0,1\}$ that I know takes the form
$$f(x_1,\dots,x_n) = x_{i_1} \lor x_{i_2} \lor \dots \lor x_{i_k},$$
but I don't know the values of $i_1,\dots,i_k$. I am given many pairs $(x,f(x))$ for random values of $x$ (chosen uniformly and independently at random).
I'm looking for ... |
Does anyone have any complete example of a proof of program correctness? I'm talking about something that includes the usual predicate, base case, inductive hypothesis, and inductive step. But also important is the loop invariant, and termination. I'm just not sure what the proper format for something like this is.
The... |
I have a boolean function $f: \{0,1\}^n \to \{0,1\}$ that I know takes the form
$$f(x_1,\dots,x_n) = x_{i_1} \lor x_{i_2} \lor \dots \lor x_{i_k}.$$
I don't know the values of $i_1,\dots,i_k$, but I do know $k,n$. My goal is to recover $i_1,\dots,i_k$ from the value of $f$ on randomly chosen inputs, using as few evalu... |
I would like to understand why and when polynomial algorithms became of interest.
When did people realize the role and importance of efficient versus non-efficient algorithms? Did that happen when the concept of an algorithm was discovered, or the the term algorithm used.
For instance, I've looked at some textbook of A... |
I have a set of solution nodes generated over a polar grid. I would like to convert / interpolate these solution nodes onto a Cartesian grid:
That is, using the image above, for each node in the Cartesian grid I would interpolate a value from the closest existing nodes (red).
Currently, my approach is to generate a k... |
I'm curious if there is existing literature or well known algorithms out there for a problem I am working on.
Given a normalized relational database with valid foreign key constraints and a list of fields across different tables, what is a good or at least consistent algorithm for determining the (inner) joins require... |
The particular quadratic Diophantine equation:
$$
R(a,b,c) \Leftrightarrow \exists X \exists Y :aX^2 + bY - c = 0
$$
is NP-complete. (a, b, and c are given in their binary representations. a, b, c, X, and Y are positive integers).
Kenneth L. Manders, Leonard M. Adleman: NP-Complete Decision Problems for Quadratic Polyn... |
$A$ is finite, $B$ is NPC - When there's a polynomial reduction from $A$ to $B$?
Basically, I've understood that if $A$ is finite, then there's a reduction for every $B$ which isn't trivial (empty or $\Sigma^*$).
BUT, if $B$ is NPC then $B\ne \emptyset, \Sigma^*$, so in which case there's is no polynomial reduction f... |
I tried to find sources that explain multiple sequence alignment with an example using progressive alignment, but I couldn't find one.
I actually know till creating a guide tree, after creating a guide tree we use guide tree to arrange sequences. This is the critical part. Can some please help me in explaining how to a... |
I am converting cartographic objects, which have an exterior boundary (simple polygon) and zero or more interior boundaries (also simple), into a less sophisticated format that specifies exterior boundary only. To overcome this restriction, I plan to “cut through the body of the shape” — joining a pair of nodes of exte... |
I'm reading this tutorial from the University of Illinois about Turing Machines, and I don't understand something.
They give a pseudocode algorithm for an machine that accepts strings from the language
$L = {0^n1^n}$
and a diagram of the machine. Both are pictured below:
What I don't understand however is how does t... |
Quantify the effect in performance which comes from using the cache ,if We are going to use a program which is made from 500 machine instructions ,from which 100 are in a cycle which is executed 25 times.Suppose that the main memory has a memory stall of 10 units of time and the cache memory has a stall of 1 unit.
So t... |
I can't figure out how to swap boxes on a Turing Machine tape.
So for example, I have a tape that says
a 1 0 1 1 1 0
^
And I want to move that a over so that it is in the middle. (but my end goal is not important here)
How do I get the Turing Machine to do
1 a 0 1 1 1 0
^
1 0 a 1 1 1 0
^
etc...
|
How can I prove algorithm correctness ?
when i face a problem and come up with a solution the only way to know if this a valid solution or not is by trying some test cases. if they pass through the algorithm and produce the expected output then my algorithm most properly true.
but obviously this is not hold all the tim... |
Let an infinite language, $L$, which contains only TM which halt for every input (meaning, decides some language). Is $L$ in $R$ ? in $RE \setminus R$ ?
I've understood that the answer is: it depends on what exactly $L$ is.
So basically I'm trying to think of two scenarios for $L$ - one which $L\in R$ and one which ... |
Is Tarjan's algorithm capable of finding satisfying assignment to any digraph consists of variables (vertices) and implications (edges)? I know that it solves implication graphs constructed by 2SAT clauses, but I wonder if the algorithm can handle the digraphs which cannot be expressed as 2SAT clauses. Let me clarify t... |
Given a homomorphism $h: \Sigma \rightarrow \Delta^*$ such that e.g. $\forall a \in \Sigma: h(a) = \delta$, where $\delta \in \Delta$ (i.e. all symbols from the alphabet $\Sigma$ have the same image $\delta$), is the inverse homomorphism $h^{-1}$ a homomorphism?
Since a homomorphism maps every symbol of the input alpha... |
Let the class of languages $$X = \{ L \ | \ L\in NPC \land L\in coNPC\}$$
Why is it true that $NP \ne coNP \implies X = \emptyset$?
|
The problem
I have two integers, $n$ and $p$:
$n \ge 1$
$1 \le p \le 2^n + 1$
Consider the sequence of numbers: $0, 1, 2, ..., 2^n, 2^n + 1$.
$0$, $p$, and $2^n + 1$ in the sequence are marked as deleted.
I need an algorithm that can mark all the elements of the sequence as deleted , in k steps (k from 1 to n), with th... |
$A_{TM} = \{<M,w> | $ M is a TM and M accepts w $\}$
$H_{TM} = \{<M,w> | $ M is a TM and M halts on w $\}$
I thought that $L = H_{TM} \cap \overline{A_{TM}} \in R$
But I saw the proof for why $L \in RE \setminus R$
But I don't understand why this is wrong:
$H_{TM} \in RE$ and $\overline{A_{TM}} \in Co-RE $
We know th... |
I have found various opinions saying they are (a link to one is given in D.W.'s comment). However, a proof that DCFLs themselves are not closed under concatenation found here on StackExchange seems to be applicable also to concatenation with regular languages:
Pick the languages:
$L_1 = \{a^ib^jc^k | i \neq j \}$ and ... |
You are given a bunch of nodes evenly spaced in a rectangular grid. The rectangle is M nodes long and N nodes wide. Node A is in the upper left hand (northwest) corner and node B is at the bottom right hand corner (southeast). From each node you can only move east, south, or diagonally southeast to the next adjacent no... |
A debate has arisen in the course of using an assembler (which does a bit of preprocessing first, but is mainly a static assembler):
This particular assembler allows recursive macros to be defined, which it then attempts to resolve (statically, at compile time) and embed in the binary output.
The question is, does this... |
To store say integers (positive), we prefer to use red black BSTs. I have never seen a explicit use of a trie anywhere to store numbers.
I believe we can convert numbers to string and store them in tries for fast retrieval.
Is it a bad idea to use tries?
We don't use them because they are hard to code and there are lib... |
I can't see how I can apply quantum function $a^x\mod N$ to initial states. Explanations of Shor's algorithm often skips this part, and I do not see what unitary matrix this algorithm would correspond to.
reference: https://en.wikipedia.org/?title=Shor%27s_algorithm
|
A problem $L$ is NP-complete when:-
$L\in \text{NP}$
For every problem $L' \in \text{NP}$, $L'$ is polynomial time reducible to $L$
When at least property 2 is satisfied for a problem $L$ (but not
necessarily property 1), then $L \in \text{NP-Hard}$.
When a problem $L\in \text{NP-Complete}$ is shown to have a polyn... |
I'm in doubt about that because in Google's results for a search on "bill clinton" [1],
the server "The 'Unofficial' Bill Clinton" (94.06%) appears first than the server "President Bill Clinton - The Dark Side" (97.27%) and there is no feedback mechanism modifing the ranks.
Since I've noticed that, I am wondering if go... |
I've recently become interested in randomly generating Voronoi diagrams to create "territory" maps (similar to this) for a project I've been working on.
Traditional Voronoi diagrams using an Euclidean metric don't present sufficient cell variation for my liking so I've been attempting to utilize a L∞ metric instead, ... |
According to the concepts of Pipelining,
In a single cycle different stages of different instructions are
executed.
Now I have a bit of confusion here, that if a single processing element is there and can perform one processing at a time ,
then -
Do the preemption occurs multiple times in a single cycle in order to c... |
Assume we have a $n$ sized integer array $A$, and that we know that $\sum_{i\in[n]}A[i] \le M$.
Assume we are using the RAM model with $\Theta(\log n)$ sized memory words (which can be read / written in $O(1)$ time), and that $M=n^{O(1)}$.
A standard implementation could allocate $\lceil \log_2 M\rceil$ bits per cell, ... |
Consider the languages $B,C,D$, such that $B\le_p C$ and $B\le_p D$.
Statement: $B\in P, D\in NP, C\in coNP$.
Is the statement true for every $B,C,D$?
I know that the answer is no and I have tried to come up with a conunter-example.
I thought about taking $D\in NPC$ or $C \in coNPC$ but that didn't yield anything goo... |
I'm sure someone has thought about this before or immediately dismissed it, but why does Schaefer's dichotomy theory along with Mahaney's theorem on sparse sets not imply P = NP ?
Here's my reasoning: Create a language $L$ which is equal
to SAT intersected by an infinite decidable sparse set. Then $L$ must also be
... |
I'm practicing an exam for a data structures course. There's a question about a hash table with hash function:
$$h'(k,i)=h_1(k)+i*h_2(k) \mod{11}$$ where
$$h_1(k)=k \mod{13}$$ and $$h_2(k) = 1 + k \mod{7}$$
There's a question:
What problem will occur if we change the table size to 12 and we also change the module in $$... |
The prime-counting function, demoted $\pi(x)$, is defined as the number of prime numbers less than or equal to $x$.
We can define a decision problem from $\pi(x)$ as follows:
Given two numbers $x$ and $n$, written in binary, decide if $\pi(x) = n$.
A friend and I were talking about this problem earlier today. There's... |
I mean, say we want to show how we can implement an OR gate in terms of a NAND gate. If we write in Polish notation, then we've suggested that the circuit takes the gates before the inputs. If we write it in infix notation, we've suggested a mix. But if we write ppDqqDD, then we've suggested that we have the input 'p',... |
I'm using Thompson's algorithm to convert from a regular expression to a NFA. Is Thompson's algorithm guaranteed to always output a minimal NFA, i.e., a NFA with the smallest possible number of states?
For instance, consider this example. I have the regular expression $(a|b)$. According to this website, Thompson's a... |
Why do differential-privacy people care whether or not the noise function saturates the lower bound of Shannon entropy?
For example :
Laplace distribution that is used to model the noise function happens to saturate the lower bound of Shannon entropy under epsilon differential privacy constraints. See Theorem 8 in Yu... |
I am solving a large (~1e5 equations & unknowns) set of nonlinear equations using Newton-Raphson iterations. Currently I am using the GPU accelerated Krylov methods implemented in ViennaCL to solve the linear system to get the update increment. I am solving the system on a single 24 core, 64GB workstation with a NV... |
I've tried to solve a exercise 4.1-5 in algorithm book "Introduction to algorithms".
it is about Maximum sub-array problem, which is an algorithm that determines the greatest sum of sub-array A[i], A[i+1] , ... , A[j] in given array A[1] , ... , A[n].
The exercise is about developing linear-time algorithm to solve th... |
there is some kind of priorities for the elements in propositional logic ?
for example : p ∧¬q → r , given this ,we there may be two options
(p ∧¬q) → r OR p ∧ (¬q → r) , which one is the correct ?
|
Assuming $P\neq NP$, is it possible that there exists a $k$ such that $P\subseteq\textsf{NTIME}(t^k)$?
There reason I ask this is that I assume the following:
$$P=NP \implies \forall k\ \exists j.\ \textsf{NTIME}(t^k)\subseteq\textsf{DTIME}(t^j)$$ but I know that these statements are not exactly contrapositive to each ... |
I give you a list of $n$ bitvectors of width $k$. Your goal is to return two bitvectors from the list that have no 1s in common, or else to report that no such pair exists.
For example, if I give you $[00110, 01100, 11000]$ then the only solution is $\{00110, 11000\}$. Alternatively, the input $[111, 011, 110, 101]$ ha... |
/!\ I am not speaking about int or float, my question is about model of computation used to design and describe algorithms.
The integer numbers case
Many algorithms use integers and their complexities are almost always given using both the RAM model and the big $O$ notation.
Using the RAM model allows us to add 2 integ... |
Given a sequence of $2 \leq n \leq 50$ numbers $s = (s_1,s_2,...,s_n)$, find a permutation $a = (a_1,a_2,...,a_n)$ of $s$ such that $$\sum_{i=1}^{n-1} |a_i - a_{i+1}|$$ is maximized.
I found many codes that get "Accepted" in the online judge with the following greedy algorithm.
If $n = 2$, then $a = s$. Stop the algor... |
Given some function and assuming no concern for the time to compute the co-domain for its domain, when might it be preferable to compute and tabulate in advance the co-domain results of the function, and then retrieve it from the table rather than compute it?
For example, if the domain for $f(x)=x^2$ were sufficiently ... |
Canny edge algorithm has 5 stages, from here
1. Apply Gaussian filter to smooth the image in order to remove the noise
2. Find the intensity gradients of the image
3. Apply non-maximum suppression to get rid of spurious response to edge detection
4. Apply double threshold to determine potential edges
5. Track edge by h... |
Suppose tomorrow someone discovered a proof that P = NC. What would the consequences for computer science research and practical applications be in this case?
|
Lets suppose that 20 percent of the instructions in a program are branch instructions.The static prediction of the jumps supposes that the jumps don't happen.
I should find the execution time in two cases : When 30 percent of the branches happen and when 70 percent of the branches happen I also should find the speedup ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.