Re: [algogeeks] Interview Question

2013-04-19 Thread kartik n
Hi Nishant i did not understand the code can u please describe a bit

Thanks


On Fri, Apr 19, 2013 at 10:48 AM, rahul sharma wrote:

> search the previous posts before posting
>
> search for
> [algogeeks] Amazon Interview Question
> you will get this
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to algogeeks+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




RE: [algogeeks]

2013-04-19 Thread umesh kewat
  As my understanding take the input of traffic in time interval then some
all the job and divide them equally to processing unit(assumption
processing unit processing one job in one time units) so interval to time
is varies on the base how much time is taken by the process to assigned
work. One more assumption one work units is not further dividable.

Sent from my Windows Phone
 --
From: w.s miller 
Sent: 15-04-2013 22:54
To: algogeeks@googlegroups.com
Subject: [algogeeks]

suppose we have n processing units.we have an incoming traffic which is to
be
distributed among them.but we have to take in mind that load is to be
equally distibuted and if one of the processing units goes down ,then we
have to distribute the traffic to rest of the processing units.Also when
the processing unit which is down comes up,then the traffic distribution is
to be handled 

please suggest any suitable data structure or algorithm

thanks

-- 
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to algogeeks+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[algogeeks] Re: Clustering set problem

2013-04-19 Thread Piyush Grover
correcting my last statement

"So basically the problem needs to be optimized on two aspects, minimizing
costs and maximizing the total weight of executed jobs.
so *Maximize ( 1 + (Total Weight of executed jobs in j-th iter/ Total Cost
incurred in j-th iter) )"*


On Sat, Apr 20, 2013 at 3:49 AM, Piyush Grover wrote:

> I have a practical problem, need an optimal solution for this
>
> *What is given?*
> Given *N* sets, each containing some jobs to be executed, such that no
> two sets are subsets of each other and number of jobs in *i-th* set is *ni
> << N*.
> The jobs can have values between *1...k where k << N*. Priority of each
> job is in the order of their value. i.e *priority(1) > priority(2).>
> priority(k) *so as the weights
> *w1 > w2 > .wi...> wk*
>
> *What are the constraints?*
> -> Every job in every set is executed independent of others.
> -> No job can be executed independent of its set i.e if a job needs to be
> executed, any
> set containing the job will be executed
> -> The cost of execution of *i-th* set is *ni*
> -> The probability of failing each job during execution is equal and
> unknown.
>
> *What is needed?*
> The jobs need to be executed but can be done in multiple iterations.
> So* *return the number of sets *mj <=M << N* (and set itself) to be added
> for the execution in the j*-th iteration.
> *Each iteration adds the additional cost to each set to be executed in a
> way such that
> *cost of execution of i-th set in the j-th iteration = ni + (j-1)*max(
> weights of failed jobs in i-th set)*
> If a set is executed (with/without failed jobs) that can not be used in
> further iterations
>
>
> So basically the problem needs to be optimized on two aspects, minimizing
> costs and maximizing the number of jobs to be executed.
>
>
> Regards
> Piyush
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[algogeeks] Clustering set problem

2013-04-19 Thread Piyush Grover
I have a practical problem, need an optimal solution for this

*What is given?*
Given *N* sets, each containing some jobs to be executed, such that no two
sets are subsets of each other and number of jobs in *i-th* set is *ni << N*
.
The jobs can have values between *1...k where k << N*. Priority of each job
is in the order of their value. i.e *priority(1) > priority(2).>
priority(k) *so as the weights
*w1 > w2 > .wi...> wk*

*What are the constraints?*
-> Every job in every set is executed independent of others.
-> No job can be executed independent of its set i.e if a job needs to be
executed, any
set containing the job will be executed
-> The cost of execution of *i-th* set is *ni*
-> The probability of failing each job during execution is equal and
unknown.

*What is needed?*
The jobs need to be executed but can be done in multiple iterations.
So* *return the number of sets *mj <=M << N* (and set itself) to be added
for the execution in the j*-th iteration.
*Each iteration adds the additional cost to each set to be executed in a
way such that
*cost of execution of i-th set in the j-th iteration = ni + (j-1)*max(
weights of failed jobs in i-th set)*
If a set is executed (with/without failed jobs) that can not be used in
further iterations


So basically the problem needs to be optimized on two aspects, minimizing
costs and maximizing the number of jobs to be executed.


Regards
Piyush

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [algogeeks] Interview Question

2013-04-19 Thread rahul sharma
search the previous posts before posting

search for
[algogeeks] Amazon Interview Question
you will get this

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [algogeeks] Interview Question

2013-04-19 Thread Nishant Pandey
int main() {

int a[] = {1,2,2,3,3,3,4,4};

int size = sizeof(a)/sizeof(a[0]);
int xorr=0;
for(int i=0;iwrote:

> In an array, some numbers occur only once, some numbers occur twice, only
> one number occur thrice. Find the number occuring thrice ? Space complexity
> O(1) Time Complexity O(n). We should not use Hash Maps.
>
> Please someone help..
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to algogeeks+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[algogeeks] Interview Question

2013-04-19 Thread Krishnan
In an array, some numbers occur only once, some numbers occur twice, only
one number occur thrice. Find the number occuring thrice ? Space complexity
O(1) Time Complexity O(n). We should not use Hash Maps.

Please someone help..

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[algogeeks]

2013-04-19 Thread w.s miller
given a 1D array.The task is to convert it in to a 2D array and values
should be filled spirally while filling from 1D array

the size of 1D array is multiple of a constant say n.
the number of rows and columns of 2D array will be given.

say number of rows =R
say number of columns  = C

k*n <= R*C. where k*n =number of elements in 1D array
if (R*C > number of elements in 1D array)
then rest of the values will be zeros.
e.g.

n=5; k=3
R= 6
C= 3

input 1D array=[1,0,0,0,1,0,0,0,0,0,1,1,1,1,0]

output 2D array

1 0 0 0 1 0
1 0 0 0 0 0
1 1 1 0 0 0

here as 5*3<6*3 so ..18 -15 = 3

i.e 3 remaining values are filled as zeros.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.