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 …
Category: Uncategorized
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 …
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 …
Exponential averaging for SJF CPU scheduling
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 …
Difference between memory access and write-back in RISC pipeline
Problem Detail: I’m a little confused about the difference of the memory access and the write-back stage in a RISC pipeline. We learned in class these following assumptions: arithmetic & logic: IF, OF, EX, WB load: IF, OF, EX, MA, WB Read More …
Is there an algorithm that provably exists although we don’t know what it is?
Problem Detail: In mathematics, there are many existence proofs that are non-constructive, so we know that a certain object exists although we don’t know how to find it. I am looking for similar results in computer science. In particular: is there Read More …
Why are functional languages Turing complete?
Problem Detail: Perhaps my limited understanding of the subject is incorrect, but this is what I understand so far: Functional programming is based off of Lambda Calculus, formulated by Alonzo Church. Imperative programming is based off of the Turing machine model, Read More …
How to construct the found path in bidirectional search
Problem Detail: I am trying to implement bidirectional search in a graph. I am using two breadth first searches from the start node and the goal node. The states that have been checked are stored in two hash tables (closed lists). 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 …