[algogeeks] Find the maximum boxes which can fit each other?

2012-03-24 Thread Ratan
You are given a lot of cuboid boxes with different length, breadth and height. You need to find the maximum subset which can fit into each other. For example: If Box A has LBH as 7 8 9 If Box B has LBH as 5 6 8 If Box C has LBH as 5 8 7 If Box D has LBH as 4 4 4 then answer is A,B,D A box can fit

Re: [algogeeks] Find the maximum boxes which can fit each other?

2012-03-24 Thread atul anand
it is modified longest increasing subsequence problem.. On 24 Mar 2012 12:26, Ratan success.rata...@gmail.com wrote: You are given a lot of cuboid boxes with different length, breadth and height. You need to find the maximum subset which can fit into each other. For example: If Box A has LBH

Re: [algogeeks] Find the maximum boxes which can fit each other?

2012-03-24 Thread Ratan
@atul can u plzz describe in detail the algo of modified subsequence prob used here i m nt able to get it ... though tried a lot On Sat, Mar 24, 2012 at 1:05 PM, atul anand atul.87fri...@gmail.com wrote: it is modified longest increasing subsequence problem.. On 24 Mar 2012 12:26, Ratan

Re: [algogeeks] Find the maximum boxes which can fit each other?

2012-03-24 Thread atul anand
ok you need to put box into a box... so first requirnment willl be to sort on the basis of area of box. after this bcoz you are adding one box into another...the box you are putting inside big box ..shud have base length less than a big box or it wont fit in...even if its area is smaller.. now we

[algogeeks] Re: Amazon Onsite

2012-03-24 Thread Navin Kumar
If we need to find the first petrol pump from where we can reach safely to the whole circle.Then --- Algo :- remaining[i] = P[i] - D[i] 1- scan the array from left to right,while traversing keep track of two variables. a- total no.of points where remaining[i] 0 b- a pointer to

Re: [algogeeks] Re: MS QUESTION_LINKED LIST

2012-03-24 Thread Sambhavna Singh
@atul: we always need to point at the next larger node..so that is ruled out. On Sat, Mar 24, 2012 at 10:14 AM, Atul Singh atulsingh7...@gmail.comwrote: I couldn't understand the meaning of *return the pointer to smallest* Is it that that the pointer of largest node will point to smallest

Re: [algogeeks] Re: MS QUESTION_LINKED LIST

2012-03-24 Thread Sambhavna Singh
can anyone explain vividly how we can use merge sort here. thank you. On Sat, Mar 24, 2012 at 1:54 PM, Sambhavna Singh coolsambha...@gmail.comwrote: @atul: we always need to point at the next larger node..so that is ruled out. On Sat, Mar 24, 2012 at 10:14 AM, Atul Singh

Re: [algogeeks] Re: Run Length Decoding... inplace

2012-03-24 Thread raghavan M
For sake of in-place Instead of doing it from the Start we can do it from the end in which case, the data precision wont be lost. Eg: a1b2c3d4 start with d4 a1b2c3 now in next loop a1b2ccc- here we have to do a)reallocation and b)copy the last 3 from next  one it is more swaps :D 

Re: [algogeeks] Re: MS QUESTION_LINKED LIST

2012-03-24 Thread Abhishek Sharma
@Atul: after u sort the list the head pointer will automatically point to the smallest element so u actually return the head of the list. @Sambhavna: here is the Pseudoccode (More or less similar to, doing merge sort for arrays): Mersgesort(node ** list){ if( head==NULL or head- next ==

Re: [algogeeks] Re: Run Length Decoding... inplace

2012-03-24 Thread atul anand
@raghavan: wont work...take input as a1b1c4...it willl fail. read prev comment ... On 24 Mar 2012 14:23, raghavan M peacelover1987...@yahoo.co.in wrote: For sake of in-place Instead of doing it from the Start we can do it from the end in which case, the data precision wont be lost. Eg:

Re: [algogeeks] Find the maximum boxes which can fit each other?

2012-03-24 Thread sourabh datta
@atul.. i think what u meant is longest decreasing sequence.. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to

Re: [algogeeks] Find the maximum boxes which can fit each other?

2012-03-24 Thread atul anand
doesnt matterits depend on how u want to see output On 24 Mar 2012 16:33, sourabh datta sourabhd2...@gmail.com wrote: @atul.. i think what u meant is longest decreasing sequence.. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To

[algogeeks] pascal triangle

2012-03-24 Thread Gaurav Popli
calculate the number of values in the triangle that are different from 1 and less than or equal to K. k=2 1 1 1

[algogeeks] Re: Find the maximum boxes which can fit each other?

2012-03-24 Thread Don
Build a graph in which each box is a vertex and there is an edge from A to B if B can fit inside A. Then use the longest path algorithm to find the solution. Don On Mar 24, 1:55 am, Ratan success.rata...@gmail.com wrote: You are given a lot of cuboid boxes with different length, breadth and

[algogeeks] [ DirectI ] Interview question

2012-03-24 Thread Navin Kumar
Given an array of integers, for each index i, you have to swap the value at i with the first value smaller than A[ i ] that comes after index i. An efficient solution expected. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this

[algogeeks] Re: Find the maximum boxes which can fit each other?

2012-03-24 Thread Don
There is more to it than a longest increasing subsequence because the greater than relationship is not transitive. Don On Mar 24, 3:05 am, atul anand atul.87fri...@gmail.com wrote: ok you need to put box into a box... so first requirnment willl be to sort on the basis of area of box. after

Re: [algogeeks] [ DirectI ] Interview question

2012-03-24 Thread karthikeyan muthu
if i'm not wrong .. we are to repeat this process till no more such pair is found.. rite?? this condition will come only if the given array gets sorted in ascending order .. so the solution is to sort the array O(nlogn).. On Sat, Mar 24, 2012 at 7:31 PM, Navin Kumar navin.nit...@gmail.com

Re: [algogeeks] [ DirectI ] Interview question

2012-03-24 Thread payal gupta
if the array considered is { 1 ,6 ,8 ,3 ,5, 4, 2} is this the way the problm o/p expected??? 1 6 8 3 5 4 2 1 3 8 6 5 4 2 1 3 6 8 5 4 2 1 3 6 5 8 4 2 1 3 6 5 4 8 2 1 3 6 5 4 2 8 correct if wrong. On Sat, Mar 24, 2012 at 10:53 PM, karthikeyan muthu keyankarthi1...@gmail.com wrote: if i'm

Re: [algogeeks] [ DirectI ] Interview question

2012-03-24 Thread saurabh singh
I think not necessary consider the case 3 1 4 1 2 2 4 Saurabh Singh B.Tech (Computer Science) MNNIT blog:geekinessthecoolway.blogspot.com On Sat, Mar 24, 2012 at 10:53 PM, karthikeyan muthu keyankarthi1...@gmail.com wrote: if i'm not wrong .. we are to repeat this process till no more such

Re: [algogeeks] MS QUESTION_LINKED LIST

2012-03-24 Thread atul anand
@all : i am getting this right , i guess given a linked list ...you need to point to next larger element. so if input linked list is 7 3 5 1 5 9 then nextLarger of each node will point as follows:- 3-5 1-5 5-9 7-9 9-NULL; i have no idea why the linked list is modified using merge sort...

Re: [algogeeks] MS QUESTION_LINKED LIST

2012-03-24 Thread atul anand
after push(s,next) move head also head=head-next; On Sun, Mar 25, 2012 at 12:10 AM, atul anand atul.87fri...@gmail.comwrote: @all : i am getting this right , i guess given a linked list ...you need to point to next larger element. so if input linked list is 7 3 5 1 5 9 then nextLarger of

Re: [algogeeks] Re: Run Length Decoding... inplace

2012-03-24 Thread atul anand
@ashish: i guess you are thinking too much , question say you have character 'a' to 'z' and some value after which will tell ,how many times you shuld print it. if we take 15 as 1 then this would require other means of encoding to interpret it correctly. On Sat, Mar 24, 2012 at 1:19 AM,

Re: [algogeeks] [ DirectI ] Interview question

2012-03-24 Thread shady
what is the output for this ? { 1 ,6 ,8 ,3 ,5, 4, 2} On Sat, Mar 24, 2012 at 7:31 PM, Navin Kumar navin.nit...@gmail.com wrote: Given an array of integers, for each index i, you have to swap the value at i with the first value smaller than A[ i ] that comes after index i. An efficient

Re: [algogeeks] [ DirectI ] Interview question

2012-03-24 Thread payal gupta
the o/p for the array { 1 ,6 ,8 ,3 ,5, 4, 2} is: 2 6 8 3 5 4 1 1 3 8 6 5 4 2 1 3 6 8 5 4 2 1 3 6 5 8 4 2 1 3 6 5 4 8 2 1 3 6 5 4 2 8 not necessarily the sorted array... On Sun, Mar 25, 2012 at 1:04 AM, shady sinv...@gmail.com wrote: what is the output for this ? { 1 ,6 ,8 ,3 ,5, 4, 2} On

Re: [algogeeks] [ DirectI ] Interview question

2012-03-24 Thread Amol Sharma
@saurabh - couldn't get what are you trying to say.. @payal - yes...the o/p need not to be sorted. Brute force will give O(n^2) solution. -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad http://gplus.to/amolsharma99

[algogeeks] Re: Interview question

2012-03-24 Thread Gene
This problem isn't carefully defined. If you have 3,4,2 then 2 is the first value smaller and of higher index than both 3 and 4. So which to swap with? On Mar 24, 10:01 am, Navin Kumar navin.nit...@gmail.com wrote: Given an array of integers, for each index i, you have to swap the value at i

Re: [algogeeks] Re: Interview question

2012-03-24 Thread saurabh singh
@amol I was trying to put forward the point that the o/p need not be sorted.If you check the difference between time of my and payal's message it was a case of race condition. Saurabh Singh B.Tech (Computer Science) MNNIT blog:geekinessthecoolway.blogspot.com On Sun, Mar 25, 2012 at 6:54 AM,

Re: [algogeeks] Re: Run Length Decoding... inplace

2012-03-24 Thread SAMM
In this question is it mandatory to use array here .Because the output and the space were the string is stored is required .. I was thinking of using LL approach .. Need four pointers to keep track of the positions . begin - store the beginning of the LL initially containing the pointer to he