Re: [algogeeks] Is a point inside a polygon?
draw any ray through the point. the ray cuts the polygon at several places on both sides of the point. if the no off cuts @ both side is odd point lie inside the polygon else outside the polygon. Plz see the example in the attached PDF. On Thu, Dec 6, 2012 at 9:48 AM, shivendra singh vivac...@gmail.com wrote: Point-In-Polygon Algorithm On Thu, Dec 6, 2012 at 3:54 AM, Don dondod...@gmail.com wrote: Given a simple polygon (specified by a list of the vertices) and a point, how do you determine if the point is inside the polygon? -- -- -- polygon.pdf Description: Adobe PDF document
[algogeeks] Binomial Coefficients
Hey Guys, how to solve this problem where the input size is 500 digit Integer?? https://www.interviewstreet.com/challenges/dashboard/#problem/4fe19c4f35a0e -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Binomial Coefficients
Cant we do in c++??Any smart algo On Mon, Jul 30, 2012 at 9:14 PM, Kishore kkishoreya...@gmail.com wrote: Python has no int limits On Mon, Jul 30, 2012 at 11:27 AM, shiva@Algo shiv.jays...@gmail.comwrote: Hey Guys, how to solve this problem where the input size is 500 digit Integer?? https://www.interviewstreet.com/challenges/dashboard/#problem/4fe19c4f35a0e -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] MS Question: Segregrate positive and negative nos in array without changing order
A simple Divide and Conquer strategy can work Well Seg_pos_neg(A,beg,end) //A is the array - mid=beg+end/2 if(begend) Seg_pos_neg(A,beg,mid) Seg_pos_neg(A,mid+1,end) //if leftsubarray contains +ve no and right subarray -ve array,we swap them if(A[mid+1]0) j=mid+1 i=beg while(A[i]0i=mid) i++ while(A[j]0i=mid) swap(A[j],A[i]) - Running Time O(nlogn) O(1) space Correct me if I'm Wrong. On Mon, Jul 2, 2012 at 7:53 AM, Bhaskar Kushwaha bhaskar.kushwaha2...@gmail.com wrote: @amol u have used O(n) extra space! I think it's not possible without using extra space. On 7/2/12, Darpan Baweja darpan.bav...@gmail.com wrote: @amol :- i don't think this algo would work here after sorting how would you replace back the original no.s(as no.s are not 0 and 1 in this case) On Sun, Jul 1, 2012 at 11:08 PM, Amol Sharma amolsharm...@gmail.com wrote: i think it has been discussed beforenevertheless here is the required linear time solution. first, count the total number 0's and 1's in the array. let say, total elements are n and there are x zero's. take count1=0 and count2=x; traverse through the array : for(i=0;in;i++) if(arr[i]==0) arr[i]=count1++; else arr[i]=count2++; let's say array is {1,0,0,0,1,1,1,0,0,1} n=10,x=5 count1=0;count2=5 after the traversal it becomes a[]={5,0,1,2,6,7,8,3,4,9} now sort this array in O(n) like this : for(j=0;j=1;j++) { for(i=0;in;i++) { if(arr[i]!=i) swap(arr[i],arr[arr[i]]); } } after the array is sorted again traverse the array and set the elements from index 0 to x-1 to '0' and rest '1'. -- Amol Sharma Final Year Student Computer Science and Engineering MNNIT Allahabad http://gplus.to/amolsharma99 http://twitter.com/amolsharma99 http://in.linkedin.com/pub/amol-sharma/21/79b/507 http://www.simplyamol.blogspot.com/http://facebook.com/amolsharma99 On Fri, Jun 29, 2012 at 9:20 PM, Bhaskar Kushwaha bhaskar.kushwaha2...@gmail.com wrote: @Hassan I think your algo will take time O(n^2) in worst case which occurs when all elements are negative except the last one @everyone Can we solve this problem in linear time? On Fri, Jun 29, 2012 at 9:10 PM, Hassan Monfared hmonfa...@gmail.comwrote: Hi, this can be done by simple modification in bubble sort : void inplace_pos_neg(int pdata[],int sz) { bool changed=false; do { changed=false; for(int i=1;isz;i++) if(pdata[i-1]0 pdata[i]0) { swap(pdata[i-1], pdata[i]); changed=true; } }while(changed); } void test_inplace_pos_neg() { int a[]={-1,-5,10,11,15,-500,200,-10}; copy(a,a+sizeof(a)/sizeof(int),ostream_iteratorint(cout,,));coutendl; inplace_pos_neg(a,sizeof(a)/sizeof(int)); copy(a,a+sizeof(a)/sizeof(int),ostream_iteratorint(cout,,));coutendl; } Regards On Fri, Jun 29, 2012 at 7:52 PM, utsav sharma utsav.sharm...@gmail.comwrote: @bhaskar:- please explain stable sorting algorithm you would use(as mainly all of them require extra space) @sourabh:- that previous post discussion does't lead to any correct soln On Fri, Jun 29, 2012 at 8:39 PM, Bhaskar Kushwaha bhaskar.kushwaha2...@gmail.com wrote: @saurabh please provide the link to the post you are mentioning On Fri, Jun 29, 2012 at 8:38 PM, Bhaskar Kushwaha bhaskar.kushwaha2...@gmail.com wrote: If the order is important then I think we can use any stable sorting algorithm with the following comparison function int compare (int a ,int b) { if((a0b0)||(a0b0)) return 0; else return ab; } On Fri, Jun 29, 2012 at 3:37 PM, raghavan M peacelover1987...@yahoo.co.in wrote: This is a variant of that one -- *From:* saurabh singh saurab...@gmail.com *To:* algogeeks@googlegroups.com *Sent:* Friday, 29 June 2012 3:05 PM *Subject:* Re: [algogeeks] MS Question: Segregrate positive and negative nos in array without changing order duplicate of a previous post.Kindly refer to that post. Saurabh Singh B.Tech (Computer Science) MNNIT blog:geekinessthecoolway.blogspot.com On Fri, Jun 29, 2012 at 10:41 AM, raghavan M peacelover1987...@yahoo.co.in wrote: Hi Question as in subject *No extra space (can use one extra space)-O(1) max *No order change allowed example: input : 1,-5,2,10,-100,-2 output: -5,-10,-100,1,2 input : -1,-5,10,11,15,-500,200,-10 output : -1,-5,-10,-500,-10,10,11,15 Thanks Raghavn -- 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
Re: [algogeeks] MS Question: Segregrate positive and negative nos in array without changing order
* while(A[j]0i=mid) swap(A[j],A[i]) i++ j++ On Mon, Jul 2, 2012 at 8:34 AM, shiva@Algo shiv.jays...@gmail.com wrote: A simple Divide and Conquer strategy can work Well Seg_pos_neg(A,beg,end) //A is the array - mid=beg+end/2 if(begend) Seg_pos_neg(A,beg,mid) Seg_pos_neg(A,mid+1,end) //if leftsubarray contains +ve no and right subarray -ve array,we swap them if(A[mid+1]0) j=mid+1 i=beg while(A[i]0i=mid) i++ while(A[j]0i=mid) swap(A[j],A[i]) - Running Time O(nlogn) O(1) space Correct me if I'm Wrong. On Mon, Jul 2, 2012 at 7:53 AM, Bhaskar Kushwaha bhaskar.kushwaha2...@gmail.com wrote: @amol u have used O(n) extra space! I think it's not possible without using extra space. On 7/2/12, Darpan Baweja darpan.bav...@gmail.com wrote: @amol :- i don't think this algo would work here after sorting how would you replace back the original no.s(as no.s are not 0 and 1 in this case) On Sun, Jul 1, 2012 at 11:08 PM, Amol Sharma amolsharm...@gmail.com wrote: i think it has been discussed beforenevertheless here is the required linear time solution. first, count the total number 0's and 1's in the array. let say, total elements are n and there are x zero's. take count1=0 and count2=x; traverse through the array : for(i=0;in;i++) if(arr[i]==0) arr[i]=count1++; else arr[i]=count2++; let's say array is {1,0,0,0,1,1,1,0,0,1} n=10,x=5 count1=0;count2=5 after the traversal it becomes a[]={5,0,1,2,6,7,8,3,4,9} now sort this array in O(n) like this : for(j=0;j=1;j++) { for(i=0;in;i++) { if(arr[i]!=i) swap(arr[i],arr[arr[i]]); } } after the array is sorted again traverse the array and set the elements from index 0 to x-1 to '0' and rest '1'. -- Amol Sharma Final Year Student Computer Science and Engineering MNNIT Allahabad http://gplus.to/amolsharma99 http://twitter.com/amolsharma99 http://in.linkedin.com/pub/amol-sharma/21/79b/507 http://www.simplyamol.blogspot.com/http://facebook.com/amolsharma99 On Fri, Jun 29, 2012 at 9:20 PM, Bhaskar Kushwaha bhaskar.kushwaha2...@gmail.com wrote: @Hassan I think your algo will take time O(n^2) in worst case which occurs when all elements are negative except the last one @everyone Can we solve this problem in linear time? On Fri, Jun 29, 2012 at 9:10 PM, Hassan Monfared hmonfa...@gmail.comwrote: Hi, this can be done by simple modification in bubble sort : void inplace_pos_neg(int pdata[],int sz) { bool changed=false; do { changed=false; for(int i=1;isz;i++) if(pdata[i-1]0 pdata[i]0) { swap(pdata[i-1], pdata[i]); changed=true; } }while(changed); } void test_inplace_pos_neg() { int a[]={-1,-5,10,11,15,-500,200,-10}; copy(a,a+sizeof(a)/sizeof(int),ostream_iteratorint(cout,,));coutendl; inplace_pos_neg(a,sizeof(a)/sizeof(int)); copy(a,a+sizeof(a)/sizeof(int),ostream_iteratorint(cout,,));coutendl; } Regards On Fri, Jun 29, 2012 at 7:52 PM, utsav sharma utsav.sharm...@gmail.comwrote: @bhaskar:- please explain stable sorting algorithm you would use(as mainly all of them require extra space) @sourabh:- that previous post discussion does't lead to any correct soln On Fri, Jun 29, 2012 at 8:39 PM, Bhaskar Kushwaha bhaskar.kushwaha2...@gmail.com wrote: @saurabh please provide the link to the post you are mentioning On Fri, Jun 29, 2012 at 8:38 PM, Bhaskar Kushwaha bhaskar.kushwaha2...@gmail.com wrote: If the order is important then I think we can use any stable sorting algorithm with the following comparison function int compare (int a ,int b) { if((a0b0)||(a0b0)) return 0; else return ab; } On Fri, Jun 29, 2012 at 3:37 PM, raghavan M peacelover1987...@yahoo.co.in wrote: This is a variant of that one -- *From:* saurabh singh saurab...@gmail.com *To:* algogeeks@googlegroups.com *Sent:* Friday, 29 June 2012 3:05 PM *Subject:* Re: [algogeeks] MS Question: Segregrate positive and negative nos in array without changing order duplicate of a previous post.Kindly refer to that post. Saurabh Singh B.Tech (Computer Science) MNNIT blog:geekinessthecoolway.blogspot.com On Fri, Jun 29, 2012 at 10:41 AM, raghavan M peacelover1987...@yahoo.co.in wrote: Hi Question as in subject *No extra space (can use one extra space)-O(1) max *No order change allowed example: input : 1,-5,2,10,-100,-2 output: -5,-10,-100,1,2 input : -1,-5,10,11,15,-500,200,-10 output : -1,-5,-10,-500,-10,10,11,15 Thanks Raghavn -- You
Re: [algogeeks] Dp solution for this problem?
Min Cost Path: http://www.geeksforgeeks.org/archives/14943 On Mon, Oct 31, 2011 at 12:52 AM, mohit verma mohit89m...@gmail.com wrote: Given a matrix you have to find the shortest path from one point to another within the matrix. The cost of path is all the matrix entries on the way. You can move in any direction (up, down, left, right, diagonally) e.g. 5 9 10 1 3 7 4 4 8 2 1 9 So shortest path from (0,0) to (2,2) is (0,0)--(1,1)---(2,2). Path cost - 5+3+2+1=11 I dont think some DP solution exist for this problem.Can it be? -- Mohit -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Exchanging bit values in a number
How abt this? we need to swap only if both the bits are not same if((n^(1i)n)!=(n^(1j)n)) n^=(1i)+(1j); On 10/29/11, praveen raj praveen0...@gmail.com wrote: int func(int x) { int y=(1i)+(1j); int z=xy;// if after bitwise and ..we get power of 2 then ... we have to flip the bits.. if((z(z-1))==0) return(x^y); else return x; } With regards, Praveen Raj DCE-IT 735993 praveen0...@gmail.com -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Exchanging bit values in a number
we need to swap only if both the bits are not same if((n^(1i)n)!=(n^(1j)n)) n^=(1i)+(1j); On 10/29/11, praveen raj praveen0...@gmail.com wrote: int func(int x) { int y=(1i)+(1j); int z=xy;// if after bitwise and ..we get power of 2 then ... we have to flip the bits.. if((z(z-1))==0) return(x^y); else return x; } With regards, Praveen Raj DCE-IT 735993 praveen0...@gmail.com -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Searching In a large file
Given a file containing roughly 300 million social security numbers(9-digit numbers), find a 9-digit number that is not in the file. You have unlimited drive space but only 2megabytes of RAM at your disposal. -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Inplace Array Convertion
@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 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, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Inplace Array Convertion
@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 array and swap with a2 , so in this case swap(a2,b1) ) a1b1a3 a2b2b3 c1c2c3 (similarly swap(a3,c1) ) a1b1c1 a2b2b3 a3c2c3swap(b3,c2) a1b1c1 a2b2c2 a3b2c3 this in inplace (plz correct if im wrong) -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Inplace Array Convertion
Convert an array a1 a2 a3...an b1 b2 b3...bn c1 c2 c3...cn to a1b1c1 a2b2c2...anbncn, inplace -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Algo for Search in a 2D Matrix
id we see the pattern then we can easily find that the kth smallest element lie on the upper half of the k*k submatrix(on the upperleft corner ) we can do search on (k*k)/2 elements to find that On Mon, Oct 10, 2011 at 10:36 AM, Dave dave_and_da...@juno.com wrote: @Shubham: So if the matrix is 1 2 3 4 and you want the 2nd smallest, are you saying that it is 4? Dave On Oct 9, 7:40 pm, shubham goyal shubhamgoyal.n...@gmail.com wrote: im assuming it be a square matrix then kth smallest element will be in a first k*k sub matrix. jst look for smallest element in the diagonal of this matrix. it will give the kth smallest element . On Mon, Oct 10, 2011 at 4:45 AM, Ankur Garg ankurga...@gmail.com wrote: Given a 2D matrix which is both row wise and column wise sorted. Propose an algorithm for finding the kth smallest element in it in least time complexity A General Max Heap can be used with k space and n+klogk complexity Any other solution or even a way by which we dont scan the whole matrix to find the solution ? I -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Give Algo to do this in O(n)
I think Min heap will do that.. On Mon, Oct 10, 2011 at 12:37 AM, Ankur Garg ankurga...@gmail.com wrote: Given an unsorted array of Integers Find 2 nos whose diff is minimum Say Array is 4 2 18 19 11 8 5 Nos are 18 and 19 Algo shud be of O(n) -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Basic Algorithm
:) On Sat, Oct 8, 2011 at 6:41 AM, Navneet navneetn...@gmail.com wrote: I wonder why my name is there in the example string used :) On Oct 8, 3:11 pm, ManishMCS manishdaw...@gmail.com wrote: A string of characters are given. Find the highest occurrence of a character and display that character. E.g Input: AEGBCNAVNEETGUPTAEDAGPE Output: E. Please give the efficient algorithm w.r.t both space and time.. -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] c output
as expected value 100 goes to a,since %*d is variable field width specifier so the input 200 goes for that,and the remaining input 300 goes to b value of c is not change so the output will be: 100 300 3 On Sun, Oct 9, 2011 at 12:22 AM, Raghav Garg rock.ragha...@gmail.comwrote: *explain the o/p...if i/p are 100 200 300 int main() { int a=1,b=2,c=3; scanf(%d %*d %d,a,b,c); printf(%d %d %d,a,b,c); return(0); } *Thanking you *With regards- Raghav garg Contact no. 9013201944 www.facebook.com/rock.raghavag B. tech (IT), 5th sem University School Of Information Technology Guru Govind Singh Indraprastha University Delhi* -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] c output
This is what you use if you want *scanf()* to eat some data but you don't want to store it anywhere; you don't give *scanf()* an argument for this conversion On Sun, Oct 9, 2011 at 1:32 AM, shiva@Algo shiv.jays...@gmail.com wrote: as expected value 100 goes to a,since %*d is variable field width specifier so the input 200 goes for that,and the remaining input 300 goes to b value of c is not change so the output will be: 100 300 3 On Sun, Oct 9, 2011 at 12:22 AM, Raghav Garg rock.ragha...@gmail.comwrote: *explain the o/p...if i/p are 100 200 300 int main() { int a=1,b=2,c=3; scanf(%d %*d %d,a,b,c); printf(%d %d %d,a,b,c); return(0); } *Thanking you *With regards- Raghav garg Contact no. 9013201944 www.facebook.com/rock.raghavag B. tech (IT), 5th sem University School Of Information Technology Guru Govind Singh Indraprastha University Delhi* -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] print all numbers in a given range without using any loop statements, jump statements and recursion
Thanx ,owesome soln... On Fri, Oct 7, 2011 at 11:44 AM, tanuj chawla houndhun...@gmail.com wrote: #includeiostream int i; class A { public: A(){couti++endl;} ~A(){cout--iendl;} } int main() { A a[100]; return 0; } On Thu, Oct 6, 2011 at 10:42 PM, shiva@Algo shiv.jays...@gmail.comwrote: cant find in archives plz someone On Sun, Oct 2, 2011 at 6:03 PM, Sahil Garg garg.sahi...@gmail.comwrote: plz post the soln.. i cant find it.. Sahil Garg Computer Engineering Delhi College of Engineering On Tue, Sep 27, 2011 at 3:41 PM, shady sinv...@gmail.com wrote: discussed, kindly look at archives On Tue, Sep 27, 2011 at 3:13 PM, surender sanke surend...@gmail.comwrote: print all numbers in a given range *without* using any loop statements, jump statements and recursion surender -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] can somebody kindly explain what would be the output for the following program
here *char *p = ayqm; p points to constant character string so ++*(p++) is an attempt to modify the string so its an error * On Thu, Oct 6, 2011 at 8:35 AM, praneethn praneeth...@gmail.com wrote: *int main() { char *p = ayqm; printf(%c,++*(p++)); return 0; }* -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] can somebody kindly explain what would be the output for the following program
check this : https://www.securecoding.cert.org/confluence/display/seccode/STR30-C.+Do+not+attempt+to+modify+string+literals On Thu, Oct 6, 2011 at 9:40 PM, Neha Gupta nehagup...@gmail.com wrote: its not an error infact pre-increment operator doesnt hv an impact in changing the value of const stringdats y the o/p is a -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] print all numbers in a given range without using any loop statements, jump statements and recursion
cant find in archives plz someone On Sun, Oct 2, 2011 at 6:03 PM, Sahil Garg garg.sahi...@gmail.com wrote: plz post the soln.. i cant find it.. Sahil Garg Computer Engineering Delhi College of Engineering On Tue, Sep 27, 2011 at 3:41 PM, shady sinv...@gmail.com wrote: discussed, kindly look at archives On Tue, Sep 27, 2011 at 3:13 PM, surender sanke surend...@gmail.comwrote: print all numbers in a given range *without* using any loop statements, jump statements and recursion surender -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Tree Question
check this(considering valid input) http://www.ideone.com/Nuhil On Tue, Oct 4, 2011 at 3:36 PM, Dheeraj Sharma dheerajsharma1...@gmail.comwrote: yeah..but am looking for code..that takes the input...as string of (A(B(E(K,L),F),D(H(M,I),J))) and returns head of tree.. On Tue, Oct 4, 2011 at 2:11 PM, Raghav Garg rock.ragha...@gmail.comwrote: *you have to check for the braces where they have been used..in comman brace that means they are on same level..i am providing answer to your problem in attached file.. check that out.. *Raghav garg On Tue, Oct 4, 2011 at 1:53 PM, Dheeraj Sharma dheerajsharma1...@gmail.com wrote: 1.How to construct a tree from the list representation for ex.- construct tree from (A(B(E(K,L),F),D(H(M,I),J))) the tree would be binary the structure of the node would be struct node{ int data; struct node *left,*right; }; 2.Given a binary tree..give its list representaion..(reverse of above question) -- *Dheeraj Sharma* -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Dheeraj Sharma* -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] structure padding
http://www.geeksforgeeks.org/archives/9705 On Sat, Oct 1, 2011 at 9:54 PM, rahul sharma rahul23111...@gmail.comwrote: in structure we want adress to be multiple of the max size variable of structure. mean i have struct { int float char} then multiple of 4 struct { short int int } then multiple of 2. m i ryt -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Amazon Interns
Thanx,,NIT Durgapur,Do i need to study OS and RDBMS On Sat, Oct 1, 2011 at 10:41 AM, .itoa nitm...@gmail.com wrote: BST ,very Large Input data problems, graphs (dfs bfs ,etc). which college ? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/xqxjYxJ3cP8J. 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, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Amazon Interns
Thanx :) On Sat, Oct 1, 2011 at 12:39 PM, SAMMM somnath.nit...@gmail.com wrote: Focus on Algorithm , Data Structure and your coding skills , as they can ask for proper working code at tht moment . -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: amazon ques
Dont know how to delete (how adress will be known of the node? On Sat, Oct 1, 2011 at 12:27 PM, SAMMM somnath.nit...@gmail.com wrote: The hash table would be used by separate chaining method not open addressing because it may not find the correct entry efficiently in the hash table . In case of open addresssing the value gets entered in the first available entry after collision. In case of insertion :- (I have considered only simple insertion as It is not been mentioned ) U can insert the element in the linked list at the end . In case of deletion :- you need to find the address of the node from the hashed table which is to be deleted . you can delete it Hope u know the logic to delete the node of the whose address is only known . For that case we also need to Invalidate the entry in the hash table and update the entry of the next node in the hash table . I hope I am clear In case of searching . Hashing table will serve the purpose . -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Amazon Interns
Amazon is Coming in our college ,Plz sugeest which subjects and what topic to focus for that ... -- 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, visit this group at http://groups.google.com/group/algogeeks?hl=en.