id
int64
1
141k
title
stringlengths
15
150
body
stringlengths
43
35.6k
tags
stringlengths
1
118
label
int64
0
1
1,271
Why is Relativization a barrier?
<p>When I was explaining the Baker-Gill-Solovay proof that there exists an oracle with which we can have, $\mathsf{P} = \mathsf{NP}$, and an oracle with which we can have $\mathsf{P} \neq \mathsf{NP}$ to a friend, a question came up as to why such techniques are ill-suited for proving the $\mathsf{P} \neq \mathsf{NP}$ ...
complexity theory proof techniques p vs np relativization
1
1,274
How to score a given arrangement of windows on a screen to produce good layouts
<p>(this is related to my other question, see <a href="https://cs.stackexchange.com/questions/1217/how-to-devise-an-algorithm-to-arrange-resizable-windows-on-the-screen-to-cover">here</a>)</p>&#xA;&#xA;<p>I would like to write a function that scores a given arrangement of windows on a screen.</p>&#xA;&#xA;<p>The purpos...
computational geometry user interface modelling
0
1,280
What are examples of inconsistency and incompleteness in Unix/C?
<p>In Richard Gabriel's famous essay <a href="http://dreamsongs.com/RiseOfWorseIsBetter.html">The Rise of Worse is Better</a>, he contrasts caricatured versions of the MIT/Stanford (Lisp) and New Jersey (C/Unix) design philosophies along the axes of simplicity, correctness, consistency, and completeness. He gives the ...
programming languages operating systems
1
1,281
Cross Compiler's T diagram
<p>I'm studying Bootstrapping from Red Dragon Book Compilers and found the T diagram for cross compiler pretty confusing. I can't understand what is meant by "Run compiler1 through compiler2". Can anyone provide some better explanation, analogy or an example to relate with some real world compiler?</p>&#xA;&#xA;<p>Some...
compilers terminology
0
1,287
Find subsequence of maximal length simultaneously satisfying two ordering constraints
<p>We are given a set $F=\{f_1, f_2, f_3, …, f_N\}$ of $N$ Fruits. Each Fruit has price $P_i$ and vitamin content $V_i$; we associated fruit $f_i$ with the ordered pair $(P_i, V_i)$. Now we have to arrange these fruits in such a way that the sorted list contains prices in ascending order and vitamin contents in descend...
algorithms arrays constraint programming subsequences
1
1,288
Security Lattice Construction
<p>I am having a problem trying to solve a question on a past paper asking to design a security lattice. Here is the question:</p>&#xA;&#xA;<blockquote>&#xA; <p>The AB model (Almost Biba) is a model for expressing integrity policies rather&#xA; than confidentiality. It has the same setup as Bell-LaPadula, except ...
security lattices integrity
1
1,290
How to output all longest decreasing sequences
<p>Suppose I have an array of integers having length $N$. How can I output all longest decreasing sequences? (A subsequence consists of elements of the array that do not have to be consecustive, for example $(3,2,1)$ is a decreasing subsequence of $(7,3,5,2,0,1)$.) I know how to calculate the length of longest decreasi...
algorithms arrays subsequences
1
1,292
What is required for universal analogue computation?
<p>What operations need to be performed in order to do any arbitrary <a href="http://en.wikipedia.org/wiki/Analog_computer">analogue computation</a>? Would addition, subtraction, multiplication and division be sufficient?</p>&#xA;&#xA;<p>Also, does anyone know exactly what problems are tractable using analogue computat...
computability computation models turing completeness
1
1,296
Solve a recurrence using the master theorem
<p>This is the recursive formula for which I'm trying to find an asymptotic closed form by the <a href="http://en.wikipedia.org/wiki/Master_theorem" rel="nofollow">master theorem</a>:&#xA;$$T(n)=9T(n/27)+(n \cdot \lg(n))^{1/2}$$</p>&#xA;&#xA;<p>I started with $a=9,b=27$ and $f(n)=(n\cdot \lg n)^{1/2}$ for using the ma...
algorithm analysis asymptotics recurrence relation master theorem
1
1,299
NP-completeness of a spanning tree problem
<p>I was reviewing some NP-complete problems on this site, and I meet one interesting problem from </p>&#xA;&#xA;<p><a href="https://cs.stackexchange.com/questions/808/np-completeness-proof-of-a-spanning-tree-problem">NP completeness proof of a spanning tree problem</a></p>&#xA;&#xA;<p>In this problem, I am interested ...
complexity theory np complete graphs spanning trees
1
1,300
Survey of informed search algorithms?
<p>I'm looking for a list of informed search algorithms, also known as heuristic search algorithms. </p>&#xA;&#xA;<p>I'm aware of: </p>&#xA;&#xA;<ol>&#xA;<li><p><a href="http://en.wikipedia.org/wiki/Best-first_search" rel="nofollow">best-first search</a></p>&#xA;&#xA;<ul>&#xA;<li>Greedy best-first search</li>&#xA;<li><...
algorithms reference request artificial intelligence search algorithms
0
1,301
Find minimum number 1's so the matrix consist of 1 connected region of 1's
<p>Let $M$ be a $(0, 1)$ matrix. We say two entries are neighbors if they are adjacent horizontal or vertically, and both entries are $1$'s. One wants to find minimum number of $1$'s to add, so every $1$ can reach another one through a sequence of neighbors. </p>&#xA;&#xA;<p>Example:</p>&#xA;&#xA;<pre><code>100&#xA;000...
algorithms graphs matrices
1
1,315
What is a formula for the number of strings with no repeats?
<p>I want to count the number of strings $s$ over a finite alphabet $A$, that contain no repeats, and by that I mean for any substring $t$ of $s$, $1&lt; |t| &lt; |s|$, there is no disjoint copy of $t$ in $s$. For exapmle, let $A=\{a,b\}$. Then $aaa$ <em>is</em> one of the strings I want to count, since for the subst...
formal languages combinatorics strings word combinatorics
0
1,319
Solving problems related to Marginal Contribution Nets
<p>So, I encoutered this problem in examination:</p>&#xA;&#xA;<blockquote>&#xA; <p>Consider the following marginal contribution net:</p>&#xA; &#xA; <p>$\{a \wedge b\} \to 5$</p>&#xA; &#xA; <p>$\{b\} \to 2$</p>&#xA; &#xA; <p>$\{c\} \to 4$</p>&#xA; &#xA; <p>$\{b \wedge \neg c\} \to −2$</p>&#xA; &#xA; <p>Let $v...
artificial intelligence
1
1,326
How to prove regular languages are closed under left quotient?
<p>$L$ is a regular language over the alphabet $\Sigma = \{a,b\}$. The left quotient of $L$ regarding $w \in \Sigma^*$ is the language &#xA;$$w^{-1} L := \{v \mid wv \in L\}$$</p>&#xA;&#xA;<p>How can I prove that $w^{-1}L$ is regular?</p>&#xA;
formal languages regular languages closure properties
1
1,329
Shortest Path on an Undirected Graph?
<p>So I thought this (though somewhat basic) question belonged here:</p>&#xA;&#xA;<p>Say I have a graph of size 100 nodes arrayed in a 10x10 pattern (think chessboard). The graph is undirected, and unweighted. Moving through the graph involves moving three spaces forward and one space to either right or left (similar t...
algorithms graphs search algorithms shortest path
1
1,331
How to prove a language is regular?
<p>There are many methods to prove that <a href="https://cs.stackexchange.com/q/1031/157">a language is not regular</a>, but what do I need to do to prove that some language <em>is</em> regular?</p>&#xA;&#xA;<p>For instance, if I am given that $L$ is regular, &#xA;how can I prove that the following $L'$ is regular, too...
formal languages regular languages automata proof techniques reference question
1
1,332
Modified Djikstra's algorithm
<p>So, I'm trying to conceptualize something:</p>&#xA;&#xA;<p>Say we have a weighed graph of size N. A and B are nodes on the graph. You want to find the shortest path from A to B, given a few caveats:</p>&#xA;&#xA;<ol>&#xA;<li><p>movements on the graph are regulated by a circular cycle of length 48, in such a manner t...
algorithms graphs shortest path
1
1,334
Randomized Selection
<p>The randomized selection algorithm is the following:</p>&#xA;&#xA;<p>Input: An array $A$ of $n$ (distinct, for simplicity) numbers and a number $k\in [n]$</p>&#xA;&#xA;<p>Output: The the "rank $k$ element" of $A$ (i.e., the one in position $k$ if $A$ was sorted)</p>&#xA;&#xA;<p>Method:</p>&#xA;&#xA;<ul>&#xA;<li>If t...
algorithms algorithm analysis probability theory randomized algorithms
1
1,335
What is a good reference to learn about state transition systems?
<p>I am studying different approaches for the definition of computation with continuous dynamical systems. I have been trying to find a nice introduction to the theory of <a href="http://en.wikipedia.org/wiki/State_transition_system">"State transition systems"</a> but failed to do so.</p>&#xA;&#xA;<p>Does anybody know ...
computability automata reference request computation models
1
1,336
Extending the implementation of a Queue using a circular array
<p>I'm doing some exam (Java-based algorithmics) revision and have been given the question:</p>&#xA;&#xA;<blockquote>&#xA; <p>Describe how you might extend your implementation [of a queue using a circular array] to support the expansion of the Queue to allow it to store more data items.</p>&#xA;</blockquote>&#xA;&#xA;...
algorithms data structures
1
1,339
$\log^*(n)$ runtime analysis
<p>So I know that $\log^*$ means iterated logarithm, so $\log^*(3)$ = $(\log\log\log\log...)$ until $n \leq 1$.</p>&#xA;&#xA;<p>I'm trying to solve the following:</p>&#xA;&#xA;<p>is </p>&#xA;&#xA;<blockquote>&#xA; <p>$\log^*(2^{2^n})$</p>&#xA;</blockquote>&#xA;&#xA;<p>little $o$, little $\omega$, or $\Theta$ of</p>&#x...
asymptotics landau notation mathematical analysis
1
1,346
Sharp concentration for selection via random partitioning?
<p>The usual simple algorithm for finding the median element in an array $A$ of $n$ numbers is:</p>&#xA;&#xA;<ul>&#xA;<li>Sample $n^{3/4}$ elements from $A$ with replacement into $B$</li>&#xA;<li>Sort $B$ and find the rank $|B|\pm \sqrt{n}$ elements $l$ and $r$ of $B$</li>&#xA;<li>Check that $l$ and $r$ are on opposite...
algorithms algorithm analysis randomized algorithms
1
1,347
Complexity of 3SAT variants
<p>This question is motivated by my <a href="https://cs.stackexchange.com/a/1328/96">answer</a> to another question in which I stated the fact that both Betweeness and Non-Betweeness problems are $NP$-complete. In the former problem there is a total order such that the betweeness constraint of each triple is enforced w...
complexity theory satisfiability
1
1,353
Optimizing a strictly monotone function
<p>I am looking for algorithms to optimize a strictly monotonic function $f$ such that $f(x) &lt; y$ </p>&#xA;&#xA;<p>$f : [a,b] \longrightarrow [c,d]&#xD;&#xA;\qquad \text{where } [a,b] \subset {\mathbb N}, [c,d] \subset {\mathbb N}$<br>&#xA;such that $\arg\max{_x} f(x) &lt; y$</p>&#xA;&#xA;<p>My first idea was to us...
algorithms optimization
1
1,354
Quicksort vs. insertion sort on linked list: performance
<p>I have written a program to sort Linked Lists and I noticed that my insertion sort works much better than my quicksort algorithm. &#xA;Does anyone have any idea why this is?&#xA;Insertion sort has a complexity of $\Theta(n^2)$ and quicksort $O(n\log n)$ so therefore quicksort should be faster. I tried for random inp...
algorithms algorithm analysis sorting lists
1
1,367
Quicksort explained to kids
<p>Last year, I was reading a fantastic <a href="http://arxiv.org/abs/quant-ph/0510032">paper on “Quantum Mechanics for Kindergarden”</a>. It was not easy paper.</p>&#xA;&#xA;<p>Now, I wonder how to explain quicksort in the simplest words possible. How can I prove (or at least handwave) that the average complexity is $...
algorithms education algorithm analysis didactics sorting
1
1,370
What is co-something?
<p>What does the notation <code>co-</code> mean when prefixing <code>co-NP</code>, <code>co-RE</code> (recursively enumerable), or <code>co-CE</code> (computably enumerable) ?</p>&#xA;
complexity theory computability terminology
1
1,371
Scott-continuous functions: an alternative definition
<p>I'm really struggling with this property:</p>&#xA;<blockquote>&#xA;<p>Let <span class="math-container">$X,Y$</span> be <a href="http://en.wikipedia.org/wiki/Coherent_space" rel="noreferrer">coherence spaces</a> and <span class="math-container">$f: Cl(X) \rightarrow Cl(Y)$</span> be a monotone function. <span class="...
terminology programming languages semantics
0
1,375
C++ Strings vs. Character Arrays
<p>Why do you think it is that most C++ instructors teaching college level computer sciences discourage or even forbid using strings for text, instead requiring students to use character arrays?</p>&#xA;&#xA;<p>I am assuming this methodology is somehow intended to teach good programming habits, but in my experience I d...
education arrays strings
0
1,377
Lower bound for finding kth smallest element using adversary arguments
<p>In many texts a lower bound for finding $k$th smallest element is derived making use of arguments using medians. How can I find one using an adversary argument?</p>&#xA;&#xA;<p><a href="http://en.wikipedia.org/wiki/Selection_algorithm">Wikipedia</a> says that tournament algorithm runs in $O(n+k\log n)$, and $n - k +...
algorithms algorithm analysis
1
1,382
Are universal types a sub-type, or special case, of existential types?
<p>I would like to know whether a universally-quantified type $T_a$: $$T_a = \forall X: \left\{ a\in X,f:X→\{T, F\} \right\}$$ is a sub-type, or special case, of an existentially-quantified type $T_e$ with the same signature: $$T_e = \exists X: \left\{ a\in X,f:X→\{T, F\} \right\}$$</p>&#xA;&#xA;<p>I'd say "yes": If so...
logic type theory typing
0
1,388
Complexity of an optimisation problem in 3D
<p>I have a collection $P \subseteq \mathbb{R}^3$ of $N$ particles and there is a function $f : P^2 \to \mathbb{R}$. I want to find which configuration of the system minimizes the value of $f$. </p>&#xA;&#xA;<p>Can this problem (or similar ones) be reduced to TSP? Could you point me to literature on the topic?</p>&#xA;...
complexity theory optimization search problem
0
1,392
Algorithm to chase a moving target
<p>Suppose that we have a black-box $f$ which we can query and reset. When we reset $f$, the state $f_S$ of $f$ is set to an element chosen uniformly at random from the set $$\{0, 1, ..., n - 1\}$$ where $n$ is fixed and known for given $f$. To query $f$, an element $x$ (the guess) from $$\{0, 1, ..., n - 1\}$$ is prov...
algorithms probability theory randomized algorithms
1
1,393
Rectangle Coverage by Sweep Line
<p>I am given an exercise unfortunately I didn't succeed by myself.</p>&#xA;&#xA;<blockquote>&#xA; <p>There is a set of rectangles $R_{1}..R_{n}$ and a rectangle $R_{0}$. Using plane sweeping algorithm determine if $R_{0}$ is completely covered by the set of $R_{1}..R_{n}$.</p>&#xA;</blockquote>&#xA;&#xA;<p>For more d...
algorithms computational geometry
1
1,394
How to represent the interests of a Facebook user
<p>I'm trying to figure out a way I could represent a Facebook user as a vector. I decided to go with stacking the different attributes/parameters of the user into one big vector (i.e. age is a vector of size 100, where 100 is the maximum age you can have, if you are lets say 50, the first 50 values of the vector would...
machine learning modelling social networks knowledge representation
1
1,398
Maintaining search indices with binary trees
<p>There are some documents to be indexed, that means I need to read the docs and extract the words and index them by storing at which document they appear and at which position.</p>&#xA;&#xA;<p>For each word initially I am creating a separate file. Consider 2 documents:</p>&#xA;&#xA;<ul>&#xA;<li>document 1: “The Probl...
data structures binary trees data mining
0
1,399
Distribute objects in a cube so that they have maximum distance between each other
<p>I'm trying to use a color camera to track multiple objects in space. Each object will have a different color and in order to be able to distinguish well between each objects I'm trying to make sure that each color assigned to an object is as different from any color on any other object as possible.</p>&#xA;&#xA;<p>I...
algorithms optimization computational geometry
1
1,407
How to interpret "Windows - Virtual Memory minimum too low" from a CS student point of view?
<p>On my old 256MB RAM, pc I get this message. (I guess it is quite common)</p>&#xA;&#xA;<blockquote>&#xA; <p><strong>Windows - Virtual Memory minimum too low</strong><br>&#xA; Your system is low on virtual memory. Windows is increasing the size of your virtual memory paging file. During this process, memory requests...
operating systems virtual memory paging
1
1,413
Why are blocking artifacts serious when there is fast motion in MPEG?
<p>Why are blocking artifacts serious when there is fast motion in MPEG?</p>&#xA;&#xA;<p>Here is the guess I made:</p>&#xA;&#xA;<p>In MPEG, each block in an encoding frame is matched with a block in the reference frame.&#xA;If the difference of two blocks is small, only the difference is encoded using DCT. Is the reaso...
information theory data compression video
1
1,414
Proving a specific language is regular
<p>In my computability class we were given a practice final to go over and I'm really struggling with one of the questions on it.</p>&#xA;<blockquote>&#xA;<p>Prove the following statement:</p>&#xA;<p>If <span class="math-container">$L_1$</span> is a regular language, then so is</p>&#xA;<p><span class="math-container">$...
formal languages regular languages
1
1,415
P-Completeness and Parallel Computation
<p>I was recently reading about algorithms for checking bisimilarity and read that the problem is <a href="http://en.wikipedia.org/wiki/P-complete">P-complete</a>. Furthermore, a consequence of this is that this problem, or any P-complete problem, is unlikely to have an efficient parallel algorithms.</p>&#xA;&#xA;<bloc...
complexity theory parallel computing
1
1,418
When to use recursion?
<p>When are some (relatively) basic (think first year college level CS student) instances when one would use recursion instead of just a loop? </p>&#xA;
algorithms recursion
1
1,424
Overflow safe summation
<p>Suppose I am given $n$ fixed width integers (i.e. they fit in a register of width $w$), $a_1, a_2, \dots a_n$ such that their sum $a_1 + a_2 + \dots + a_n = S$ also fits in a register of width $w$.</p>&#xA;&#xA;<p>It seems to me that we can always permute the numbers to $b_1, b_2, \dots b_n$ such that each prefix su...
algorithms arrays integers numerical analysis
1
1,426
Detecting overflow in summation
<p>Suppose I am given an array of $n$ fixed width integers (i.e. they fit in a register of width $w$), $a_1, a_2, \dots a_n$. I want to compute the sum $S = a_1 + \ldots + a_n$ on a machine with 2's complement arithmetic, which performs additions modulo $2^w$ with wraparound semantics. That's easy — but the sum may ove...
algorithms arrays integers numerical analysis
1
1,427
Sub language is not Turing-recognizable, or could it be?
<p>Let A and B be languages with A ⊆ B, and B is Turing-recognizable. Can A be not Turing-recognizable? If so, is there any example?</p>&#xA;
computability
1
1,434
Lambda Calculus beta reduction
<p>I am trying to learn Lambda calculus from <a href="http://www.cse.chalmers.se/research/group/logic/TypesSS05/Extra/geuvers.pdf" rel="noreferrer">here</a></p>&#xA;&#xA;<p>and while trying to solve some problems, I got stuck. I was trying to solve the following problem (page 14, excercise 2.6 part (i):</p>&#xA;&#xA;<p...
logic lambda calculus
0
1,440
What is the name of this logistic variant of TSP?
<p>I have a logistic problem that can be seen as a variant of $\text{TSP}$. It is so natural, I'm sure it has been studied in Operations research or something similar. Here's one way of looking at the problem.</p>&#xA;&#xA;<p>I have $P$ warehouses on the Cartesian plane. There's a path from a warehouse to every other w...
algorithms optimization reference request approximation
1
1,444
How many possible ways are there?
<p>Suppose I have the given data set of length 11 of scores:</p>&#xA;&#xA;<pre><code>p=[2, 5, 1 ,2 ,4 ,1 ,6, 5, 2, 2, 1]&#xA;</code></pre>&#xA;&#xA;<p>I want to select scores 6, 5, 5, 4, 2, 2 from the data set. How many ways are there?</p>&#xA;&#xA;<p>For the above example answer is: 6 ways</p>&#xA;&#xA;<pre><code>{p[1...
combinatorics
1
1,447
What is most efficient for GCD?
<p>I know that Euclid’s algorithm is the best algorithm for getting the GCD (great common divisor) of a list of positive integers.&#xA;But in practice you can code this algorithm in various ways. (In my case, I decided to use Java, but C/C++ may be another option).</p>&#xA;&#xA;<p>I need to use the most efficient code ...
algorithms recursion arithmetic
1
1,450
Prime number CFG and Pumping Lemma
<p>So I have a problem that I'm looking over for an exam that is coming up in my Theory of Computation class. I've had a lot of problems with the <em>pumping lemma</em>, so I was wondering if I might be able to get a comment on what I believe is a valid proof to this problem. From what I have seen online and in our r...
formal languages proof techniques context free pumping lemma
0
1,454
Can the Bell-LaPadula model emulate the Chinese Wall model?
<p>I have been reading on security policies and the question wether <a href="https://en.wikipedia.org/wiki/Bell-LaPadula_model" rel="nofollow">Bell-LaPadula</a> can be used to implement <a href="https://en.wikipedia.org/wiki/Chinese_wall" rel="nofollow">Chinese Wall</a>. Does anyone know more about it?</p>&#xA;
information theory security access control
0
1,455
How to use adversary arguments for selection and insertion sort?
<p>I was asked to find the adversary arguments necessary for finding the lower bounds for selection and insertion sort. I could not find a reference to it anywhere.</p>&#xA;&#xA;<p>I have some doubts regarding this. I understand that adversary arguments are usually used for finding lower bounds for certain "problems" r...
algorithms algorithm analysis proof techniques lower bounds
1
1,458
Encoding the sequence 0110 and determining parity, data bit and value
<p>I've been struggling with several Hamming code/error detection questions because the logic behind it doesn't seem to make sense.</p>&#xA;<p>eg.1</p>&#xA;<p><img src="https://i.stack.imgur.com/v9F4w.png" alt="enter image description here" /></p>&#xA;<p>eg.2</p>&#xA;<p><img src="https://i.stack.imgur.com/tGxIZ.png" al...
coding theory
1
1,460
Magic Square Check for NxN Matrix - with Minimum Complexity?
<p>Is there any algorithm that works better than $\Theta(n^2)$ to verify whether a square matrix is a magic one? (E.g. such as sum of all the rows, cols and diagonally are equal to each other). &#xA;I did see someone mention a $O(n)$ time on a website a few days ago but could not figure out how.</p>&#xA;
algorithms algorithm analysis
0
1,466
Circle Intersection with Sweep Line Algorithm
<p>Unfortunately I am still not so strong in understanding <a href="http://en.wikipedia.org/wiki/Sweep_line_algorithm">Sweep Line Algorithm</a>. All papers and textbooks on the topic are already read, however understanding is still far away. Just in order to make it clearer I try to solve as many exercises as I can. Bu...
algorithms computational geometry
1
1,467
Words that have the same right- and left-associative product
<p>I have started to study non deterministic automata using the book of <a href="https://en.wikipedia.org/wiki/Introduction_to_Automata_Theory,_Languages,_and_Computation" rel="nofollow">Hopcroft and Ullman</a>. I'm stuck in a problem that I found very interesting:</p>&#xA;&#xA;<blockquote>&#xA; <p>Give a non determin...
formal languages automata regular languages finite automata nondeterminism
1
1,469
Null Characters and Splitting the String in the Pumping Lemma
<p>So I'm really struggling with the pumping lemma. I think most of my problems come from not understanding how you can and can't split the string in a pumping lemma question. Here is an example, take the problem prove that $L = \{w | w$ contains more $0$'s than $1$'s over the language $\{0,1\} \}$ is not regular via...
formal languages regular languages proof techniques pumping lemma
1
1,471
Looking for a ranking algorithm that favors newer entries
<p>I'm working on a ranking system that will rank entries based on votes that have been cast over a period of time. I'm looking for an algorithm that will calculate a score which is kinda like an average, however I would like it to favor newer scores over older ones. I was thinking of something along the line of: </p...
algorithms data mining
1
1,477
Dealing with intractability: NP-complete problems
<p>Assume that I am a programmer and I have an NP-complete problem that I need to solve it. What methods are available to deal with NPC problems? Is there a survey or something similar on this topic?</p>&#xA;
algorithms reference request np complete efficiency reference question
1
1,478
Algorithms for two and three dimensional Knapsack
<p>I know that the 2D and 3D Knapsack problems are NPC, but is there any way to solve them in reasonable time if the instances are not very complicated? Would dynamic programming work?</p>&#xA;&#xA;<p>By 2D (3D) Knapsack I mean I have a square (cube) and a I have list of objects, all data are in centimeters and are at ...
algorithms complexity theory np complete computational geometry knapsack problems
0
1,485
Complexity of finding the largest $m$ numbers in an array of size $n$
<p>What follows is my algorithm for doing this in what I believe to be $O(n)$ time, and my proof for that. My professor disagrees that it runs in $O(n)$ and instead thinks that it runs in $\Omega(n^2)$ time. Any comments regarding the proof itself, or the style (i.e. my ideas may be clear but the presentation not).</p>...
algorithms time complexity runtime analysis
1
1,490
Monitoring files in preservation archives
<p>What are efficient and accurate techniques for monitoring the recoverability and integrity of files in very large preservation archives?</p>&#xA;&#xA;<p>In very large archives, the time taken to recompute checksums periodically (scrubbing) is substantial, perhaps taking more than all the available time depending on ...
filesystems integrity digital preservation
0
1,493
Requirements for emulation
<p>What are the complete specifications that must be documented in order to ensure the correct execution of a particular program written in Java? For instance, if one were archiving a program for long-term preservation, and no testing or porting would be done.</p>&#xA;&#xA;<p>I need to be able to compile and execute th...
operating systems computer architecture digital preservation
1
1,494
Find the longest path from root to leaf in a tree
<p>I have a <a href="https://www.iis.se/docs/DNS-bok-sid-14.jpg" rel="noreferrer">tree</a> (in the graph theory sense), such as the following example:</p>&#xA;&#xA;<p><img src="https://i.stack.imgur.com/sK90D.jpg" alt="enter image description here"></p>&#xA;&#xA;<p>This is a directed tree with one starting node (the ro...
algorithms graphs
1
1,495
What is the most efficient way to compute factorials modulo a prime?
<p>Do you know any algorithm that calculates the factorial after modulus efficiently?</p>&#xA;&#xA;<p>For example, I want to program:</p>&#xA;&#xA;<pre><code>for(i=0; i&lt;5; i++)&#xA; sum += factorial(p-i) % p;&#xA;</code></pre>&#xA;&#xA;<p>But, <code>p</code> is a big number (prime) for applying factorial directly $...
algorithms efficiency integers
1
1,498
Is it better to store the magnitude of an arbitrary-precision number in BigEndian or LittleEndian order in an integer array?
<p>I'm implementing a class which provides arbitrary-precision arithmetic (also called "bignum", "BigInteger", etc.).</p>&#xA;&#xA;<p>My questions is about a practical implementation detail:</p>&#xA;&#xA;<p>I'm wondering if there is a significant difference in implementation and computational complexity between an impl...
data structures arrays
0
1,500
Complexity of checking whether linear equations have a positive solution
<p>Consider a system of linear equations $Ax=0$, where $A$ is a $n\times n$ matrix with rational entries. Assume that the rank of $A$ is $&lt;n$. What is the complexiy to check&#xA;whether it has a solution $x$ such that all entries of $x$ are stricly greater than 0 (namely, $x$ is a positive vector)? Of course, one ca...
algorithms complexity theory linear algebra
0
1,502
Predecessor query where the insertion order is known
<p>Assume I want to insert elements $1$ to $n$ into a data structure exactly once, and perform predecessor queries while inserting these elements (so <code>insert(x)</code> and <code>pred(x)</code> always come in pairs). The predecessor of $x$ is the largest number in the data structure that is smaller than $x$.</p>&#x...
data structures runtime analysis
0
1,504
Efficiently computing or approximating the VC-dimension of a neural network
<p>My goal is to solve the following problem, which I have described by its input and output:</p>&#xA;<p><strong>Input:</strong></p>&#xA;<p>A directed acyclic graph <span class="math-container">$G$</span> with <span class="math-container">$m$</span> nodes, <span class="math-container">$n$</span> sources, and <span clas...
algorithms complexity theory machine learning neural networks vc dimension
0
1,507
Runtime of the optimal greedy $2$-approximation algorithm for the $k$-clustering problem
<p>We are given a set 2-dimensional points $|P| = n$ and an integer $k$. We must find a collection of $k$ circles that enclose all the $n$ points such that the radius of the largest circle is as small as possible. In other words, we must find a set $C = \{ c_1,c_2,\ldots,c_k\}$ of $k$ center points such that the cost f...
algorithms computational geometry
1
1,509
Direct reduction from $st\text{-}non\text{-}connectivity$ to $st\text{-}connectivity$
<p>We know that <span class="math-container">$st\text{-}non\text{-}connectivity$</span> is in <a href="http://en.wikipedia.org/wiki/NL_%28complexity%29" rel="noreferrer"><span class="math-container">$\mathsf{NL}$</span></a> by <a href="https://en.wikipedia.org/wiki/Immerman%E2%80%93Szelepcs%C3%A9nyi_theorem" rel="noref...
complexity theory reductions space complexity
0
1,511
"Dense" regular expressions generate $\Sigma^*$?
<p>Here's a conjecture for regular expressions:</p>&#xA;&#xA;<blockquote>&#xA; <p>For regular expression $R$, let the length $|R|$ be the number of symbols in it,&#xA; ignoring parentheses and operators. E.g. $|0 \cup 1| = |(0 \cup 1)^*| = 2$</p>&#xA; &#xA; <p><strong>Conjecture:</strong> If $|R| &gt; 1$ and $L(R)$...
formal languages regular languages regular expressions
1
1,514
Is it possible to create a "Time Capsule" using encryption?
<p>I want to create a digital time capsule which will remain unreadable for some period of time and then become readable. I do not want to rely on any outside service to, for instance, keep the key secret and then reveal it at the required time. Is this possible? If not, is some kind of proof possible that it is not?</...
cryptography encryption digital preservation
1
1,516
Simple paths with halt in between in directed graphs
<p>I have two problems related to paths in a directed graph. Let $G=(V,E)$ be a directed graph with source $s \in V$ and target $t \in V$. Let $v \in V \setminus \{s,t\}$ be another vertex in $G$. </p>&#xA;&#xA;<ol>&#xA;<li><p>Find a simple directed path¹ from $s$ to $t$ through $v$. </p></li>&#xA;<li><p>Find a simple ...
algorithms graphs
0
1,517
If A is mapping reducible to B then the complement of A is mapping reducible to the complement of B
<p>I'm studying for my final in theory of computation, and I'm struggling with the proper way of answering whether this statement is true of false.</p>&#xA;&#xA;<p>By the <a href="https://en.wikipedia.org/wiki/Mapping_reducibility" rel="noreferrer">definition</a> of $\leq_m$ we can construct the following statement, </...
complexity theory computability reductions
1
1,521
How to approach Dynamic graph related problems
<p>I asked this <a href="https://stackoverflow.com/questions/10326446/how-to-approach-dynamic-graph-related-problems">question</a> at generic stackoverflow and I was directed here.</p>&#xA;&#xA;<p>It will be great if some one can explain how to approach partial or fully dynamic graph problems in general.</p>&#xA;&#xA;<...
algorithms data structures graphs
0
1,525
Chomsky normal form and regular languages
<p>I'd love your help with the following question:</p>&#xA;&#xA;<blockquote>&#xA; <p>Let $G$ be context free grammar in the <strong>Chomksy normal form</strong> with $k$&#xA; variables.</p>&#xA; &#xA; <p>Is the language $B = \{ w \in L(G) : |w| &gt;2^k \}$ regular ?</p>&#xA;</blockquote>&#xA;&#xA;<p>What is it abou...
formal languages regular languages context free formal grammars
1
1,526
All NP problems reduce to NP-complete problems: so how can NP problems not be NP-complete?
<p>My book states this</p>&#xA;&#xA;<blockquote>&#xA; <ul>&#xA; <li>If a decision problem B is in P and&#xA; A reduces to B,&#xA; then decision problem A is in P.</li>&#xA; <li>A decision problem B is NP-complete if&#xA; B is in NP and&#xA; for every problem in A in NP, A reduces to B.</li>&#xA; <li>A decision ...
complexity theory np complete decision problem
0
1,527
Finding the flaw in a reduction from Hamiltonian cycle to Hamiltonian cycle on bipartitie graphs
<p>I'm trying to solve a problem for class that is stated like so:</p>&#xA;&#xA;<blockquote>&#xA; <p>A bipartite graph is an undirected graph in which every cycle has even&#xA; length. We attempt to show that the Hamiltonian cycle (a cycle that&#xA; passes through each node exactly once) problem polynomially reduce...
complexity theory np complete reductions
0
1,531
Is Logical Min-Cut NP-Complete?
<h3>Logical Min Cut (LMC) problem definition</h3>&#xA;&#xA;<p>Suppose that $G = (V, E)$ is an unweighted digraph, $s$ and $t$ are two vertices of $V$, and $t$ is reachable from $s$. The LMC Problem studies how we can make $t$ unreachable from $s$ by the removal of some edges of $G$ following the following constraints:<...
complexity theory graphs np complete
1
1,536
Closure against the operator $A(L)=\{ww^Rw \mid w \in L \wedge |w| \lt 2007\}$
<p>I would like your help with the following question:</p>&#xA;&#xA;<blockquote>&#xA; <p>Let $L$ be a language, and operator $A(L)=\{\,ww^Rw \mid w \in L\ \wedge\ |w| \lt 2007\,\}$ where $x^R$ is the reversed string of $x$. Which of the&#xA; following statements are correct?</p>&#xA; &#xA; <ol>&#xA; <li>If $L$ is...
formal languages regular languages context free closure properties
1
1,540
Finding a worst case of heap sort
<p>I'm working on problem H in the <a href="http://neerc.ifmo.ru/past/2004/problems/problems.pdf" rel="noreferrer">ACM ICPC 2004–2005 Northeastern European contest</a>.</p>&#xA;&#xA;<p>The problem is basically to find the worst case that produces a maximal number of exchanges in the algorithm (sift down) to build the h...
algorithms data structures algorithm analysis sorting
0
1,542
Approximation algorithm for TSP variant, fixed start and end anywhere but starting point + multiple visits at each vertex ALLOWED
<p>NOTE: Due to the fact that the trip does not end at the same place it started and also the fact that every point can be visited more than once as long as I still visit all of them, this is not really a TSP variant, but I put it due to lack of a better definition of the problem.</p>&#xA;&#xA;<p>This problem was origi...
algorithms complexity theory graphs approximation
1
1,547
Closure against right quotient with a fixed language
<p>I'd really love your help with the following:</p>&#xA;&#xA;<p>For <em>any</em> fixed $L_2$ I need to decide whether there is closure under the following operators:</p>&#xA;&#xA;<ol>&#xA;<li><p>$A_r(L)=\{x \mid \exists y \in L_2 : xy \in L\}$</p></li>&#xA;<li><p>$A_l(L)=\{x \mid \exists y \in L : xy \in L_2\}$.</p>...
formal languages regular languages closure properties
1
1,548
Techniques/tools for constructing hard instances of a puzzle game
<blockquote>&#xA; <p>Are there techniques and/or software tools that can be used to&#xA; construct hard instances of a simple puzzle game (or a simple planning&#xA; problem)?</p>&#xA;</blockquote>&#xA;&#xA;<p>With "hard" I mean that any solution of the instance is "long" with respect to the input size.</p>&#xA;&#xA;...
algorithms
0
1,549
Operations under which the class of undecidable languages isn't closed
<p>Do there exist undecidable languages such that their union/intersection/concatenated language is decidable? What is the physical interpretation of such example because in general, undecidable languages are not closed under these operations?</p>&#xA;&#xA;<p>What can we say about the kleene closure? Do we have example...
formal languages undecidability closure properties
0
1,556
Is $A=\{ w \in \{a,b,c\}^* \mid \#_a(w)+ 2\#_b(w) = 3\#_c(w)\}$ a CFG?
<p>I wonder whether the following language is a context free language:&#xA;$$A = \{w \in \{a,b,c\}^* \mid \#_a(w) + 2\#_b(w) = 3\#c(w)\}$$&#xA;where $\#_x(w)$ is the number of occurrences of $x$ in $w$.&#xA;I can't find any word that would be useful to refute by the pumping lemma, on the other hand I haven't been able ...
formal languages context free
1
1,560
Can a program language be malleable enough to allow programs to extend language semantics
<p>With reference to features in languages like ruby (and javascript), which allow a programmer to extend/override classes any time after defining it (including classes like String), is it theoretically feasible to design a language which can allow programs to later on extend its semantics.</p>&#xA;&#xA;<p>ex: Ruby doe...
programming languages semantics
1
1,562
Turing reducibility implies mapping reducibility
<p>The question is whether the following statement is true or false:</p>&#xA;&#xA;<p>$A \leq_T B \implies A \leq_m B$</p>&#xA;&#xA;<p>I know that if $A \leq_T B$ then there is an oracle which can decide A relative to B. I know that this is not enough to say that there is a computable function from A to B that can satis...
computability reductions turing machines
1
1,567
Running time - Linked Lists Polynomial
<p>I have developed two algorithms and now they are asking me to find their running time.&#xA;The problem is to develop a singly linked list version for manipulating polynomials. The two main operations are <em>addition</em> and <em>multiplication</em>.</p>&#xA;&#xA;<p>In general for lists the running for these two ope...
algorithms algorithm analysis runtime analysis
1
1,576
Master theorem and constants independent of $n$
<p>I applied the Master theorem to a recurrence for a running time I encountered (this is a simplified version):</p>&#xA;&#xA;<p>$$T(n)=4T(n/2)+O(r)$$</p>&#xA;&#xA;<p>$r$ is independent of $n$. Case 1 of the Master theorem applies and tells us that $T(n)=O(n^2)$.</p>&#xA;&#xA;<p>However, this hides a constant dependent...
algorithm analysis asymptotics recurrence relation mathematical analysis master theorem
0
1,577
How do I test if a polygon is monotone with respect to a line?
<p>It's well known that <a href="http://en.wikipedia.org/wiki/Monotone_polygon" rel="nofollow noreferrer">monotone polygons</a> play a crucial role in <a href="http://en.wikipedia.org/wiki/Polygon_triangulation" rel="nofollow noreferrer">polygon triangulation</a>. </p>&#xA;&#xA;<blockquote>&#xA; <p><strong>Definition:...
algorithms computational geometry
1
1,579
Is using a more informed heuristic guaranteed to expand fewer nodes of the search space?
<p>I'm reading through the <a href="http://www.cs.rmit.edu.au/AI-Search/Courseware/Slides1/" rel="noreferrer">RMIT course notes on state space search</a>.&#xA;Consider a state space $S$, a set of nodes in which we look for an element having a certain property.&#xA;A <a href="http://www.cs.rmit.edu.au/AI-Search/Coursewa...
artificial intelligence heuristics search problem
0
1,580
Distributed vs parallel computing
<p>I often hear people talking about <em>parallel</em> computing and <em>distributed</em> computing, but I'm under the impression that there is no clear boundary between the 2, and people tend to confuse that pretty easily, while I believe it is very different:</p>&#xA;&#xA;<ul>&#xA;<li><em>Parallel</em> computing is m...
terminology distributed systems parallel computing
1
1,586
Can we show a language is not computably enumerable by showing there is no verifier for it?
<p>One of the definitions of a computably enumerable (c.e., equivalent to recursively enumerable, equivalent to semidecidable) set is the following:</p>&#xA;&#xA;<blockquote>&#xA; <p>$A \subseteq \Sigma^*$ is c.e. iff there is a decidable language $V\subseteq \Sigma^*$ (called verifier) s.t. &#xA; for all $x\in \Sigm...
computability proof techniques undecidability
0
1,589
Building ideal skip lists
<p>I'm trying to find the best algorithm for converting an “ordinary” linked list into an “ideal" skip list. </p>&#xA;&#xA;<p>The definition of an “ideal skip list” is that in the first level we'll have all the elements, half of them in the next level, a quarter of them in the level after that, and so on.</p>&#xA;&#xA;...
algorithms data structures randomized algorithms lists
0
1,591
Finding the maximum bandwidth along a single path in a network
<p>I am trying to search for an algorithm that can tell me which node has the highest download (or upload) capacity given a weighted directed graph, where weights correspond to individual link bandwidths. I have looked at the maximal flow problem and at the Edmond-Karp algorithm. My questions are the following: </p>&#x...
algorithms graphs network flow
1
1,592
Why does $A(L)= \{ w_1w_2: |w_1|=|w_2|$ and $w_1, w_2^R \in L \}$ generate a context free language for regular $L$?
<p>How can I prove that the language that the operator $A$ defines for regular language $L$ is a context free language.</p>&#xA;&#xA;<p>$A(L)= \{ w_1w_2: |w_1|=|w_2|$ and $w_1, w_2^R \in L \}$, where $x^R$ is the reversed form of $x$. </p>&#xA;&#xA;<p>I understand that since $L$ is regular so does $L^R$.also on my way ...
formal languages regular languages context free formal grammars
1
1,595
What is the difference between classical crypto and post-quantum crypto?
<p>Will there be a need to change the definitions of security if we have quantum computers? What cryptographic constructions will break? Do you know a survey or an article that explains what will be needed to change?</p>&#xA;
reference request cryptography quantum computing
0