this is the general task scheduling problem apply greedy algorithms
On Sat, Dec 4, 2010 at 10:13 AM, Prims topcode...@gmail.com wrote:
You are given 'n' appointments. Each appointment contains startime and
endtime. You have to retun all conflicting appointments efficiently
starttime and
find out all the elements in a sorted integer array whose value is
equal to index of the array. O(logn) solution is expected.
Regards
Shashank
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
sort the jobs according to their starting time and check wheather a job
starting time is less than its previous job ending time
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
an array contain positive and negative element, find subarray whose
sum =0;
Regrads
Shashank
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send
Given the size of the input array,
construct array1 = {0, 1, 0, 1} till n elements
traverse through input array checking sum of 1's n 0's.
at the end if both sums are equal return array1 else return input array.
On Sat, Dec 4, 2010 at 12:06 AM, siva viknesh sivavikne...@gmail.comwrote:
My bad, did not see the in-place memory requirement
On Sat, Dec 4, 2010 at 8:49 PM, coolfrog$
dixit.coolfrog.div...@gmail.comwrote:
@shreyas VA
you are using O(n) extra space...
On Sat, Dec 4, 2010 at 8:46 PM, Shreyas VA v.a.shre...@gmail.com wrote:
Given the size of the input array,
We are given with two arrays A and B..each of size
N...elements of array contains either 1 or 0...
we have to find such an interval (p,q)(inclusive) such that the sum of
all
the elements of A (between this interval) and sum of all elements of
B
(between this interval ) is equal...
i.e.
#includestdio.h
void main()
{
int a[]={0,1,1,1,1,1,0,0,0,0,0,1},i=0;
static int o=0,e=0;//e for no. of 1's in array and o means no. of 0 in array
int l=sizeof(a)/4;
while(il)
{
if(a[i]==0)
{o++;i++;}
else
{e++,i++;}
}
if(eo) //if n0. of 1's greater than no. of 0's then e=o
e=o;
Hello,
2010/12/4 siva viknesh sivavikne...@gmail.com:
Modified 2 color sort problem i.e. you are given an array of integers
containing only 0s and 1s.You have to place all the 0s in even
position and 1s in odd position. And if suppose, no. of 0s exceed no.
of 1s or vice versa then keep them
Given set of n points (Xi, Yi), write a function to find k nearest points
from origin.
--
thanks
--mac
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this
2010/12/5 juver++ avpostni...@gmail.com:
Wrong.
Counterexample: 1 2 2 2 2 6
suppose you mean 1 3 3 3 3 6?
1) divide-conquer
2) search binary, in each sub array [s, t],
mid = (s+t)/2
if t array[mid]:
// no need to check the part after mid, all will fail
else if s array[mid]:
// no need
If you expect a lot of conflicting appointments:
Sort the appointments into ascending order by starttime.
Establish an empty min heap of {starttime,endtime} ordered by endtime.
Process the given appointments one by one:
While the heap is not empty and the endtime of the root does not
exceed
This is good. Another way is to build an interval tree and then query
it for every appointment's start time.
On Dec 4, 2:56 pm, Dave dave_and_da...@juno.com wrote:
If you expect a lot of conflicting appointments:
Sort the appointments into ascending order by starttime.
Establish an empty min
Use sweep line approach.
Store start and finish points of the intervals and deal with is as
events -
starting point introduces new interval (place it into a set or an
appropriate DS, call it active set),
second point - removes previously inserted interval from the active
set.
Sort events in
How do i convert a binary matrix(containing only 0s and 1s) to a
complete zero matrix? Only operations allowed are u can toggle a whole
row or a whole column. The conversion has to be done in minimum number
of steps (a step is defined as toggling a whole row or whole column
--
You received this
will O(n) work or u wish something lesser dependent on k or log(n) ?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to
16 matches
Mail list logo