instruction
stringlengths
0
29.8k
⌀
I'm pretty sure I've found an algorithm that does not rely on number theory or cycle theory. Note that there are a few details to work out (possibly tomorrow), but I'm quite confident they will work out. I handwave as I'm supposed to be sleeping, not because I'm trying to hide problems :) Let A be the first array, B...
*Note: This is a seeding question, so please feel free to be pedantic etc. I will be deleting this paragraph some time after accepting an answer.* I recently read that it is possible to have arrays which need not be initialized, i.e. it is possible to use them without having to spend any time trying to set each memb...
I'm pretty sure I've found an algorithm that does not rely on number theory or cycle theory. Note that there are a few details to work out (possibly tomorrow), but I'm quite confident they will work out. I handwave as I'm supposed to be sleeping, not because I'm trying to hide problems :) Let `A` be the first array,...
There are a great many data structures that implement the priority-queue interface: * Insert: insert an element into the structure * Get-Min: return the smallest element in the structure * Extract-Min: remove the smallest element in the structure Common data structures implementing this interface are (min)[heap...
I've heard of (structural) induction. It allows you to build up finite structures from smaller ones and gives you proof principles for reasoning about such structures. The idea is clear enough. > But what about coinduction? How does it work? How can one say anything conclusive about an infinite structure?
What is coinduction?
|logic|formal-methods|proof-techniques|
I'm pretty sure I've found an algorithm that does not rely on number theory or cycle theory. Note that there are a few details to work out (possibly tomorrow), but I'm quite confident they will work out. I handwave as I'm supposed to be sleeping, not because I'm trying to hide problems :) Let `A` be the first array,...
There are a great many data structures that implement the priority-queue interface: * Insert: insert an element into the structure * Get-Min: return the smallest element in the structure * Extract-Min: remove the smallest element in the structure Common data structures implementing this interface are (min)[heap...
Clustering of Songs (The Joe Walsh Problem)
Let us consider the following inductive definition: $\qquad \displaystyle \begin{align*} &\phantom{\Rightarrow} \quad \varepsilon \in \mathcal{T} \\ w \in \mathcal{T} \quad &\Rightarrow \quad aw \in \mathcal{T}\\ aw \in \mathcal{T} \quad &\Rightarrow \quad baw \in \mathcal{T} \end{align*}$ What is $\mat...
I've heard of (structural) induction. It allows you to build up finite structures from smaller ones and gives you proof principles for reasoning about such structures. The idea is clear enough. > But what about coinduction? How does it work? How can one say anything conclusive about an infinite structure? There a...
What you want to do seems to be known as *Audio Feature Extraction* or, more specifically, [*Music Information Retrieval*](https://en.wikipedia.org/wiki/Music_information_retrieval), that is automated methods that distill characteristics out of (sets of) music files. You would have to extract features of samples of bot...
First, to dispel a possible cognitive dissonance: reasoning about infinite structures is not a problem, we do it all the time. As long as the structure is finitely describable, that's not a problem. Here are a few common types of infinite structures: * languages (sets of strings over some alphabet, which may be fin...
First, to dispel a possible cognitive dissonance: reasoning about infinite structures is not a problem, we do it all the time. As long as the structure is finitely describable, that's not a problem. Here are a few common types of infinite structures: * languages (sets of strings over some alphabet, which may be fin...
Our idea is to use [threaded](https://en.wikipedia.org/wiki/Threaded_binary_tree) [splay trees](https://en.wikipedia.org/wiki/Splay_tree). Other than the Wikipedia article we will thread the trees so that every node has a pointer `next` to its successor in the in-order traversal; we also hold a pointer `start` to the s...
By request, here is the structure I found after I formulated the question: The basic idea is to use a [threaded][1] [Scapegoat tree][2] along with a pointer to the minimum (and for good measure, the maximum as well). A simpler alternative to threading is maintaining predecessor and successor pointers in every node (...
Most of us learned programming using "textual" programming languages like Basic, C/C++, and Java. I believe it is more natural and efficient for humans to think visually. Visual Programming allows developers to write programs by manipulating graphical elements. I guess using Visual Programming should improve the qualit...
Visual Programming languages
|programming-languages|
Most of us learned programming using "textual" programming languages like Basic, C/C++, and Java. I believe it is more natural and efficient for humans to think visually. Visual Programming allows developers to write programs by manipulating graphical elements. I guess using Visual Programming should improve the qualit...
Most of us learned programming using "textual" programming languages like Basic, C/C++, and Java. I believe it is more natural and efficient for humans to think visually. Visual programming allows developers to write programs by manipulating graphical elements. I guess using visual programming should improve the qualit...
null
Most of us learned programming using "textual" programming languages like Basic, C/C++, and Java. I believe it is more natural and efficient for humans to think visually. Visual programming allows developers to write programs by manipulating graphical elements. I guess using visual programming should improve the qualit...
A polynomial-time Turing machine algorithm is considered efficient if its run-time, in the worst-case, is bounded by a polynomial function in the input size. I'm aware of the strong Church-Turing thesis: >Any reasonable model of computation can be efficiently simulated on Turing machines However, I'm not aware of...
Notions of efficient computation
|complexity-theory|
A polynomial-time Turing machine algorithm is considered efficient if its run-time, in the worst-case, is bounded by a polynomial function in the input size. I'm aware of the strong Church-Turing thesis: >Any reasonable model of computation can be efficiently simulated on Turing machines However, I'm not aware of...
Given a [labelled transition system][1] $(S,\Lambda,\to)$, where $S$ is a set of states, $\Lambda$ is a set of labels, and $\to\subseteq S\times\Lambda\times S$ is a ternary relation. As usual, write $p \stackrel\alpha\rightarrow q$ for $(p,\alpha,q)\in\to$. The labelled transition $p\stackrel\alpha\to q$ denotes that ...
When is a bisimulation not the same as two simulations?
|semantics|process-algebras|
|formal-methods|semantics|process-algebras|
*(re-post of my comment as an answer)* The only party that generates encryptions of messages $m$ such that $m$: - contains 3 parts - begins with a "2" is Alice. Each time she generates such a chipertext, the last component is $P_A$. If $E$ is a strong enough encryption ([non malleable][1]), then Trudy will ...
Unless you gave unusual definitions for the terms *simulation* and *bisimulation*, and I don't think you did, a bisimulation is indeed a relation that is a simulation in both directions. If you don't believe me, try Coq (or spot my transcription error). `Transition a p p'` is $p \stackrel{a}\rightarrow p'$ and `R p q` ...
Most of us learned programming using "textual" programming languages like Basic, C/C++, and Java. I believe it is more natural and efficient for humans to think visually. Visual programming allows developers to write programs by manipulating graphical elements. I guess using visual programming should improve the qualit...
In terms of time complexity, I think this hard on lambda calculus. The reason is that the unit computational step in lambda calculus is $\beta$-reduction ([wikipedia entry](http://en.wikipedia.org/wiki/Lambda_calculus#Beta_reduction)): $$(\lambda x.{\rm term})v \to {\rm term}[x := v]$$ All expressions, regardless of th...
In general, there is a trade-off in programming language design between ease of use and expressiveness (power). Writing a simple "Hello, world" program in a beginner language, such as Scratch or App Inventor, is generally easier than writing it in a general-purpose programming language such as Java or C++, where you m...
There are other forms of two-level scheduling than the type you describe. For example, one level of scheduling could be per-user and the other could be per-process, aiming for giving a user with 20 processes the same amount of CPU time as a user with 1 process. With a single-level scheduler, each process might get 1/...
Given a [labelled transition system][1] $(S,\Lambda,\to)$, where $S$ is a set of states, $\Lambda$ is a set of labels, and $\to\subseteq S\times\Lambda\times S$ is a ternary relation. As usual, write $p \stackrel\alpha\rightarrow q$ for $(p,\alpha,q)\in\to$. The labelled transition $p\stackrel\alpha\to q$ denotes that ...
When are two simulations not a bisimulation?
Given a [labelled transition system][1] $(S,\Lambda,\to)$, where $S$ is a set of states, $\Lambda$ is a set of labels, and $\to\subseteq S\times\Lambda\times S$ is a ternary relation. As usual, write $p \stackrel\alpha\rightarrow q$ for $(p,\alpha,q)\in\to$. The labelled transition $p\stackrel\alpha\to q$ denotes that ...
Gilles' answer is very good and formal, and indeed, if $LTS_1$ is simulated by $LTS_2$ with a relation $R$, and $LTS_2$ is simulated by $LTS_1$ with the inverse of $R$, then $R$ is a bisimulation. However, if the two relations are not the inverse of one another, then you might not be able to build a bisimulation. F...
Because a CCS process is worth a thousand pixels – and it is easy to see the underlying LTS – here are two processes that simulates each other but are not bisimilar: $$P = ab + a$$ $$Q = ab$$ $\mathcal{R_1}=\{(ab+a, ab), (b, b), (0,b), (0, 0)\}$ is a simulation. $\mathcal{R_2}=\{(ab, ab+a), (b, b), (0,0)\}$...
|programming-languages|
As far as I know, the main models of computability are λ-calculus, Turing machines and [recursive functions][1]. I am not aware of the situation regarding complexity in recursive functions, they may or may not be useless for complexity. It may be seen as a fortunate coincidence that Turing machines, which are not so...
Consider unlabeled, rooted binary trees. We can *compress* such trees: whenever there are pointers to subtrees $T$ and $T'$ with $T = T'$ (interpreting $=$ as structural equality), we store (w.l.o.g.) $T$ and replace all pointers to $T'$ with pointers to $T$. See [uli's answer](http://cs.stackexchange.com/a/177/98) for...
This is a very general trick, which can be used for other purposes than hashing. Below I give an implementation (in pseudo-code). Let three uninitialized vectors $A$, $P$ and $V$ of size $n$ each. We will use these to do the operations requested by our data structure. We also maintain a variable $pos$. The operation...
> Why are there no mainstream, general-purpose visual languages for developers? What are the advantages and disadvantages of visual programming? Visual languages tend to broken it three broad categories: 1. Tools non-programmers to perform basic automation tasks. Think Automator on the Mac. 2. Learning enviro...
Here is the abstract from some (very) fresh research on the subject. It gives an answer to this question for some restricted form of β-reduction. Basically, complexity in the standard cost model is similar to counting β-reduction steps *when restricted to head reduction* (which includes call-by-name and call-by-value s...
This might border on computational cognitive science, but I am curious as to how the process followed by common pathfinding algorithms (such as A*) compares to the process humans use in different pathfinding situations (given the same information). Are these processes similar?
How Do Common Pathfinding Algorithms Compare To Human Process
|algorithms|
|algorithms|graphs|artificial-intelligence|
null
Humans tend to choose not strictly optimal, but close to shortest solutions. So you'll need to look at fuzzy algorithms, not at A*. The closest algorithm to human thinking I've know is a *Contaction hierarchies* on par with a *Reach* pruning algorithm. When I need to find a path between A and B, I do a quick overvie...
Say I have a string $a$ and some CFG, $G$ such that $x a y \in L(G)$ where $x,y$ are possibly empty. Given the CFG, I'd like to determine a set of characters $C$ such that $xaby \in L(G)$ where $b \in C$. For my application, the string $a$ is not much longer than the right hand side of the productions in $G$....
Given a string and a CFG, what characters can follow the string (in the language of the CFG)?
|compilers|formal-grammars|context-free|
This might border on computational cognitive science, but I am curious as to how the process followed by common pathfinding algorithms (such as [A*](http://en.wikipedia.org/wiki/A_star_search_algorithm)) compares to the process humans use in different pathfinding situations (given the same information). Are these proce...
Humans tend to choose not strictly optimal, but close to shortest solutions. So you'll need to look at fuzzy algorithms, not at A*. The closest algorithm to human thinking I've know is a *Contaction hierarchies* on par with a *Reach* pruning algorithm. When I need to find a path between A and B on the map, I do a qu...
Say I have a string $a \in \Sigma^+$ and some CFG $G$ such that $x a y \in \mathcal{L}(G)$ where $x,y\in \Sigma^*$. Given the CFG, I'd like to determine a set of characters $C = \{ b \mid xaby \in \mathcal{L}(G)\}$. For my application, the string $a$ is not much longer than the right hand side of the production...
Humans tend to choose not strictly optimal, but close to shortest solutions. So you'll need to look at fuzzy (approximate) algorithms, not at A*. The closest algorithm to human thinking I've aware of is a *Contaction hierarchies* on par with a *Reach* pruning algorithm. When I need to find a path between A and B on ...
This is certainly possible, but in my opinion my initial solution isn't very clean (I might think of a better one later): Let $d$ be the first letter of $a$. For every occurrence of $d$ in a right-hand side of a production $A \rightarrow \alpha d \beta$, create a new grammar that only differs from your first one in ...
The world is filled with things that have many different variations: word processors, cars, home designs, beverages, candy, pens, shovels, etc. The reasons why we have so many can be bolded down to a few principles: * Someone thinks they can improve on existing products * A different design is necessitated by local...
{"Voters":[{"Id":92,"DisplayName":"Alex ten Brink"}]}
tldr: There is no silver bullet language. I hope they won't abuse me, but here is a pic from one of the Stanford presentations. ![enter image description here][1] When you decide to pick a language, you can pick **only 2 of that 3 features**. Actually there is a huge list of requirements (some of them you ...
I have an assignment where I need to make use a binary search tree and alter it to self order itself such that items that are accessed the most (have a higher priority) are at the top of the tree, the root being the most accessed node. The professor gave me the BST and node struct to work with, but trying to get my ...
Creating a Self Ordering Binary Tree using AVL logic
|algorithms|binary-trees|
Even if there's a simulation in each direction, the simulations back and forth may not relate the same sets of states. Sometimes you have a simulation $R_1$ in one direction, and a simulation $R_2$ in the other direction, and two states $p_1$ and $q$ which are related by $R_1$ but not by $R_2$ nor by any other simulati...
tldr: There is no silver bullet language. I hope they won't abuse me, but here is a pic from one of the Stanford presentations. ![enter image description here][1] When you decide to pick a language, you can pick **only 2 of that 3 features**. And that's why people sad and wants to invent a superlanguage th...
>In particular, is there any reason I should know a functional language as a computer programmer ? Yes. Because haskell changed the way I think. It might change the way you think too. **Story:** I used to think that I can learn **any** programming language in a day. One day I started Haskell. I finished everyth...
Say I have a string $a \in \Sigma^+$ and some CFG $G$ such that $x a y \in \mathcal{L}(G)$ where $x,y\in \Sigma^*$. Given the CFG, I'd like to determine a set of characters $C = \{ b \mid xaby \in \mathcal{S}(G)\}$, where $\mathcal{S}(G)$ are the sentential forms of $G$. In this case, $x,a,y,b$ are non-terminals....
Even if there's a simulation in each direction, the simulations back and forth may not relate the same sets of states. Sometimes you have a simulation $R_1$ in one direction, and a simulation $R_2$ in the other direction, and two states $p_1$ and $q$ which are related by $R_1$ but not by $R_2$ nor by any other simulati...
I'll describe an algorithm that works. It's running time shouldn't be too bad. You can precompute quite a bit of this as well. I'll assume that $a$ does not contain nonterminals (though it's probably easy to adapt to that case) and that you don't know $x$, $y$ or the derivation of $a$. I'll also assume your grammar ...
{"Voters":[{"Id":92,"DisplayName":"Alex ten Brink"}]}
While discussing some intro level topics today, including the use of genetic algorithms; I was told that research has really slowed in this field. The reason given was that most people are focusing on machine learning and data mining. Is this accurate, and if so why is there this trend towards the other two versus gene...
Why has research on genetic algorithms slowed?
|algorithms|machine-learning|data-mining|
|machine-learning|data-mining|
Machine learning unveils a large portion of mathematical apparatus to be developed and applied. Genetics algorithms mostly done by heuristics.
There have been numerous visual programming languages, as the following two bibliographies will show: [vlib.org][1] and [oregonstate.edu][2]. IMHO they have failed to gain traction, because whilst they are good for toy examples, they fail to manage the multiple levels of abstraction, representation and granularity t...
To some extent, machine learning is becoming more mathematical and with algorithms able to be 'proven' to work. In some ways, GAs are very "wth happened in there" and you can't perfectly answer the question "so what did your program do?" (well in some people's eyes, anyway). I personally advocate combining neural n...
|complexity-theory|efficiency|
Well, machine learning in the sense of statistical pattern recognition and data mining are definitely hotter areas, but I wouldn't say research in evolutionary algorithms has particularly slowed. The two areas aren't generally applied to the same types of problems. It's not immediately clear how a data driven approach ...
There hardly could be a programmer who hasn't at some point in time become frustrated by the constraints of the language they were using and decided to scratch his itch. Thus a new language - or dialect of an existing one - is born. Abadi and Cardelli in "A Theory of Objects" develop a whole family of programming l...
I'll describe an algorithm that works. It's running time shouldn't be too bad. You can precompute quite a bit of this as well. I'll assume that $a$ does not contain nonterminals (though it's probably easy to adapt to that case) and that you don't know $x$, $y$ or the derivation of $a$. I'll also assume your grammar ...
A critical part of the story, as I see it, is missing from the other answers so far: Genetic algorithms are mostly useful for brute force search problems. In many contexts, simpler optimization strategies or inference models (what you would broadly call machine learning) can perform very well, and do so far more ...
If only we could *send packets back in time* ![enter image description here][1] $$B = T_f + \frac{T_b - T_f}{2} - \frac{C_1 + C_2}{2}$$ Assumptions: $(B+C_2) - T_b = T_f - (B+C_1)$ $T_f - (B + C_2) = (B + C_1) - T_b$ [1]: https://i.stack.imgur.com/I8Xs6.png
What are some good online resources that will help me better understand BigO notation, running time & invariants? I'm looking for lectures, interactive examples if possible.
BigO, Running Time, Invariants - Learning Resources
|runtime-analysis|