Problem Detail: I have just completed the first chapter of the Introduction to the Theory of Computation by Michael Sipser which explains the basics of finite automata. He defines a regular language as anything that can be described by a finite Read More …
Blog
A median of an AVL. How to take advantage of the AVL?
Problem Detail: Here is the source of my question. Given a self-balancing tree (AVL), code a method that returns the median. (Median: the numerical value separating the higher half of a data sample from the lower half. Example: if the series Read More …
Does spanning tree make sense for DAG?
Problem Detail: Why cannot I find any information about spanning tree for DAG ? I must be wrong somewhere. Asked By : zell Answered By : Dai Why focusing on dags and not general directed graphs? I think you should have a look Read More …
What does the set {n | n is an integer and n = n + 1} represent?
Problem Detail: I am reading Michael Sipser’s book Introduction to the Theory of Computation, which mentions the set $$S = { n mid text{$n$ is an integer and $n = n + 1$}}.$$ This doesn’t make any sense to me. I Read More …
Partitions of a directed graph – common prey and common enemy partitions
Problem Detail: Let $D=(V,E)$ be a finite directed graph with no isolated nodes(from every node there is at least one edge entering and one exiting). For $v in V$ define the following sets: $$v^+= left{w in V|(v,w)in E right}, v^-= left{w Read More …
Number of possible search paths when searching in BST
Problem Detail: I have the following question, but don’t have answer for this. I would appreciate if my method is correct : Q. When searching for the key value 60 in a binary search tree, nodes containing the key values 10, Read More …
Halting problem reduction to Halting for all inputs
Problem Detail: I was going through my book of revision and I would like someone hints on this. The Halt for All Input problem (HAI) takes a machine and tell if this machine halts or not for any input We prove Read More …
How to prove the NP-completeness of the “Exact-3D-Matching“ problem by reducing the “3-Partition“ problem to it?
Problem Detail: Background: The Exact-3D-Matching problem is defined as follows (The definition is from Jeff’s lecture note: Lecture 29: NP-Hard Problems. You can also refer to 3-dimensional matching): Exact-3D-Matching: Given a set $S$ and a collection of three-element subsets of $S$, Read More …
Enumerate all non-isomorphic graphs of a certain size
Problem Detail: I’d like to enumerate all undirected graphs of size $n$, but I only need one instance of each isomorphism class. In other words, I want to enumerate all non-isomorphic (undirected) graphs on $n$ vertices. How can I do this? Read More …
How to memorize Master Theorem?
Problem Detail: I know the maths behind, I know if I do the algebra I can get the result of the 3 cases. I also have an intuition of the 3 cases: Quora However, I just cannot memorize this “simple” 3 Read More …