Problem Detail: Calculate the exponential averaging with $T_1 = 10$, $alpha=0.5$ and the algorithm is SJF with previous runs as $8,7,4,16$. 9 8 7.5 None I am getting 4. None as the answer. But it is given that 3. 7.5 Read More …
Blog
Why are reversible gates not used?
Problem Detail: I was reading the book “The singularity is near” written by Kurzweil and he mentioned the reversible gates like for example the Fredkin gate. The advantage using such gates is that we could get rid of the thermal waste Read More …
Why there are no approximation algorithms for SAT and other decision problems?
Problem Detail: I have an NP-complete decision problem. Given an instance of the problem, I would like to design an algorithm that outputs YES, if the problem is feasible, and, NO, otherwise. (Of course, if the algorithm is not optimal, it Read More …
How to develop an $O(N)$ algorithm solve the 2-sum problem?
Problem Detail: Given an sorted array of integers, I want to find the number of pairs that sum to $0$. For example, given ${-3,-2,0,2,3,4}$, the number of pairs sum to zero is $2$. Let $N$ be the number of elements in Read More …
Is there any way to distinguish between LL(k) and LR(k) grammar?
Problem Detail: I am recently studying about Compilers designing. I came to know about two types of grammar one is LL grammar and other is LR grammar. We also know the facts that every LL grammar is LR that is LL Read More …
Ternary Search Recurrence Relation
Problem Detail: I am trying to work out the recurrence relation for Ternary Search. This is what I came up with: C(n) = C(n/3) + 2 However, I talked to my professor and he said it’s not correct. He says that Read More …
Example using Penetrance & Branching Factor in State-space Heuristic Search
Problem Detail: I need an example for how to calculate penetrance and branching factor of the search tree in in state-space heuristic search. The definitions are as following. Penetrance $P$ is defined by $qquad displaystyle P = frac{L}{T}$ and branching factor Read More …
Detecting a subsequence that’s an arithmetic progression, in a sorted sequence
Problem Detail: I have following problem: I have a sorted sequence of $N$ integers (assume they are monotonically increasing). I want to check whether there is any subsequence of length $ge N/4$, such that consecutive elements of the subsequence all differ Read More …
Why does bubble sort do $Theta(n^2)$ comparisons on an $n$ element list?
Problem Detail: I have a quick question on the bubble sort algorithm. Why does it perform $Theta(n^2)$ comparisons on an $n$ element list? I looked at the Wikipedia page and it does not seem to tell me. I know that because Read More …
AVL trees are not weight-balanced?
Problem Detail: In a previous question there was a definition of weight balanced trees and a question regarding red-black trees. This question is to ask the same question, but for AVL trees. The question is, given the definition of $mu$-balanced trees Read More …