id
int64
1
141k
title
stringlengths
15
150
body
stringlengths
43
35.6k
tags
stringlengths
1
118
label
int64
0
1
841
Proving a binary heap has $\lceil n/2 \rceil$ leaves
<p>I'm trying to prove that a <a href="http://en.wikipedia.org/wiki/Binary_heap">binary heap</a> with $n$ nodes has exactly $\left\lceil \frac{n}{2} \right\rceil$ leaves, given that the heap is built in the following way:</p>&#xA;&#xA;<p>Each new node is inserted via <a href="http://en.wikipedia.org/wiki/Binary_heap#In...
data structures binary trees
1
842
Can a dynamic language like Ruby/Python reach C/C++ like performance?
<p>I wonder if it is possible to build compilers for dynamic languages like Ruby to have similar and comparable performance to C/C++? From what I understand about compilers, take Ruby for instance, compiling Ruby code can't ever be efficient because the way Ruby handles reflection, features such as automatic type conve...
programming languages compilers
0
850
Is the shadow ray in a Whitted ray tracer occluded by transparent objects?
<p>In a Whitted ray tracer, each ray-object intersection spawns a transmitted ray (if the object was translucent), a reflected ray and a shadow ray. The shadow ray contributes the direct lighting component.</p>&#xA;&#xA;<p>But what happens if the shadow ray intersects a transparent object? Is the direct lighting compon...
graphics
1
851
Polymorphism and Inductive datatypes
<p>I'm curious. I've been working on this datatype in <em>OCaml</em>:</p>&#xA;&#xA;<pre><code>type 'a exptree =&#xA; | Epsilon&#xA; | Delta of 'a exptree * 'a exptree&#xA; | Omicron of 'a&#xA; | Iota of 'a exptree exptree&#xA;</code></pre>&#xA;&#xA;<p>Which can be manipulated using explicitly typed recursive functi...
logic programming languages coq inductive datatypes
1
857
How to fool the plot inspection heuristic?
<p>Over <a href="https://cs.stackexchange.com/a/825/98">here</a>, Dave Clarke proposed that in order to compare asymptotic growth you should plot the functions at hand. As a theoretically inclined computer scientist, I call(ed) this vodoo as a plot is never proof. On second thought, I have to agree that this is a very ...
asymptotics didactics
1
864
Reducing directed hamiltonian cycle to graph coloring
<p>The 3-SAT problem can be reduced to both the graph coloring and the directed hamiltonian cycle problem, but is there any chain of reductions which reduce directed hamiltonian cycle to graph coloring in polynomial time?</p>&#xA;
complexity theory np complete reductions
1
868
Types of Automated Theorem Provers
<p><sup><em>I am learning <a href="http://en.wikipedia.org/wiki/Automated_theorem_proving" rel="nofollow noreferrer">Automated Theorem Proving</a> / <a href="http://en.wikipedia.org/wiki/Satisfiability_Modulo_Theories" rel="nofollow noreferrer">SMT solvers</a> / <a href="http://en.wikipedia.org/wiki/Proof_assistant" re...
logic automated theorem proving proof assistants
1
878
Issue in comparing classifiers for pattern recognition
<p>I have designed a classifier M which recognizes gestures and classifies it under any category always. A gesture is classified based on the hamming distance between the sample time series y and the training time series x. The result of the classifier are probabilistic values. There are 3 classes/categories with label...
machine learning pattern recognition
1
879
Why do some inference engines need human assistance while others don't?
<p><sup><em>I am learning <a href="http://en.wikipedia.org/wiki/Automated_theorem_proving" rel="nofollow noreferrer">Automated Theorem Proving</a> / <a href="http://en.wikipedia.org/wiki/Satisfiability_Modulo_Theories" rel="nofollow noreferrer">SMT solvers</a> / <a href="http://en.wikipedia.org/wiki/Proof_assistant" re...
logic proof assistants automated theorem proving smt solvers
1
880
Priority queue with both decrease-key and increase-key operations
<p>A <a href="http://en.wikipedia.org/wiki/Fibonacci_heap#Summary_of_running_times">Fibonnaci Heap</a> supports the following operations:</p>&#xA;&#xA;<ul>&#xA;<li><code>insert(key, data)</code> : adds a new element to the data structure</li>&#xA;<li><code>find-min()</code> : returns a pointer to the element with minim...
data structures priority queues
1
882
Why is unification so important to inference engines?
<p><sup><em>I am learning <a href="http://en.wikipedia.org/wiki/Automated_theorem_proving" rel="noreferrer">Automated Theorem Proving</a> / <a href="http://en.wikipedia.org/wiki/Satisfiability_Modulo_Theories" rel="noreferrer">SMT solvers</a> / <a href="http://en.wikipedia.org/wiki/Proof_assistant" rel="noreferrer">Pro...
logic proof assistants automated theorem proving smt solvers unification
1
888
Computer Science Book for Young Adults
<p>What is a good beginner computer science book for a young adult, say, a 15 year old? I want to get started in CS, but have no idea where to start. I have limited experience in programming.</p>&#xA;
education reference request
0
897
Does spanning tree make sense for DAG?
<p>Why cannot I find any information about spanning tree for DAG ? I must be wrong somewhere.</p>&#xA;
graphs spanning trees
1
899
Why is using a lexer/parser on binary data so wrong?
<p>I often work with <a href="http://en.wikipedia.org/wiki/Lexical_analysis">lexer</a>/<a href="http://en.wikipedia.org/wiki/Parsing">parsers</a>, as opposed to a parser combinator and see people who never took a class in parsing, ask about parsing binary data. Typically the data is not only binary but also context sen...
programming languages compilers parsers
1
909
Knapsack problem -- NP-complete despite dynamic programming solution?
<p>Knapsack problems are easily solved by dynamic programming. Dynamic programming runs in polynomial time; that is why we do it, right?</p>&#xA;&#xA;<p>I have read it is actually an NP-complete problem, though, which would mean that solving the problem in polynomial problem is probably impossible.</p>&#xA;&#xA;<p>Wher...
complexity theory np complete dynamic programming
1
915
Solving Recurrences via Characteristic Polynomial with Imaginary Roots
<p>In algorithm analysis you often have to solve recurrences. In addition to Master Theorem, substitution and iteration methods, there is one using <em>characteristic polynomials</em>.</p>&#xA;&#xA;<p>Say I have concluded that a characteristic polynomial $x^2 - 2x + 2$ has <em>imaginary</em> roots, namely $x_1 = 1+i$ a...
algorithms algorithm analysis recurrence relation
0
923
Examples of sophisticated recursive algorithms
<p>I was explaining the famous deterministic <a href="http://en.wikipedia.org/wiki/Selection_algorithm#Linear_general_selection_algorithm_-_Median_of_Medians_algorithm">linear-time selection algorithm</a> (median of medians algorithm) to a friend.</p>&#xA;&#xA;<p>The recursion in this algorithm (while being very simple...
algorithms recursion
0
930
Adding elements to a sorted array
<p>What would be the fastest way of doing this (from an algorithmic perspective, as well as a practical matter)?</p>&#xA;&#xA;<p>I was thinking something along the following lines.</p>&#xA;&#xA;<p>I could add to the end of an array and then use bubblesort as it has a best case (totally sorted array at start) that is cl...
algorithms efficiency arrays sorting
1
933
Computational power of nondeterministic type-2 min-heap automata
<p>I have asked a series of questions concerning capabilities of a certain class of exotic automata which I have called <em>min-heap automata</em>; the original question, and links to others, can be found <a href="https://cs.stackexchange.com/q/110/69">here</a>.</p>&#xA;&#xA;<p>This question concerns the computational ...
formal languages automata
0
934
Computational power of nondeterministic type-1 min-heap automata with multiple heaps
<p>I have asked a series of questions concerning capabilities of a certain class of exotic automata which I have called <em>min-heap automata</em>; the original question, and links to others, can be found <a href="https://cs.stackexchange.com/q/110/69">here</a>.</p>&#xA;&#xA;<p>This question concerns the power of type-...
formal languages automata
1
938
From the LR(1) parsing table, can we deduce that it is also an LALR and SLR table?
<p>There is this question I read somewhere but could not answer myself.</p>&#xA;&#xA;<p>Assume I have an LR(1) Parsing table. Is there any way that just by looking at it and its items, can I deduce that it is also a table for LALR and SLR?</p>&#xA;
compilers parsers
1
939
Optimization version of decision problems
<p>It is known that each optimization/search problem has an equivalent decision problem. For example the shortest path problem</p>&#xA;&#xA;<blockquote>&#xA; <ul>&#xA; <li><strong>optimization/search version:</strong>&#xA; Given an undirected unweighted graph $G = (V, E)$ and two vertices $v,u\in V$, find a shortest...
complexity theory optimization search problem decision problem
0
944
Power of nondeterministic type-1 min-heap automaton with both a heap and a stack
<p>I have asked a series of questions concerning capabilities of a certain class of exotic automata which I have called min-heap automata; the original question, and links to others, can be found <a href="https://cs.stackexchange.com/q/110/69">here</a>.</p>&#xA;&#xA;<p>Two of my last questions seem to have been quickly...
formal languages automata
1
945
Difference between "information" and "useful information" in algorithmic information theory
<p>According to <a href="http://en.wikipedia.org/wiki/Algorithmic_information_theory#Overview">Wikipedia</a>:</p>&#xA;&#xA;<blockquote>&#xA; <p>Informally, from the point of view of algorithmic information theory, the information content of a string is equivalent to the length of the shortest possible self-contained r...
information theory terminology kolmogorov complexity
1
971
Quantum lambda calculus
<p>Classically, there are 3 popular ways to think about computation: Turing machine, circuits, and lambda-calculus (I use this as a catch all for most functional views). All 3 have been fruitful ways to think about different types of problems, and different fields use different formulation for this reason.</p>&#xA;<p>W...
lambda calculus quantum computing reference request computation models
1
974
How to prove that $n(\log_3(n))^5 = O(n^{1.2})$?
<p>This a homework question from Udi Manber's book. Any hint would be nice :)</p>&#xA;&#xA;<p>I must show that:</p>&#xA;&#xA;<blockquote>&#xA; <p>$n(\log_3(n))^5 = O(n^{1.2})$</p>&#xA;</blockquote>&#xA;&#xA;<p>I tried using Theorem 3.1 of book:</p>&#xA;&#xA;<blockquote>&#xA; <p>$f(n)^c = O(a^{f(n)})$ (for $c &gt; 0$,...
asymptotics landau notation mathematical analysis
1
982
"NP-complete" optimization problems
<p>I am slightly confused by some terminology I have encountered regarding the complexity of optimization problems. In an algorithms class, I had the <a href="http://en.wikipedia.org/wiki/Maximum_parsimony_%28phylogenetics%29#Problems_with_maximum_parsimony_phylogeny_estimation">large parsimony</a> problem described a...
complexity theory np complete terminology
1
983
Pattern classification: what goes into the sample?
<p>I am trying to compare the performance of a classification result with Bayes classifier, K-NN, Piece wise component analysis (PCA). I have doubts regarding the following (please excuse my lack of programming skills since I am a biologist and not a programmer thus finding the Matlab documentation hard to follow).</p>...
machine learning modelling pattern recognition
0
987
In Constraint Programming, are there any models that take into account the number of variable changes?
<p>Consider a CSP model where changing the value of a particular variable is expensive. Is there any work where the objective function also considers the number of changes in the value of the variable during the search process?</p>&#xA;&#xA;<p>An example: The expensive-to-change variable may be in the control of some o...
algorithms constraint programming
0
991
Are there minimum criteria for a programming language being Turing complete?
<p>Does there exist a set of programming language constructs in a programming language in order for it to be considered Turing Complete?</p>&#xA;&#xA;<p>From what I can tell from <a href="http://en.wikipedia.org/wiki/Turing_completeness">wikipedia</a>, the language needs to support recursion, or, seemingly, must be abl...
computability programming languages turing machines turing completeness
1
996
About Codd's reduction algorithm
<p><a href="http://dictionary.reference.com/browse/Codd%27s+reduction+algorithm" rel="nofollow noreferrer">Codd's Algorithm</a> converts an expression in tuple relational calculus to Relational Algebra.</p>&#xA;&#xA;<ol>&#xA;<li>Is there a standard implementation of the algorithm? </li>&#xA;<li>Is this algorithm used a...
algorithms database theory
1
998
distributed alpha beta pruning
<p>I am looking for an efficient algorithm that lets me process the minimax search tree for chess with <a href="http://en.wikipedia.org/wiki/Alpha-beta_pruning">alpha-beta pruning</a> on a distributed architecture. The algorithms I have found (PVS, YBWC, DTS see below) are all quite old (1990 being the latest). I assum...
algorithms distributed systems board games
0
999
Complexity of Towers of Hanoi
<p>I ran into the following doubts on the complexity of <a href="http://en.wikipedia.org/wiki/Tower_of_Hanoi">Towers of Hanoi</a>, on which I would like your comments.</p>&#xA;&#xA;<ul>&#xA;<li><p><b>Is it in NP? </b> &#xA;Attempted answer: Suppose Peggy (prover) solves the problem &amp; submits it to Victor (verifier)...
complexity theory time complexity towers of hanoi
1
1,001
Optimal algorithm for finding the girth of a sparse graph?
<p>I wonder how to find the <a href="http://en.wikipedia.org/wiki/Girth_%28graph_theory%29">girth</a> of a sparse undirected graph. By sparse I mean $|E|=O(|V|)$. By optimum I mean the lowest time complexity.</p>&#xA;&#xA;<p>I thought about some modification on <a href="http://en.wikipedia.org/wiki/Tarjan%27s_strongly_...
algorithms time complexity graphs
1
1,002
Showing that a problem in X is not X-Complete
<p>The <a href="http://en.wikipedia.org/wiki/Existential_theory_of_the_reals" rel="noreferrer">Existential Theory of the Reals</a> is in <strong>PSPACE</strong>, but I don't know whether it is <strong>PSPACE-Complete</strong>. If I believe that it is not the case, how could I prove it?</p>&#xA;&#xA;<p>More generally,...
complexity theory proof techniques
1
1,004
Most efficient know way to match orders
<p>Consider two 2D-Array $B_{ij} $ (the buy array) and $S_{ij}$ (the sell array) where each $i^{th}$ element is associated with an array of floating-point values and each of the floating point value, in turn, is associated with an array of integers.</p>&#xA;&#xA;<p>For example</p>&#xA;&#xA;<pre><code>B = [ &#xA; 0001 ...
algorithms
0
1,006
Regular sets have linear growth?
<p>Is it true that the set $\{ 0^{n^2} \mid n \in\mathbb{N} \}$ is not regular because it does not grow linearly?</p>&#xA;&#xA;<blockquote>&#xA; <p>Regular sets are called regular because if you have a regular set then you can always pump it up (pumping lemma) in regular intervals and get other things in the set. They...
formal languages regular languages
0
1,012
Lambda Calculus Evaluation
<p>I know this is a simple question but can someone show me how&#xA;$(\lambda y. \lambda x. \lambda y.y) (\lambda x. \lambda y. y)$ reduces to $\lambda x. \lambda y. y$.</p>&#xA;
logic lambda calculus
1
1,016
Branch and Bound explanation
<p>I have a test about the <a href="http://en.wikipedia.org/wiki/Branch_and_bound">branch and bound</a> algorithm. I understand theoretically how this algorithm works but I couldn't find examples that illustrates how this algorithm can be implemented practically. </p>&#xA;&#xA;<p>I found some examples such as <a href="...
algorithms optimization branch and bound
0
1,017
Regular Expression for the language that requires one symbol to occur at least once
<p>I am trying to figure out the simplest way to do this using a regular expression. </p>&#xA;&#xA;<ul>&#xA;<li>Three symbols a, b, c.</li>&#xA;<li>The sequence length is unlimited, i.e. *.</li>&#xA;<li>The symbol a must be somewhere in the sequence at least once, but can appear more than once. </li>&#xA;<li>The sequen...
formal languages regular expressions
1
1,018
Non-Parametric Methods Like K-Nearest-Neighbours in High Dimensional Feature Space
<p>The main idea of <a href="https://en.wikipedia.org/wiki/K-nearest_neighbor_algorithm">k-Nearest-Neighbour</a> takes into account the $k$ nearest points and decides the classification of the data by majority vote. If so, then it should not have problems in higher dimensional data because methods like <a href="https:/...
machine learning artificial intelligence
1
1,020
How to implement AO* algorithm?
<p>I have noticed that different data structures are used when we implement search algorithms. For example, we use queues to implement breadth first search, stacks to implement depth-first search and min-heaps to implement the <a href="https://en.wikipedia.org/wiki/A%2a_algorithm">A* algorithm</a>. In these cases, we d...
algorithms graphs data structures search algorithms
0
1,027
Using Pumping Lemma to prove language $L = \{(01)^m 2^m \mid m \ge0\}$ is not regular
<p>I'm trying to use pumping lemma to prove that $L = \{(01)^m 2^m \mid m \ge0\}$ is not regular.</p>&#xA;&#xA;<p>This is what I have so far: Assume $L$ is regular and let $p$ be the pumping length, so $w = (01)^p 2^p$. Consider any pumping decomposition $w = xyz$ such that $|y| &gt;0$ and $|xy| \le p$.</p>&#xA;&#xA;<...
formal languages regular languages pumping lemma
0
1,029
reduce reduce and shift reduce error in LALR grammar
<p>I have to write a grammar for Pascal, and there is just one thing that is causing problems. </p>&#xA;&#xA;<p>Lets say we have operators (sorted by priority from low to high):</p>&#xA;&#xA;<ol>&#xA;<li><em>Postfix <code>^</code></em>.</li>&#xA;<li><em>Prefix <code>^</code></em>.</li>&#xA;<li><em><code>[ ]</code></em>...
programming languages parsers formal grammars
0
1,031
How to prove that a language is not regular?
<p>We learned about the class of regular languages $\mathrm{REG}$. It is characterised by any one concept among regular expressions, finite automata and left-linear grammars, so it is easy to show that a given language is regular.</p>&#xA;&#xA;<p>How do I show the opposite, though? My TA has been adamant that in order ...
formal languages regular languages proof techniques reference question
1
1,039
Number of words in the regular language $(00)^*$
<p><a href="http://en.wikipedia.org/wiki/Regular_language#The_number_of_words_in_a_regular_language">According to Wikipedia</a>, for any regular language $L$ there exist constants $\lambda_1,\ldots,\lambda_k$ and polynomials $p_1(x),\ldots,p_k(x)$ such that for every $n$ the number $s_L(n)$ of words of length $n$ in $L...
formal languages regular languages combinatorics word combinatorics
1
1,045
Number of words of a given length in a regular language
<p>Is there an algebraic characterization of the number of words of a given length in a regular language?</p>&#xA;&#xA;<p><a href="http://en.wikipedia.org/wiki/Regular_language#The_number_of_words_in_a_regular_language" rel="nofollow noreferrer">Wikipedia</a> states a result somewhat imprecisely:</p>&#xA;&#xA;<blockquo...
formal languages regular languages word combinatorics
1
1,050
Multiples of n is a regular language
<blockquote>&#xA; <p><strong>Possible Duplicate:</strong><br>&#xA; <a href="https://cs.stackexchange.com/questions/640/language-of-the-values-of-an-affine-function">Language of the values of an affine function</a> </p>&#xA;</blockquote>&#xA;&#xA;&#xA;&#xA;<p>Let $C_n = \{x\mid x \text{ is a binary number that is a m...
formal languages regular languages
0
1,053
Subset Sum Requirements
<p>Consider the following problem.</p>&#xA;&#xA;<blockquote>&#xA; <p>Given a set $S$ of integers, a function $f : \mathbb{Z} \to \mathbb{Z}$ and $k \in \mathbb{Z}$, decide wether there is $X \subseteq S$ such that $f\left(\sum_{x\in X}x\right)=k$.</p>&#xA;</blockquote>&#xA;&#xA;<p>Is this still considered a <a href="...
complexity theory
0
1,058
Supporting data structures for SAT local search
<p><a href="http://en.wikipedia.org/wiki/WalkSAT" rel="nofollow noreferrer">WalkSAT and GSAT</a> are well-known and simple local search algorithms for solving the Boolean satisfiability problem. The pseudocode for the GSAT algorithm is copied from the question <a href="https://cs.stackexchange.com/questions/219/impleme...
algorithms data structures satisfiability
1
1,060
Confluence proof for a simple rewriting system
<p>Assume we have a simple language that consists of the terms:</p>&#xA;&#xA;<ul>&#xA;<li>$\mathtt{true}$</li>&#xA;<li>$\mathtt{false}$</li>&#xA;<li>if $t_1,t_2,t_3$ are terms then so is $\mathtt{if}\: t_1 \:\mathtt{then}\: t_2 \:\mathtt{else}\: t_3$</li>&#xA;</ul>&#xA;&#xA;<p>Now assume the following logical evaluatio...
logic semantics proof techniques term rewriting
1
1,062
How many shortest distances change when adding an edge to a graph?
<p>Let $G=(V,E)$ be some complete, weighted, undirected graph. We construct a second graph $G&#39;=(V, E&#39;)$ by adding edges one by one from $E$ to $E&#39;$. We add $\Theta(|V|)$ edges to $G&#39;$ in total.</p>&#xA;&#xA;<p>Every time we add one edge $(u,v)$ to $E&#39;$, we consider the shortest distances between all...
algorithms graphs shortest path
1
1,065
What is the difference between user-level threads and kernel-level threads?
<p>After reading several sources I'm still confused about user- and kernel-level threads. </p>&#xA;&#xA;<p>In particular:</p>&#xA;&#xA;<blockquote>&#xA; <p>Threads can exist at both the user level and the kernel level</p>&#xA;</blockquote>&#xA;&#xA;<p>What is the difference between the user level and kernel level? </p...
operating systems terminology concurrency os kernel
1
1,069
What use are the minimum values on minimax trees?
<p>Consider a <a href="http://en.wikipedia.org/wiki/Minimax" rel="nofollow noreferrer">minimax</a> tree for an adversarial search problem. For example, in this picture (alpha-beta pruning):</p>&#xA;&#xA;<p><img src="https://i.stack.imgur.com/NmKIO.jpg" alt="enter image description here"></p>&#xA;&#xA;<p>When marking th...
data structures trees game theory
0
1,071
Is there an algorithm which finds sorted subsequences of size three in $O(n)$ time?
<p>I want to prove or disprove the existence of an algorithm which, given an array $A$ of integers, finds three indices $i, j$ and $k$ such that $i &lt; j &lt; k$ and $A[i] &lt; A[j] &lt; A[k]$ (or finds that there is no such triple) in linear time.</p>&#xA;&#xA;<p>This is not a homework question; I saw it on a program...
algorithms arrays subsequences
1
1,074
What is the purpose of M:N (Hybrid) threading?
<p>In other words, what advantages does <a href="http://en.wikipedia.org/wiki/Thread_%28computer_science%29#M%3aN_.28Hybrid_threading.29" rel="noreferrer">Hybrid threading</a> have over 1:1 (kernel only) and N:1 (user only) threading?</p>&#xA;&#xA;<p><sub>This is a follow-up to <a href="https://cs.stackexchange.com/que...
operating systems concurrency os kernel
1
1,076
How to approach Vertical Sticks challenge
<p>This problem is taken from <a href="https://www.interviewstreet.com/challenges/dashboard/#problem/4eed18ded76fe" rel="noreferrer">interviewstreet.com</a></p>&#xA;&#xA;<p>We are given an array of integers $Y=\{y_1,...,y_n\}$ that represents $n$ line segments such that endpoints of segment $i$ are $(i, 0)$ and $(i, y_...
algorithms probability theory
0
1,079
When did commercial Speech Recognition first begin using grammar (sentence structure) for prediction?
<p>It seems as though modern speech recognition (e.g., through Android, iOS phones) make use of grammar or sentence structure. (e.g., it might have a tough time distinguishing between "grammar" and "grandma" but can distinguish between "I'm going to see grandma" and "I'm reading a book on english grammar". (yes, I just...
natural language processing history
0
1,084
How to implement the details of shotgun hill climbing to make it effective?
<p>I am currently working on a solution to a problem for which (after a bit of research) the use of a hill climbing, and more specificly a <em>shotgun</em> (or <em>random-restart</em>) <a href="http://en.wikipedia.org/wiki/Hill_climbing" rel="nofollow">hill climbing</a> algorithmic idea seems to be the best fit, as I h...
algorithms optimization heuristics
1
1,088
What happens to the cache contents on a context switch?
<p>In a multicore processor, what happens to the contents of a core's cache (say L1) when a context switch occurs on that cache?</p>&#xA;&#xA;<p>Is the behaviour dependent on the architecture or is it a general behaviour followed by all chip manufacturers?</p>&#xA;
computer architecture operating systems cpu cache
1
1,092
Constraint-based Type Inference with Algebraic Data
<p>I am working on an expression based language of ML genealogy, so it naturally needs type inference >:)</p>&#xA;&#xA;<p>Now, I am trying to extend a constraint-based solution to the problem of inferring types, based on a simple implementation in EOPL (Friedman and Wand), but they elegantly side-step algebraic datatyp...
programming languages type theory functional programming inductive datatypes typing
0
1,100
How are statistics being applied in computer science to evaluate accuracy in research claims?
<p>I have noticed in my short academic life that many published papers in our area sometimes do not have much rigor regarding statistics. This is not just an assumption; I have heard professors say the same. </p>&#xA;&#xA;<p>For example, in CS disciplines I see papers being published claiming that methodology X has bee...
software engineering empirical research statistics
1
1,106
Which queue does the long-term scheduler maintain?
<p>There are different queues of processes (in an operating system):</p>&#xA;&#xA;<p><em>Job Queue:</em> Each new process goes into the job queue. Processes in the job queue reside on mass storage and await the allocation of main memory.</p>&#xA;&#xA;<p><em>Ready Queue:</em> The set of all processes that are in main me...
operating systems terminology process scheduling
1
1,113
How to construct the found path in bidirectional search
<p>I am trying to implement bidirectional search in a graph. I am using two breadth first searches from the start node and the goal node. The states that have been checked are stored in two hash tables (closed lists).&#xA;How can I get the solution (path from the start to the goal), when I find that a state that is che...
algorithms graphs shortest path
1
1,117
Machine learning algorithm to play Connect Four
<p>I'm currently reading about machine learning and wondered how to apply it to playing <a href="http://en.wikipedia.org/wiki/Connect_Four">Connect Four</a>.</p>&#xA;&#xA;<p>My current attempt is a simple multiclass classificator using a sigmoid function model and the one-vs-all method.</p>&#xA;&#xA;<p>In my opinion, t...
machine learning board games
0
1,118
Subset-sum and 3SAT
<p>Two things (this may be naive):</p>&#xA;&#xA;<ol>&#xA;<li><p>Does anyone believe there is a sub-exponential time algorithm for the <a href="http://en.wikipedia.org/wiki/Subset_sum_problem" rel="nofollow">Subset-sum problem</a>? It seems obvious to me that you would have to look through all possible subsets to prove ...
complexity theory time complexity np complete reductions
0
1,121
Choosing taps for Linear Feedback Shift Register
<p>I am confused about how taps are chosen for Linear Feedback Shift Registers.</p>&#xA;<p>I have a diagram which shows a LFSR with connection polynomial <span class="math-container">$C(X) = X^5 + X^2 + 1$</span>. The five stages are labelled: <span class="math-container">$R4, R3, R2, R1$</span> and <span class="math-c...
cryptography pseudo random generators shift register
1
1,122
Is it viable to use an HMM to evaluate how well a catalogue is used?
<p>I was interested on evaluating a catalogue that students would be using to observe how is it being used probabilistically. </p>&#xA;&#xA;<p>The catalogue works by choosing cells in a temporal sequence, so for example:</p>&#xA;&#xA;<ul>&#xA;<li>Student A has: ($t_1$,$Cell_3$),($t_2$,$Cell_4$)</li>&#xA;<li>Student B h...
probability theory empirical research modelling hidden markov models
1
1,124
How to devise an algorithm that suggests feasible cooking recipes?
<p>I once had a veteran in my course that created an algorithm that would suggest cooking recipes. At first, all sort of crazy recipes would come out. Then, she would train the cooking algorithm with real recipes and eventually it would suggest very good ones. </p>&#xA;&#xA;<p>I believe she used something related to Ba...
machine learning artificial intelligence modelling recommendation systems
0
1,134
How does the NegaScout algorithm work?
<p>On Alpha-Beta pruning, <a href="http://en.wikipedia.org/wiki/Negascout" rel="noreferrer">NegaScout</a> claims that it can accelerate the process by setting [Alpha,Beta] to [Alpha,Alpha-1].</p>&#xA;&#xA;<p>I do not understand the whole process of NegaScout.</p>&#xA;&#xA;<p>How does it work? What is its recovery mecha...
algorithms algorithm analysis search algorithms
0
1,137
What is the difference between "Decision" and "Verification" in complexity theory?
<p>In Michael Sipser's <em>Theory of Computation</em> on page 270 he writes:</p>&#xA;&#xA;<blockquote>&#xA; <p>P = the class of languages for which membership can be decided quickly.<br>&#xA; NP = the class of languages for which membership can be verified quickly.</p>&#xA;</blockquote>&#xA;&#xA;<p>What is the differ...
complexity theory terminology decision problem
1
1,138
For every computable function $f$ does there exist a problem that can be solved at best in $\Theta(f(n))$ time?
<p>For every computable function $f$ does there exist a problem that can be solved at best in $\Theta(f(n))$ time or is there a computable function $f$ such that every problem that can be solved in $O(f(n))$ can also be solved in $o(f(n))$ time?</p>&#xA;&#xA;<p>This question popped into my head yesterday. I've been thi...
complexity theory
1
1,142
A continuous optimization problem that reduces to TSP
<p>Suppose I am given a finite set of points $p_1,p_2,..p_n$ in the plane, and asked to draw a twice-differentiable curve $C(P)$ through the $p_i$'s, such that its perimeter is as small as possible. Assuming $p_i=(x_i,y_i)$ and $x_i&lt;x_{i+1}$, I can formalize this problem as:</p>&#xA;&#xA;<p><i> Problem 1 (edited in...
complexity theory np hard optimization computable analysis
1
1,143
Finding a 5-Pointed Star in polynomial time
<p><strong>I want to establish that this is part of my homework for a course I am currently taking. I am looking for some assistance in proceeding, NOT AN ANSWER.</strong></p>&#xA;&#xA;<p>This is the question in question:</p>&#xA;&#xA;<blockquote>&#xA; <p>A 5-pointed-star in an undirected graph is a 5-clique. Show th...
complexity theory time complexity
1
1,147
Complexity of computing matrix powers
<p>I am interested in calculating the $n$'th power of a $n\times n$ matrix $A$. Suppose we have an algorithm for matrix multiplication which runs in $\mathcal{O}(M(n))$ time. Then, one can easily calculate $A^n$ in $\mathcal{O}(M(n)\log(n))$ time. Is it possible to solve this problem in lesser time complexity?</p>&#xA;...
algorithms complexity theory time complexity computer algebra
0
1,150
Is there evidence that using dynamic languages has an impact on productivity?
<p>I am wondering if there are any experiments that show the existence or the non-existence of a correlation between usage of a dynamic language (such as Python, Ruby, or even languages that run on the Java platform such as Groovy, Clojure) over a static language (such as C/C++), and the difference in the productivity....
programming languages empirical research software engineering
0
1,151
Where to get graphs to test my search algorithms against?
<p>I am implementing a set of path finding algorithms such as Dijkstra's, Depth First, etc.</p>&#xA;&#xA;<p>At first I used a couple of self made graphs, but now I'd like to take the challenge a bit further and thus I'm looking for either</p>&#xA;&#xA;<ol>&#xA;<li>graphs used in benchmarks;</li>&#xA;<li>graphs of real ...
algorithms graphs data sets benchmarking
0
1,154
How can I measure the usability of a catalogue?
<p>This question might seems vague but heres the context:</p>&#xA;&#xA;<p>When we are focusing on HCI we would most likely be interested on knowing first how the user usually deals with a certain object. We then try to see how our system could take away one of the tasks he would do himself and try to do it itself. </p>...
empirical research modelling hci
1
1,156
Introductory books on nature sciences behind bioinformatics
<p>My question goes to those who are concerned with computational biology algorithmics. I'm going to take a course on bioinformatics this fall; the problem, however, is that I have too little background in biology and chemistry to feel prepared for that cycle of lections (I was rather weak at these subjects at school)....
algorithms reference request education bioinformatics
0
1,157
Loop invariant for an algorithm
<p>I have developed the following pseudocode for the sum of pairs problem:</p>&#xA;&#xA;<blockquote>&#xA; <p>Given an array $A$ of integers and an integer $b$, return YES if there are positions $i,j$ in $A$ with $A[i] + A[j] = b$, NO otherwise.</p>&#xA;</blockquote>&#xA;&#xA;<p>Now I should state a loop invariant that...
algorithms proof techniques loop invariants
0
1,176
HALF CLIQUE - NP Complete Problem
<p>Let me start off by noting <strong>this is a homework problem, please provide only advice and related observations, NO DIRECT ANSWERS please</strong>. With that said, here is the problem I am looking at:</p>&#xA;&#xA;<blockquote>&#xA; <p>Let HALF-CLIQUE = { $\langle G \rangle$ | $G$ is an undirected graph having a...
complexity theory np complete reductions
1
1,200
How to deal with arrays during Hoare-style correctness proofs
<p>In the discussion around <a href="https://cs.stackexchange.com/q/1157/98">this question</a>, Gilles mentions correctly that any correctness proof of an algorithm that uses arrays has to prove that there are no out-of-bounds array accesses; depending on the runtime model, this would cause a runtime error or access to...
proof techniques semantics arrays hoare logic software verification
1
1,217
How to devise an algorithm to arrange (resizable) windows on the screen to cover as much space as possible?
<p>I would like to write a simple program that accepts a set of windows (width+height) and the screen resolution and outputs an arrangement of those windows on the screen such that the windows take the most space. Therefore it is possible to resize a window, while maintaining <code>output size &gt;= initial size</code...
algorithms computational geometry packing user interface
0
1,218
Lower bounds of calculating a function of a set
<p>Having a set $A$ of $n$ elements, let's say I want to calculate a function $f(A)$ that is sensitive to all parts of the input, i.e. depends on very member of $A$ (i.e. it is possible to change any member of $A$ to something else to obtain a new input $A&#39;$ s.t. value of $f$ on $A$ and $A&#39;$ are different).</p>...
complexity theory
1
1,223
The space complexity of recognising Watson-Crick palindromes
<p>I have the following algorithmic problem:</p>&#xA;&#xA;<blockquote>&#xA; <p>Determine the space Turing complexity of recognizing DNA strings that are Watson-Crick palindromes. </p>&#xA;</blockquote>&#xA;&#xA;<p>Watson-Crick palindromes are strings whose reversed complement is the original string. The <em>complement...
algorithms algorithm analysis turing machines space complexity
1
1,225
Attack on hash functions that do not satisfy the one-way property
<p>I am revising for a computer security course and I am stuck on one of the past questions. Here is it:</p>&#xA;&#xA;<blockquote>&#xA; <p>Alice ($A$) wants to send a short message $M$ to Bob ($B$) using a shared secret $S_{ab}$ to authenticate that the message has come from her. She proposes to send a single message ...
cryptography hash one way functions
1
1,226
Are asymptotic lower bounds relevant to cryptography?
<p>An asymptotic lower bound such as exponential-hardness is generally thought to imply that a problem is "inherently difficult". Encryption that is "inherently difficult" to break is thought to be secure. </p>&#xA;&#xA;<p>However, an asymptotic lower bound does not rule out the possibility that a huge but finite class...
complexity theory cryptography asymptotics
0
1,229
Why does the splay tree rotation algorithm take into account both the parent and grandparent node?
<p>I don't quite understand why the rotation in the splay tree data structure is taking into account not only the parent of the rating node, but also the grandparent (zig-zag and zig-zig operation). Why would the following not work:</p>&#xA;&#xA;<p>As we insert, for instance, a new node to the tree, we check whether we...
algorithms data structures binary trees search trees
1
1,231
Efficiently selecting the median and elements to its left and right
<p>Suppose we have a set $S = \{ a_1,a_2,a_3,\ldots , a_N \}$ of $N$ coders.</p>&#xA;&#xA;<p>Each Coders has rating $R_i$ and the number of gold medals $E_i$, they had won so far.</p>&#xA;&#xA;<p>A Software Company wants to hire exactly three coders to develop an application.</p>&#xA;&#xA;<p>For hiring three coders, t...
algorithms algorithm design
1
1,234
Classification of intractable/tractable satisfiability problem variants
<p>Recently I found in a paper [1] a special symmetric version of SAT called the <strong>2/2/4-SAT</strong>. But there are many $\text{NP}$-complete variants out there, for example: <strong>MONOTONE NAE-3SAT</strong>, <strong>MONOTONE 1-IN-3-SAT</strong>, ...</p>&#xA;&#xA;<p>Some other variants are tractable: $2$-$\tex...
complexity theory reference request satisfiability
1
1,236
How does variance in task completion time affect makespan?
<p>Let's say that we have a large collection of tasks $\tau_1, \tau_2, ..., \tau_n$ and a collection of identical (in terms of performance) processors $\rho_1, \rho_2, ..., \rho_m$ which operate completely in parallel. For scenarios of interest, we may assume $m \leq n$. Each $\tau_i$ takes some amount of time/cycles t...
probability theory scheduling parallel computing
1
1,237
Complexity of Special Case Problems
<p>Often I see a sentence like this while reading texts on Computational Complexity:</p>&#xA;&#xA;<p>"For this special case of $\text{TSP}$" or</p>&#xA;&#xA;<p>"This is a special case of $\text{SAT}$" or</p>&#xA;&#xA;<p>"$k$-$\text{PARTITION}$ is the following special case of $\text{BIN PACKING}$" or</p>&#xA;&#xA;<p>"$...
complexity theory
0
1,240
How do I construct reductions between problems to prove a problem is NP-complete?
<p>I am taking a complexity course and I am having trouble with coming up with reductions between NPC problems. How can I find reductions between problems? Is there a general trick that I can use? How should I approach a problem that asks me to prove a problem is NPC?</p>&#xA;
complexity theory np complete proof techniques reductions
0
1,243
What is meant by "solvable by non deterministic algorithm in polynomial time"
<p>In many textbooks NP problems are defined as:</p>&#xA;&#xA;<blockquote>&#xA; <p>Set of all decision problems solvable by non deterministic algorithms in polynomial time</p>&#xA;</blockquote>&#xA;&#xA;<p>I couldn't understand the part "solvable by non deterministic algorithms". Could anyone please explain that?</p>&...
complexity theory terminology nondeterminism
1
1,246
Where can I find good study material on Role Mining?
<p>I need to cover these topics in Role Mining. If anyone knows good site which well summarizes the topics and concepts are well explained please help out.</p>&#xA;&#xA;<p>Basic role mining problem<br>&#xA;• Delta-approx RMP<br>&#xA;• Min-noise RMP<br>&#xA;• Nature of the RMP problems<br>&#xA;• Mapping RMP to database ...
education reference request security access control
1
1,255
Ordering elements so that some elements don't come between others
<p>Given an integer $n$ and set of triplets of distinct integers&#xA;$$S \subseteq \{(i, j, k) \mid 1\le i,j,k \le n, i \neq j, j \neq k, i \neq k\},$$&#xA;find an algorithm which either finds a permutation $\pi$ of the set $\{1, 2, \dots, n\}$ such that&#xA;$$(i,j,k) \in S \implies (\pi(j)&lt;\pi(i)&lt;\pi(k)) ~\lor~ ...
algorithms optimization scheduling
1
1,257
Chinese Postman Problem: finding best connections between odd-degree nodes
<p>I am writing a Program, solving the <a href="http://en.wikipedia.org/wiki/Route_inspection_problem" rel="nofollow">Chinese Postman Problem</a> (also known as route inspection problem) in an undirected draph and currently facing the problem to find the best additional edges to connect the nodes with odd degree, so I ...
algorithms graphs
0
1,259
A lambda calculus evaluation involving Church numerals
<p>I understand that a <a href="http://en.wikipedia.org/wiki/Church_encoding">Church numeral</a> $c_n$ looks like $\lambda s. \lambda z. s$ (... n times ...) $s\;z$. This means nothing more than "the function $s$ applied $n$ times to the function $z$".</p>&#xA;&#xA;<p>A possible definition of the $\mathtt{times}$ funct...
lambda calculus church numerals
1
1,268
Efficient queriable data structure to represent a screen with windows on it
<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>Imagine a screen, with 3 windows on it:</p>&#xA;&#xA;<p><img src="https://i.stack.imgur.com/vVUl3.jpg" alt="enter i...
algorithms computational geometry user interface modelling
0
1,270
What is the average turnaround time?
<p>For the following jobs: </p>&#xA;&#xA;<p><img src="https://i.stack.imgur.com/rwOBN.png" alt="job table"></p>&#xA;&#xA;<p>The <strong>average wait time</strong> would be using a FCFS algorithm:</p>&#xA;&#xA;<p>(6-6)+(7-2)+(11-5)+(17-5)+(14-1) -> 0+5+6+10+13 -> 34/5 = 7 (6.8)</p>&#xA;&#xA;<p>What would the <strong>ave...
algorithms operating systems process scheduling scheduling
1