Problem Detail: I often work with lexer/parsers, 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 sensitive. This basically Read More …
Author: ignougroup
Complexity of algorithm inserting an element in a circular linked list at the front end
Problem Detail: In a circular linked list, if an elements needs to be inserted at front [just before the node pointed by head], can be done in O(1) (see the answer here) But in a book currently, I have, it is Read More …
Turing-unrecognizable language – what TM does?
Problem Detail: I have a problem giving “intuitive” explanation to turing-unrecognizable languages. We can prove that, say, ${overline{A_{TM}}}$ is not turing-recognizable, because that would make ${{A_{TM}}}$ decidable, but what would the $TM$ do if it doesn’t accept, reject of loop? Asked Read More …
Find the minimum amount of swaps to sort array
Problem Detail: When getting source array length, I want to generate the array of swaps that need to be performed in order to sort the source array. I want to make this array as small as possible. Swaps will be performed Read More …
Given a set of sets, find the smallest set(s) containing at least one element from each set
Problem Detail: Given a set $mathbf{S}$ of sets, I’d like to find a set $M$ such that every set $S$ in $mathbf{S}$ contains at least one element of $M$. I’d also like $M$ to contain as few elements as possible while Read More …
Solving the recurrency $T(n) = 2T(sqrt{n}) + O(1)$
Problem Detail: I need to solve the following recurrency: $T(n) = 2T(sqrt{n}) + O(1)$. It’s for a simple undergrad problem that a student asked me, but I really couldn’t solve it. Since it is for an undergrad question, it would be Read More …
What is the average height of a binary tree?
Problem Detail: Is there any formal definition about the average height of a binary tree? I have a tutorial question about finding the average height of a binary tree using the following two methods: The natural solution might be to take Read More …
Algorithm to find all 2-hop neighbors lists in a graph
Problem Detail: Given a graph $G = (V,E)$, where $|V| = n$. What is a fast algorithm for generating the collection of all 2-hop neighborhood lists of all nodes in $V$. Naively, you can do that in $O(n^3)$. With power of Read More …
Give CFG and PDA for the words that start and end with the same symbol
Problem Detail: I need to give a PDA and CFG for a language that contains all binary strings that start and end with the same symbol. I’ve created the CFG with no problem, but I’m stuck with the PDA and don’t Read More …
Can someone clarify this unification algorithm?
Problem Detail: I’ve been having trouble understanding a unification algorithm for first order logic, as I don’t know what a compound expression is. I googled it, but found nothing relevant. I also don’t know what a list means in this context. Read More …