Problem Detail: I’m looking for a $Theta$ approximation of $$T(n) = T(n-1) + cn^{2}$$ This is what I have so far: $$ begin{align*} T(n-1)& = T(n-2) + c(n-1)^2 T(n) &= T(n-2) + c(n-1) + cn^2[1ex] T(n-2) &= T(n-3) + c(n-2)^2 T(n) Read More …
Category: Uncategorized
Solving the recurrence T(n) = 3T(n-2) with iterative method
Problem Detail: It’s been a while since I had to solve a recurrence and I wanted to make sure I understood the iterative method of solving these problems. Given: $$T(n) = 3T(n-2)$$ My first step was to iteratively substitute terms to Read More …
Algorithm to find the mode in a unimodal array
Problem Detail: I am given the following problem in an Algorithms class: Assume that you are given an array A[1 . . . n] of distinct numbers. You are told that the sequence of numbers in the array is unimodal, in Read More …
Why is the k-bounded spanning tree problem NP-complete?
Problem Detail: The $k$-bounded spanning tree problem is where you have an undirected graph $G(V,E)$ and you have to decide whether or not it has a spanning tree such that each vertex has a degree of at most $k$. I realize Read More …
Least number of comparisons needed to sort (order) 5 elements
Problem Detail: Find the least number of comparisons needed to sort (order) five elements and devise an algorithm that sorts these elements using this number of comparisons. Solution: There are 5! = 120 possible outcomes. Therefore a binary tree for the Read More …
What is an intuitive way to explain and understand De Morgan’s Law?
Problem Detail: De Morgan’s Law is often introduced in an introductory mathematics for computer science course, and I often see it as a way to turn statements from AND to OR by negating terms. Is there a more intuitive explanation for Read More …
How to proof that a language is not recursively enumerable
Problem Detail: How does one prove that some arbitrary language $L$ is not recursively enumerable. I know I can proof that language $L$ is recursively enumerable by constructing a Turing machine $M$ that accepts all words in the language (and the Read More …
What is an Efficient Algorithm?
Problem Detail: From the point of view of asymptotic behavior, what is considered an “efficient” algorithm? What is the standard / reason for drawing the line at that point? Personally, I would think that anything which is what I might naively Read More …
Proof of the undecidability of the Halting Problem
Problem Detail: I’m having trouble understanding the proof of the undecidability of the Halting Problem. If $H(a,b)$ returns whether or not the program $a$ halts on input $b$, why do we have to pass the code of $P$ for both $a$ Read More …
A* to find the longest path in a directed cyclic graph
Problem Detail: I have written an A* algorithm to find the shortest path through a directed cyclic graph. I am trying to modify it to find the longest path through the same graph. My attempt was to write it so that Read More …