A queue data structure has functions enqueue(int x) ( inserts element
in right end), dequeue() ( deletes element from left end) functions.
These operations take O(1) time. Modify this queue data structure, so
that it supports findmin() which returns minimum element of stack in
O(1) time.
--
You
An interesting puzzle. Assume size of each bird to be negligibly
small. Please provide your answers with analysis.
Take a wire stretched between two posts, and have a large number of
birds land on it at random. Take a bucket of yellow paint, and for
each bird, paint the interval from it to its clo
e rightmost set bit.
>
> Now when we take xor of all values where 2nd bit is set(this could be done
> as (a[i] & 0010) , we get 6
> Taking xor of all values where 2nd bit is not set yields 4.
>
> Mukesh Gupta
> Delhi College of Engineering
>
>
>
> On Mon, Oct 4,
Largest Rectangle in a Matrix:
Given an n by n matrix with zeros and ones, find the largest sub-
matrix full of ones in linear time. I was told that a solution with
O(n) time complexity exists. If there are n^2 elements in a n X n
matrix how does a linear solution exist?
--
You received this m
I have an array. All numbers in the array repeat twice except two
numbers which repeat only once. All the numbers are placed randomly.
Goal is to find out efficiently the two numbers that have not
repeated with O(1) extra memory. Expecting linear solution.
--
You received this message because y
using DFS the loop would get detected more than once.
If we use DFS a loop would be detected 'n' times if there are 'n' nodes
in the loop.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To
Hello All.
How can I detect all loops in a directed graph?
I would like to detect the starting node of the loop as well as the
closing
edge of the loop.
Thanks in Advance.
Regards,
Mallikarjun.
--~--~-~--~~~---~--~~
You received this message because you are s