Re: [algogeeks] Inplace Array Convertion

2011-10-14 Thread Siddhartha Banerjee
if integers are positive,then go on a cycle... like a[2]goes to its final position, the element in a[2]'s final position goes to its final position, and so on... each time on visiting an element, put some marker on it... like make it negative... finally after an element comes to position of

Re: [algogeeks] Amazon Question - Find Pythagorean triplet in an unsorted array

2011-10-14 Thread ravindra patel
@Wladimir, yeah I have heard about that. Another way of populating primitive pythagoreans is, for any natural number m 1 (m^2 - 1, 2m, m^2 + 1) forms a pythagorean triplet. This is useful in populating pythagorean tiplets but here the problem is to search such triplets from a given int array. @

Re: [algogeeks] Amazon Question - Find Pythagorean triplet in an unsorted array

2011-10-14 Thread rahul patil
You can take advantage of a basic property of triagle that sum of largest side of triangle sum of other two sides, After sorting you could easily deside the range in which possible solution could be found for a chosen hypotenuse On Fri, Oct 14, 2011 at 11:10 AM, ravindra patel

[algogeeks] Re: Inplace Array Convertion

2011-10-14 Thread kings
can u please take an example and explain itcould not understand the statement a[2]'s final position goes to its final position On Oct 14, 10:40 am, Siddhartha Banerjee thefourrup...@gmail.com wrote: if integers are positive,then go  on a cycle... like a[2]goes to its final position, the  

Re: [algogeeks] Amazon Question - Find Pythagorean triplet in an unsorted array

2011-10-14 Thread Ankur Garg
@Rahul Pls elaborate with an example ... On Fri, Oct 14, 2011 at 2:35 PM, rahul patil rahul.deshmukhpa...@gmail.comwrote: You can take advantage of a basic property of triagle that sum of largest side of triangle sum of other two sides, After sorting you could easily deside the range in

Re: [algogeeks] Amazon Question - Find Pythagorean triplet in an unsorted array

2011-10-14 Thread Siddharth Pipriya
using properties of tiangle wont help i guess. the will give the range of VALUES you want to restrict yourself to. not the range of INDEX's of the array... On Fri, Oct 14, 2011 at 3:14 PM, Ankur Garg ankurga...@gmail.com wrote: @Rahul Pls elaborate with an example ... On Fri, Oct 14, 2011 at

Re: [algogeeks] Amazon Question - Find Pythagorean triplet in an unsorted array

2011-10-14 Thread rahul patil
suppose sorted array is 1,2,3,5,10,12,13,17,19,25 so if u want to find possible combinations, with 25 as hypotenuse, then only range 10 ... 19 could have answer as 19 + 10 25 On Fri, Oct 14, 2011 at 3:14 PM, Ankur Garg ankurga...@gmail.com wrote: @Rahul Pls elaborate with an example ...

Re: [algogeeks] Amazon Question - Find Pythagorean triplet in an unsorted array

2011-10-14 Thread Bittu Sarkar
@rahul It still will be O(n^2) time complexity On 14 October 2011 15:14, Ankur Garg ankurga...@gmail.com wrote: @Rahul Pls elaborate with an example ... On Fri, Oct 14, 2011 at 2:35 PM, rahul patil rahul.deshmukhpa...@gmail.com wrote: You can take advantage of a basic property of

Re: [algogeeks] Amazon Question - Find Pythagorean triplet in an unsorted array

2011-10-14 Thread Ashish Goel
http://stackoverflow.com/questions/575117/pythagorean-triplets Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 On Fri, Oct 14, 2011 at 3:14 PM, Ankur Garg ankurga...@gmail.com wrote: @Rahul Pls elaborate with an example ... On Fri, Oct 14,

Re: [algogeeks] Re: Inplace Array Convertion

2011-10-14 Thread UTKARSH SRIVASTAV
@siddharth what is the complexity? -- *UTKARSH SRIVASTAV CSE-3 B-Tech 3rd Year @MNNIT ALLAHABAD* -- 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,

Re: [algogeeks] Re: Given a String with unnecessary spaces, compact it in place

2011-10-14 Thread veera reddy
#includeiostream#includestdlib.husing namespace std;char * remove_spaces(char *s){ char *result; char *temp; temp=s; result=s; while(*s!='\0') { if(*s==' ') { s++; } else { *temp = *s; temp++; s++;

Re: [algogeeks] Re: Inplace Array Convertion

2011-10-14 Thread shiva@Algo
@Utkarsh As efficient as possible.. On Fri, Oct 14, 2011 at 6:25 AM, UTKARSH SRIVASTAV usrivastav...@gmail.comwrote: @siddharth what is the complexity? -- *UTKARSH SRIVASTAV CSE-3 B-Tech 3rd Year @MNNIT ALLAHABAD* -- You received this message because you are subscribed to the

[algogeeks] Re: Adobe

2011-10-14 Thread WgpShashank
@All Join Interview-Street Group For Detailed Discussion About Interview Process of Particular Company , if You Have particular question wants to discuss here , put that directly , All Interview Related Task Now Shifted Interview-Street Group until Whole Thing is Done , You Can Search The

Re: [algogeeks] Re: Inplace Array Convertion

2011-10-14 Thread shiva@Algo
@Gaurav how will u do for a1a2a3a4a5b1b2b3b4b5c1c2c3c4c5 On Fri, Oct 14, 2011 at 6:49 AM, gaurav yadav gauravyadav1...@gmail.comwrote: consider following example... suppose initailly we have a1a2a3b1b2b3c1c2c3 then do the following- a1a2a3 b1b2b3 c1c2c3 (look for b1 in the remaining

Re: [algogeeks] Re: Inplace Array Convertion

2011-10-14 Thread sunny agrawal
Its Out Shuffle not In shuffle, although both are similar and you can read both On Fri, Oct 14, 2011 at 8:26 PM, sunny agrawal sunny816.i...@gmail.comwrote: this problem is like Card shuffling problem(search for In-shuffle) i think solution is if indexing is zero based each i will go to -

Re: [algogeeks] Re: Inplace Array Convertion

2011-10-14 Thread sunny agrawal
this problem is like Card shuffling problem(search for In-shuffle) i think solution is if indexing is zero based each i will go to - k*i % (N-1) k = 3 and N = 3*n -1 n = no of cards in one pile Or No of a's On Fri, Oct 14, 2011 at 7:52 PM, shiva@Algo shiv.jays...@gmail.com wrote:

Re: [algogeeks] Re: Adobe

2011-10-14 Thread rahul sharma
i dnt knw why still these posts are allowed in algogeeks On Fri, Oct 14, 2011 at 7:37 PM, WgpShashank shashank7andr...@gmail.comwrote: @All Join Interview-Street Group For Detailed Discussion About Interview Process of Particular Company , if You Have particular question wants to discuss

Re: [algogeeks] Re: Inplace Array Convertion

2011-10-14 Thread Pritpal S
What should be the output in this case : a1a2a3a4b1b2b3b4c1c2c3c4 ?? -- 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] Re: Inplace Array Convertion

2011-10-14 Thread gaurav yadav
@shiva...keep swapping the underline elements a1*a2*a3a4a5*b1*b2b3b4b5c1c2c3c4c5 a1b1*a3*a4a5a2b2b3b4b5*c1*c2c3c4c5 a1b1c1*a4*a5*a2*b2b3b4b5a3c2c3c4c5 a1b1c1a2*a5*a4*b2*b3b4b5a3c2c3c4c5 a1b1c1a2b2*a4*a5b3b4b5a3*c2*c3c4c5 a1b1c1a2b2c2*a5*b3b4b5*a3*a4c3c4c5 a1b1c1a2b2c2a3b3*b4*b5a5a4*c3*c4c5

[algogeeks] Re: content extraction

2011-10-14 Thread Dan
Pick a language to work in. Open the file in whatever way your language of choice allows. Read the data. And... you are done. A better answer will probably require a better question. Dan ;-) On Oct 13, 10:44 am, karthikeya s karthikeya.a...@gmail.com wrote: Does anyone have an idea about

Re: [algogeeks] Re: Inplace Array Convertion

2011-10-14 Thread Anika Jain
i have the code solution to this.. if m allowed to post it here then i can i post it. m i allowed to post code here? On Fri, Oct 14, 2011 at 9:40 PM, gaurav yadav gauravyadav1...@gmail.comwrote: @shiva...keep swapping the underline elements a1*a2*a3a4a5*b1*b2b3b4b5c1c2c3c4c5

Re: [algogeeks] Re: Inplace Array Convertion

2011-10-14 Thread ravindra patel
Is there a pattern in the indices of the numbers we are swapping. some formula which may tell the next two indices to swap. Thanks, - Ravindra On Fri, Oct 14, 2011 at 9:40 PM, gaurav yadav gauravyadav1...@gmail.comwrote: @shiva...keep swapping the underline elements

[algogeeks] Re: Inplace Array Convertion

2011-10-14 Thread Dan
On Oct 13, 7:52 pm, shiva@Algo shiv.jays...@gmail.com wrote: Convert an array a1 a2 a3...an b1 b2 b3...bn c1 c2 c3...cn to a1b1c1 a2b2c2...anbncn, inplace See the algorithm for memory efficient rearrangement of array elements in one of the books by Robert Sedgewick such as Algorithms in C++ or

Re: [algogeeks] content extraction

2011-10-14 Thread Hatta
for instance, you'll need some kind of 'magic-key verification' or any other 'pattern matching' with a big dictionary, a wide and complete one; such as the one implemented by command 'file' in unix. On Thu, Oct 13, 2011 at 3:44 PM, karthikeya s karthikeya.a...@gmail.com wrote: Does anyone have

Re: [algogeeks] Re: content extraction

2011-10-14 Thread Hatta
+1 Dan. I've been seeing lots of vague questions around. I thought of doing the same but for the sake of peace I decided not to troll this one. I'm not saying its OP's case but many people either think the job of answering questions is costless or maybe think it's our duty to do so. If you need

[algogeeks] Counting Diagonals in a Polygon

2011-10-14 Thread sunny agrawal
Given a n vertex polygon, find in how many ways k non intersecting diagonals can be drawn ? or in How many ways it can be divided into k+1 regions such that no 2 diagonals intersect ? Limits:1 = k = N = 10^9 -- Sunny Aggrawal B.Tech. V year,CSI Indian Institute Of Technology,Roorkee --