Re: [algogeeks] Question

2011-07-25 Thread SkRiPt KiDdIe
How much time does he reach home is a bad question to ask. Say i walk 90-x minutes before i meet my driver.If i had walked x more minutes the driver would have reached my office. I save the driver's x minutes which he takes for onwards journey from the point of meet.Eventually i save 20 min (onwa

Re: [algogeeks] Question

2011-07-25 Thread SkRiPt KiDdIe
How much time does he reach home is a bad question to ask. Say i walk 90-x minutes before i meet my driver.If i had walked x more minutes the driver would have reached my office. I save the driver's x minutes which he takes for onwards journey from the point of meet.Eventually i save 20 min (onwa

Re: [algogeeks] Question

2011-07-25 Thread varun pahwa
is D the correct option. On Mon, Jul 25, 2011 at 11:18 PM, Arpit Sood wrote: > @karan ya that's correct > my first answer was insufficient information too, but since there was no > such option had to think more :) > cool question :D > > > On Mon, Jul 25, 2011 at 11:12 PM, bagaria.ka...@gmail.com

Re: [algogeeks] Question

2011-07-25 Thread Arpit Sood
@karan ya that's correct my first answer was insufficient information too, but since there was no such option had to think more :) cool question :D On Mon, Jul 25, 2011 at 11:12 PM, bagaria.ka...@gmail.com < bagaria.ka...@gmail.com> wrote: > the man is taking 20 mins less then what it actually re

Re: [algogeeks] Question

2011-07-25 Thread bagaria.ka...@gmail.com
the man is taking 20 mins less then what it actually requires i.e. the car needs to travel 20 mins less then what it actually used to do , now the car had to spend that 20 mins in going and coming back from office i.e. 10 mins each while going to office and the same for coming to office hence the a

Re: [algogeeks] Question

2011-07-25 Thread Rohit jalan
Can you explain this ?? On Mon, Jul 25, 2011 at 10:29 PM, shady wrote: > easy guys... > > @sagar nice question, if there had been an option for incomplete info, i > would have gone with that... but it made me think thoroughly :) 80 min. is > answer > > @aashish we are forming new group for apti

Re: [algogeeks] Question

2011-07-25 Thread bagaria.ka...@gmail.com
though we can find the relative speed between the car and man i.e. car speed is 8 times that of man's speed On Mon, Jul 25, 2011 at 10:44 PM, ankit sambyal wrote: > Incomplete Information > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group

Re: [algogeeks] Question

2011-07-25 Thread ankit sambyal
Incomplete Information -- 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 algogeeks+unsubscr...@googlegroups.com. For more options, v

Re: [algogeeks] Question

2011-07-25 Thread rajeev bharshetty
Insufficient Data ... On Mon, Jul 25, 2011 at 10:29 PM, shady wrote: > easy guys... > > @sagar nice question, if there had been an option for incomplete info, i > would have gone with that... but it made me think thoroughly :) 80 min. is > answer > > @aashish we are forming new group for apti k

Re: [algogeeks] Question

2011-07-25 Thread shady
easy guys... @sagar nice question, if there had been an option for incomplete info, i would have gone with that... but it made me think thoroughly :) 80 min. is answer @aashish we are forming new group for apti kind of questions... On Mon, Jul 25, 2011 at 10:23 PM, AASHISH SUMAN wrote: > > @sa

Re: [algogeeks] Question

2011-07-25 Thread AASHISH SUMAN
@sagar :: this group is for programming concepts not for apti.. if u wana to post some apti or reasoning question post here.. http://www.facebook.com/groups/150933398312351?ap=1 -- *WITH BEST REGARDS : AASHISH SUMAN MCA FINAL YEAR * *NIT DURGAPUR* *+91-9547969906* -- You received this m

[algogeeks] Question

2011-07-25 Thread sagar pareek
A man leaves office daily at 7pm.a driver with car comes from his home to pick him from office and bring back home. One day he gets free at 5.30 and instead of waiting for driver he starts walking towards home. In the wayhe meets the car and returns home on car. He reaches home 20 minutes earlier t

Re: [algogeeks] Question on Combination

2011-06-22 Thread Piyush Sinha
sorry a lil bit modification in the above answer.. *int ref[] = {1,2,3};* *void printcombination(int n,int index,int i)* *{* *static int a[100];* *int j;* *if (n == 0)* * {* * for(j=0;j0)* * {* * f

Re: [algogeeks] Question on Combination

2011-06-22 Thread Piyush Sinha
pass one more argument to the function "*int index*" and instead of starting the loop from *i = 0 to N, *make it start from *i = index to N *and then call *printcombinations(a,sum-a[i],level+1,index+1); *I think it will work then... On Thu, Jun 23, 2011 at 10:48 AM, ross wrote: > Giv

[algogeeks] Question on Combination

2011-06-22 Thread ross
Given an array and a sum S output all combinations of elements that sum to S. eg: 1 2 3 sum = 3 1+1+1, 2+1 3 I came up with the foll algorithm, but it outputs 2+1 and 1+2 again. (does not handle repetitions) printcombinations(int a[],int sum,int level) { if(sum==0) { print array} else if (sum>0)

[algogeeks] question at K10

2011-02-15 Thread Balaji S
Insert only one line in the function change() so that the output of the program is 10. You are not allowed to use exit(). You are not allowed to edit the function main() or to pass the parameter to change() void change() { // Code here } int main() { int i=5; change(); printf(“%d” ,i); return 0;

Re: [algogeeks] question

2010-05-21 Thread janak chandarana
step 1: Sort array in place. Lets call it A. (N log N) step 2: Create two additional copies of array, lets call them B and C. (this is just for explanation, we can operate on same array A). step 3: Take first element from array A. lets say its value is X. Find pair from B and C whose sum is neare

Re: [algogeeks] question

2010-05-17 Thread Anurag Sharma
oops! Anurag Sharma On Mon, May 17, 2010 at 5:00 PM, Navin Naidu wrote: > @anurag: > > -99 -2 -1 3 +99 > > The min sum (=0) for value pair (-99, 99) > > Now skip, +99 and -99, so -1 will be selected: (99, -99, -1) = -1 > > Actual result: -2, -1, 3 : 0 > > > > > > On Mon, May 17, 2010 at 8:48 AM

Re: [algogeeks] question

2010-05-17 Thread Navin Naidu
@anurag: -99 -2 -1 3 +99 The min sum (=0) for value pair (-99, 99) Now skip, +99 and -99, so -1 will be selected: (99, -99, -1) = -1 Actual result: -2, -1, 3 : 0 On Mon, May 17, 2010 at 8:48 AM, Anurag Sharma wrote: > @Navin : Let me work out the case you gave me array={-99,0,2,-1,99} > >

Re: [algogeeks] question

2010-05-17 Thread Anurag Sharma
@Navin : Let me work out the case you gave me array={-99,0,2,-1,99} 1. Sort the array in nlogn time: array={-99,-1,0,2,99} 2. consider all possible pairs of numbers and keep track of the sum closest 2 zero: -99+-1=-100, |-100|=100 -99+0=-99,|-99|=99 -99+2=-97,|-97|=97 -99+99=0,|0|=0 <--- th

Re: [algogeeks] question

2010-05-16 Thread Navin Naidu
@anurag: wont work, consider the following case: -99 0 2 -1 99 On Sun, May 16, 2010 at 9:12 PM, Rohit Saraf wrote: > @anurag : won't work > -- > Rohit Saraf > Second Year Undergraduate, > Dept. of Computer Science and Engineering > IIT Bombay >

Re: [algogeeks] question

2010-05-16 Thread Rohit Saraf
@anurag : won't work -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and Engineering IIT Bombay http://www.cse.iitb.ac.in/~rohitfeb14 -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks"

Re: [algogeeks] question

2010-05-15 Thread Anurag Sharma
Cant it be done this way:- 1. Sort the array in O(n log(n)) time 2. select all pairs of numbers in array and keep track of minimum sum (closest to zero) and also their indices, in O(n^2) time 3. In another iteration skipping the indices which gave the minimum sum, check whether the

Re: [algogeeks] question

2010-05-07 Thread Jitendra Kushwaha
The solution given by Afroz will work having O(N) extra memory.But in that case the collision in the will increase. If you want to remove collision totally than a hash of O(max_element_in_array) memory will be required. if you want to solve without extra memory then 1. sort the array O(N)

Re: [algogeeks] question

2010-05-07 Thread Amit Agarwal
@Sathaiah, I don't think there is any need to store the pairs. Space complexity is O(n). Lets see this. 1. Put a nested for loop on the given array so that it runs in O(n^2) time. 2. Inside body of the inner loop, I have two numbers for that time and then I'll look for the third numbe

Re: [algogeeks] question

2010-05-05 Thread Afroz Mohiuddin
Well if you want a sum of exactly 0 (or any constant) , there is an O(N^2) way Take your array, and hash it, note that it is always possible to hash a static set of keys so that the search/find in it is worst case O(1). This takes O(N) space, and time. Then over all the tuples of numbers in the o

Re: [algogeeks] question

2010-05-05 Thread jalaj jaiswal
@ vivek sir thanks On Mon, May 3, 2010 at 9:03 PM, vivek bijlwan wrote: > copy the array(A) in a different array(B) to store the index info.(space > O(n)) > sort(A) > take each pair's sum ( complexity O(n^2) ) and with that do a binary > search for the 3rd element needed.(O(log(n))). > > Check

Re: [algogeeks] question

2010-05-05 Thread Sathaiah Dontula
@vivek, Where do you store pairs sum ?, Space is O(N) ... :) Thanks, Sathaiah On Mon, May 3, 2010 at 9:03 PM, vivek bijlwan wrote: > copy the array(A) in a different array(B) to store the index info.(space > O(n)) > sort(A) > take each pair's sum ( complexity O(n^2) ) and with that do a bina

Re: [algogeeks] question

2010-05-03 Thread vivek bijlwan
copy the array(A) in a different array(B) to store the index info.(space O(n)) sort(A) take each pair's sum ( complexity O(n^2) ) and with that do a binary search for the 3rd element needed.(O(log(n))). Check for the indices in B. i believe it can be done in better time somehow. On Mon, May 3,

[algogeeks] question

2010-05-03 Thread jalaj jaiswal
given an array(unsorted) may contain negative numbers too find the index of three numbers whose sum is closest to zero in O(N2 log N) time and O(N) space. P.S -3 is more close to zero then -6 (number line ...) -- With Regards, Jalaj Jaiswal +919026283397 B.TECH IT IIIT ALLAHABAD -- You receiv

[algogeeks] Question with Dijkstra algorithm

2009-12-02 Thread Philip Legrave
Hi. I have implement Dijktsras algo too find shortest path in directed weighted graph with positive edge weights. Now trying to implement A* using a heuristic that is related to geometric distance. In my book it says to implement A* in same way as Dijkstra except for changing the edge cost functio

[algogeeks] Question asked in MS interview

2009-08-14 Thread richa gupta
You have to develop a piece of code that can be attached to a program like Microsoft Word, which would list the last "N" words of the document in descending order of their occurence, and update the list as the user types. What code would you write? Using pseudo code is fine, just list the basic th

[algogeeks] question

2008-11-19 Thread OK
Hi, I try to solve the question 2.4-5 in cormen second edition. Who can help with the answer? Thanks, Or --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to

[algogeeks] QUESTION ?

2007-12-23 Thread sunny
WHAT IS MIN AND MAX ALGORITHEM? IF ANY BODY CAN TELL ME AND SEND ME THAT ALGO, I WILL BE THANKFUL --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks

[algogeeks] Question about OOP

2007-09-11 Thread Lukas Šalkauskas
Hi, I'm interested in _thinking ways_ on designing OOP, Father->child->... relations projection on big/small project. Maybe anyone can give a shot on interesting books, articles in this area. Because for me is very difficult to think that way, and I'm frequently lose a lot of time for designing c

[algogeeks] Question about flow network

2006-12-05 Thread jackyy
Let G = (V,E, c) be a flow network and f is a flow on G. How to prove that summation of f(s,u) = the summation of f(v,t) Note: (s,u) and (v,t) belongs to E --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Algorithm

[algogeeks] Question about Prim's Algorithm

2006-04-14 Thread [EMAIL PROTECTED]
Question about Prim's Algorithm I would like to know how the minimum spanning tree can be achieved in this way, just a few explanation for guidance is ok: In the following example, 999 represents they are not connected. There are altogether 6 vertexes. The adjacency matrix: (0 2 999 3 999 999,

[algogeeks] question

2005-11-21 Thread HalFas`
hi,   where i can find problems list and solutions? (any web site or smth...), i want to practise a little bit.-- =[ I don't have a solution, but i admire your problem ]=

<    1   2