Question Detail: Why Do Computers Use the Binary Number System (0,1)? Why don’t they use Ternary Number System (0,1,2) or any other number system instead? Asked By : Rai Ammad Khan Best Answer from StackOverflow Question Source : http://cs.stackexchange.com/questions/27656 Answered By : jmite Since Read More …
Category: Uncategorized
Adding elements to a sorted array
Question Detail: What would be the fastest way of doing this (from an algorithmic perspective, as well as a practical matter)? I was thinking something along the following lines. I could add to the end of an array and then use Read More …
To Find the median of an unsorted array
Question Detail: To fine the median of an unsorted array, we can make a min-heap in $O(nlog n)$ time for $n$ elements, and then we can extract one by one $n/2$ elements to get the median. But this approach would take Read More …
Quicksort Partitioning: Hoare vs. Lomuto
Question Detail: There are two quicksort partition methods mentioned in Cormen: Hoare-Partition(A, p, r) x = A[p] i = p – 1 j = r + 1 while true repeat j = j – 1 until A[j] <= x repeat i Read More …
How many edges must a graph with N vertices have in order to guarantee that it is connected?
Question Detail: Possible Duplicate: Every simple undirected graph with more than $(n-1)(n-2)/2$ edges is connected At lesson my teacher said that a graph with $n$ vertices to be certainly connected should have $ {frac{n(n-1)}{2}+1 space }$ edges showing that (the Read More …
What is the difference between user-level threads and kernel-level threads?
Question Detail: After reading several sources I’m still confused about user- and kernel-level threads. In particular: Threads can exist at both the user level and the kernel level What is the difference between the user level and kernel level? Asked By Read More …
What is the difference between storage media and storage devices
Question Detail: I am having confusion whether storage media and storage devices are the same terms. I found on this yahoo answers page that there is a subtle difference but very tricky to understand. I have googled a lot but cannot Read More …
How to verify number with Bob without Eve knowing?
Question Detail: You need to check that your friend, Bob, has your correct phone number, but you cannot ask him directly. You must write the question on a card which and give it to Eve who will take the card to Read More …
What is most efficient for GCD?
Question Detail: I know that Euclid’s algorithm is the best algorithm for get the GCD (great common divisor) for a list the positive integer numbers. But, in the practice, you can write two codes por evaluate the gcd (for my case, Read More …
Complexity of recursive Fibonacci algorithm
Question Detail: Using the following recursive Fibonacci algorithm: def fib(n): if n==0: return 0 elif n==1 return 1 return (fib(n-1)+fib(n-2)) If I input the number 5 to find fib(5), I know this will output 5 but how do I examine the Read More …