Problem Detail: Which of the following modes of data transfer is the fastest? a. DMA b. Interrupt-based c. Polling d. All are equally fast I do not have the answer, so I cannot check, that’s why I am posting here. I Read More …
Author: ignougroup
Most efficient algorithm to print 1-100 using a given random number generator
Problem Detail: We are given a random number generator RandNum50 which generates a random integer uniformly in the range 1–50. We may use only this random number generator to generate and print all integers from 1 to 100 in a random Read More …
Which of the following regular expressions generate(s) no string with two consecutive 1’s?
Problem Detail: This is a GRE practice question. Which of the following regular expressions generate(s) no string with two consecutive 1’s? (Note that ε denotes the empty string.) I. (1 + ε)(01 + 0)* II. (01+10)* III. (0+1)*(0+ε) (A) I only Read More …
How do I compute the luminance of a pixel?
Problem Detail: I have a color (say $R=100, G=150, B=130$). How do I compute its intensity? Do I just sum up all three components? Or are the colors not evenly weighted? Asked By : David Faux Answered By : Pål GD The colors 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 …
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 …
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 …
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 …
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 …
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 …