Re: [algogeeks] Counting the ways.

2011-07-14 Thread Sarvesh
it is simple n*n ways. On Thu, Jul 14, 2011 at 11:36 PM, tendua <6fae1ce6347...@gmail.com> wrote: > We are given n by n boolean matrix ( n <= 20). Output of matrix should > be such that every row and every column should have only one true > value ( true=1, false=0). Input matrix can have any num

Re: [algogeeks] Re: Image based Problem (Google)

2011-07-14 Thread sagar pareek
use consistency hashing see "chord" On Fri, Jul 15, 2011 at 3:22 AM, DK wrote: > @Sagar: And how would you resolve hash collisions? > > -- > DK > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To view this discussion on the web visit

Re: [algogeeks] Printf ...

2011-07-14 Thread sagar pareek
Whats wrong in this? o/p is--> %.#s Zi *%.#s *is printed as usual and *Zi *is printed coz of *%.2s *it will print only 2 characters as written after decimal place. :) It wil ignore 2nd str On Fri, Jul 15, 2011 at 1:31 AM, rShetty wrote: > #include > int main() > { > char str[] = "Zingle Bell Z

Re: [algogeeks] C output

2011-07-14 Thread Sandeep Jain
This should help you out. http://msdn.microsoft.com/en-us/library/f90831hc.aspx Regards, Sandeep Jain On Fri, Jul 15, 2011 at 11:15 AM, abhishek kumar < mailatabhishekgu...@gmail.com> wrote: > @Sandeep Jain > > sandeep, please be more clear about lvalue & rvalue assignment. > > -- > You rece

Re: [algogeeks] Printf ...

2011-07-14 Thread kranthi kumar
Hi, See the below link for detailed explanation of special printf format specifiers in C... http://www.cplusplus.com/reference/clibrary/cstdio/printf/ -- Regards: --- D Kranthi kumar Computer Science & Engg. 1st Mtech, IIT Madras. -- You received this message because you ar

Re: [algogeeks] Whats wrong?

2011-07-14 Thread sagar pareek
thanks ankit On Fri, Jul 15, 2011 at 1:07 AM, ankit sambyal wrote: > Change the printf statement to : > > printf("&root->%x--root-->%x--&(root->data)=%x--&(root->left)=%x--&(root-->right)=%x--*root-->%d",&root,root,&(root->data),&(root->left),&(root->right),*root); > > > Actually printf behaves u

Re: [algogeeks] C output

2011-07-14 Thread abhishek kumar
@Sandeep Jain sandeep, please be more clear about lvalue & rvalue assignment. -- 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/-/42bIvZNRPRYJ. To post to this

Re: [algogeeks] C output

2011-07-14 Thread abhishek kumar
@Gaurav Jain but in Turbo C++ (as a c++ program) it is giving output a=36. -- 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/-/ORNJxARkBIoJ. To post to this gr

Re: [algogeeks] C output

2011-07-14 Thread Sandeep Jain
@ALL: Turbo C is one of the most pathetic compilers I've seen. It has tremendous skills to ruin your concepts. Regards, Sandeep Jain On Fri, Jul 15, 2011 at 10:35 AM, abhishek kumar < mailatabhishekgu...@gmail.com> wrote: > @Gaurav Jain > > in turbo c++,(this was a c program). > > it is givin

Re: [algogeeks] C output

2011-07-14 Thread abhishek kumar
@Gaurav Jain in turbo c++,(this was a c program). it is giving output 36. -- 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/-/uuO64oNqACMJ. To post to this gr

Re: [algogeeks] شكر

2011-07-14 Thread shady
you can't expect me to translate mails from people, anyway i have unbanned him/her. :) Please use English to communicate, and no SMS language as seen in many posts my people. 2011/7/15 Priyanshu > I think u should have read the translated version first.. > > what he meant was: "Thank you for yo

Re: [algogeeks] Re: Counting the ways.

2011-07-14 Thread shilpa gupta
@tendua.ya i was wrong i got it... 2011/7/15 ●αηυяαg ∩ ℓιƒє ≈ Φ > #include > #include > #include > > using namespace std; > > bool mark[20]; > vector v[20]; > int count=0,n; > > void solve(int row) > { >if(row==n)count++; > >else >for(int i=0;i{ >

Re: [algogeeks] Re: Image based Problem (Google)

2011-07-14 Thread DK
@Sagar: And how would you resolve hash collisions? -- DK -- 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/-/wmjP3AkyfocJ. To post to this group, send email to

Re: [algogeeks] C OUTPUT HELP

2011-07-14 Thread T3rminal
1) getchar must be a function in that case . Check /usr/include/stdio.h . It must have contained an extern definition (it is on my machine). 2) Machines generally have separate registers for floating point values(let say %fr). While executing this line *printf("%d\n",t); *that register is loaded

Re: [algogeeks] شكر

2011-07-14 Thread Priyanshu
I think u should have read the translated version first.. what he meant was: "Thank you for your acceptance to join you, Regards" should warn him though.. Regards, Priyanshu Gupta 2011/7/14 shady > banned > > > 2011/7/15 المصلاوي > >> شكرا للقبول بالانظمام اليكم مع تحياتي >> >> -- >> You r

Re: [algogeeks] puzzle-plz explain stepwise

2011-07-14 Thread Tushar Bindal
yx - xy = x0y - yx => (10y + x) - (10x + y) = (100x + y) - (10y + x) 9y - 9x = 99x - 9y 18y = 108x y=6x Since, x comes in hundreds place, we know it can only be 1 as the difference between the 3 digit number and two digit number is difference of two 2 digit numbers only. thus, y=6*1 = 6 a explai

[algogeeks] Printf ...

2011-07-14 Thread rShetty
#include int main() { char str[] = "Zingle Bell Zingle Bell"; printf("%.#s %.2s\n",str,str); return 0; } I need the help to figure out the output of the program and please expalin the behaviour of the printf statement here ? -- You received this message because you are subscribed to the Googl

Re: [algogeeks] شكر

2011-07-14 Thread shady
banned 2011/7/15 المصلاوي > شكرا للقبول بالانظمام اليكم مع تحياتي > > -- > 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 > alg

Re: [algogeeks] Whats wrong?

2011-07-14 Thread ankit sambyal
Change the printf statement to : printf("&root->%x--root-->%x--&(root->data)=%x--&(root->left)=%x--&(root-->right)=%x--*root-->%d",&root,root,&(root->data),&(root->left),&(root->right),*root); Actually printf behaves unexpectedly when we use %d before %x in the same printf statement. root and &(

[algogeeks] Re: swapping values in C

2011-07-14 Thread Dave
@Tendua: It does. The result of erroneous code is undefined. It might work as the coder intended, or it might do something else entirely. It might even do the intended thing in some cases but fail in others in the same source file. Dave On Jul 14, 12:51 pm, tendua <6fae1ce6347...@gmail.com> wrote

Re: [algogeeks] Whats wrong?

2011-07-14 Thread Piyush Kapoor
the expression "*root" causes the structure to be printed,which prints,(root->data=),10,(root->left=)0,(root->right)=0 and then the last value is &(root->data),other remaining values are ignored On Fri, Jul 15, 2011 at 12:16 AM, sagar pareek wrote: > #include > #include > struct node > { > in

[algogeeks] شكر

2011-07-14 Thread المصلاوي
شكرا للقبول بالانظمام اليكم مع تحياتي -- 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

[algogeeks] Whats wrong?

2011-07-14 Thread sagar pareek
#include #include struct node { int data; struct node *left; struct node *right; }*root=NULL; main() { root=(struct node *)malloc(sizeof(struct node)); root->data=10; root->left=NULL; root->right=NULL; printf("&root->%x--root-->%x--*root-->%d--&(root->data)=%x--&(root->

[algogeeks] Re: Counting the ways.

2011-07-14 Thread ●αηυяαg ∩ ℓιƒє ≈ Φ
#include #include #include using namespace std; bool mark[20]; vector v[20]; int count=0,n; void solve(int row) { if(row==n)count++; else for(int i=0;i>n; for(int i=0;i>x; if(x)v[i].push_back(j); } memset(mark,false,sizeof(mark));

[algogeeks] Re: Counting the ways.

2011-07-14 Thread tendua
@Shilpa: following your proposed algorithm answer to input matrix: 1 1 1 1 1 1 1 1 1 should be 27 but correct answer would be 6. It's an easy task to check out all possible 6 states manually. If you find the seventh way please post it. On Jul 14, 11:31 pm, Rishabh Maurya wrote: > It can be done i

Re: [algogeeks] Counting the ways.

2011-07-14 Thread Rishabh Maurya
It can be done in O(2^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,

Re: [algogeeks] Counting the ways.

2011-07-14 Thread shilpa gupta
if we have to find out no of possible outputs ...then we can do this for(i=1;i<=n;i++) { ans=ans * no of 1s in ith row return(ans); } On Thu, Jul 14, 2011 at 11:46 PM, SkRiPt KiDdIe wrote: > > > Will a Back-tracking solution suffice..?? > > -- > You received this message because you are s

Re: [algogeeks] Counting the ways.

2011-07-14 Thread SkRiPt KiDdIe
Will a Back-tracking solution suffice..?? -- 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.

[algogeeks] Counting the ways.

2011-07-14 Thread tendua
We are given n by n boolean matrix ( n <= 20). Output of matrix should be such that every row and every column should have only one true value ( true=1, false=0). Input matrix can have any number of 1's and there will be no row or column having all zero values. Example: let n=4 Input Matrix: 1 0 1

[algogeeks] Re: swapping values in C

2011-07-14 Thread tendua
@Dave: You said *a ^= *b ^= *a ^= *b violates the sequence point rule in swap(). But it's the same as in main function. Why doesn't it violates the rule in main() ? On Jul 13, 1:30 am, Don wrote: > To make it into valid code, break it into three operations: > > void swap(int *a, int *b) >        

Re: [algogeeks] Re: Largest BST subtree in Binary Tree

2011-07-14 Thread ravindra patel
OR 10 / \ 5 15 / \/ \

Re: [algogeeks] Max Arithmetic Subsequence

2011-07-14 Thread Navneet Gupta
It worked fine on sorted input. On Wed, Jul 13, 2011 at 5:46 AM, Navneet Gupta wrote: > OOPS..Bad miss :( > > On Tue, Jul 12, 2011 at 11:53 PM, sunny agrawal > wrote: >> Algorithm in the paper says works only on sorted arrays >> it is mentioned in the paper itself >> >> On Tue, Jul 12, 2011

Re: [algogeeks] Test Mail - Plz ignore

2011-07-14 Thread radha krishnan
successfully ignored :P On Thu, Jul 14, 2011 at 6:57 AM, Navneet Gupta wrote: > Sending a test mail after re-joining the group. Please ignore. > > -- > Regards, > Navneet > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to th

[algogeeks] Test Mail - Plz ignore

2011-07-14 Thread Navneet Gupta
Sending a test mail after re-joining the group. Please ignore. -- Regards, Navneet -- 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 t

Re: [algogeeks] Re: MS: BST

2011-07-14 Thread surender sanke
i extend anurag's idea, instead of using an extra array,use map with keys (k-ai , ai). while traversing through a, check if element found in map. if found print pairs else add entry in map. surender 2011/7/12 ●αηυяαg ∩ ℓιƒє ≈ Φ > In order traversal results in a sorted list of elements of BST sa

[algogeeks] Aniket Dutta wants to chat

2011-07-14 Thread Aniket Dutta
I've been using Google Talk and thought you might like to try it out. We can use it to call each other for free over the internet. Here's an invitation to download Google Talk. Give it a try! --- Aniket Dutta wants to stay in bet

Re: [algogeeks] SDE online test

2011-07-14 Thread ankit sablok
where is the link man On Thu, Jul 14, 2011 at 5:28 PM, mohit wrote: > Hey guys , is amazon conducting online test for SDE post? > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegro

Re: [algogeeks] c doubt

2011-07-14 Thread sangeeta goyal
thnx all...i got it :) On Thu, Jul 14, 2011 at 2:13 AM, Anika Jain wrote: > As in base 10 we say 552.5 is same as 5.525 *10^2 , here 2 is the exponent > of base 10.. so similarly in binary nos. for base 2 here if i make > 101.00110011.. to 1.0100110011.. *2^2 my exponent is 2.. now in storage

[algogeeks] SDE online test

2011-07-14 Thread mohit
Hey guys , is amazon conducting online test for SDE post? -- 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...@go

Re: [algogeeks] c code bst mirror prob

2011-07-14 Thread Anika Jain
ya i have posted na just nw i m sorry tht i misunderstood it.. swap code within the func is working ryt n swap func itself is working wrong.. On Thu, Jul 14, 2011 at 4:20 PM, kavitha nk wrote: > ya i too think de same... > > > //BE COOL// kavi > > -- > You received this message because you a

[algogeeks] Re: Can any one please post the questions they faced during Amazon campus recruitment both online test and the interview rounds??

2011-07-14 Thread sinhanurag
thank fr ur help reynald On Jul 14, 12:41 pm, Reynald Suz wrote: > Hope this blog helps a little:http://amazon-interview-questions.blogspot.com/ > > On Thu, Jul 14, 2011 at 12:36 PM, sinhanurag wrote: > > Can any one please post the questions they faced during Amazon campus > > recruitment both

Re: [algogeeks] C output

2011-07-14 Thread Sandeep Jain
Yup... *In C++* Pre-Increment & Pre-Decrement return LValue Post-Increment & Post-Decrement return RValue *In C* Pre-Increment & Pre-Decrement return RValue Post-Increment & Post-Decrement return RValue Regards, Sandeep Jain On Thu, Jul 14, 2011 at 4:08 PM, T3rminal wrote: > @ all > This c

Re: [algogeeks] c code bst mirror prob

2011-07-14 Thread kavitha nk
ya i too think de same... //BE COOL// kavi -- 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.

Re: [algogeeks] C output

2011-07-14 Thread T3rminal
@ all This code is error in C as pre-increment operator in C returns rvalue but it will work fine in C++ as it returns lvalue in C++ which is required as LHS of assignment operator -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view thi

Re: [algogeeks]

2011-07-14 Thread shilpa gupta
i think he asked for cubenot square and btw if we can divide by something then smallest no will b 1/675. by multiplying this we will get 1 which is cube of itself... On Thu, Jul 14, 2011 at 3:52 PM, bagaria.ka...@gmail.com < bagaria.ka...@gmail.com> wrote: > 3 > 625/3=225 =15*15 > > > On Thu,

Re: [algogeeks] Re: Image based Problem (Google)

2011-07-14 Thread Anand Saha
Hash will suggest if the image was modified or not. The question I think is about finding the exact pixels which changed compared to original one. -- On Thu, Jul 14, 2011 at 3:50 PM, sagar pareek wrote: > oh common take HASH of the image whuch need less space compare to > original one...

Re: [algogeeks]

2011-07-14 Thread bagaria.ka...@gmail.com
On Thu, Jul 14, 2011 at 3:52 PM, bagaria.ka...@gmail.com < bagaria.ka...@gmail.com> wrote: > 3 > 625/3=225 =15*15 > > sorry i divided question was multipied > > On Thu, Jul 14, 2011 at 3:44 PM, shilpa gupta wrote: > >> its 5 >> >> >> On Thu, Jul 14, 2011 at 3:38 PM, Piyush Sinha >> wrote: >> >>>

Re: [algogeeks]

2011-07-14 Thread bagaria.ka...@gmail.com
3 625/3=225 =15*15 On Thu, Jul 14, 2011 at 3:44 PM, shilpa gupta wrote: > its 5 > > > On Thu, Jul 14, 2011 at 3:38 PM, Piyush Sinha wrote: > >> 5 >> >> >> On Thu, Jul 14, 2011 at 3:28 PM, anshul mehta > > wrote: >> >>> by what least no. 675 be multiplied to obtain a no. which is a perfect >>> cub

Re: [algogeeks] Re: Image based Problem (Google)

2011-07-14 Thread sagar pareek
oh common take HASH of the image whuch need less space compare to original one :) On Wed, Jul 13, 2011 at 1:01 AM, DK wrote: > @Santosh: It depends on the type of the image. An image cannot be > represented in a (lossy) compressed format using fourier or wavelet > coefficients if we are

Re: [algogeeks]

2011-07-14 Thread shilpa gupta
its 5 On Thu, Jul 14, 2011 at 3:38 PM, Piyush Sinha wrote: > 5 > > > On Thu, Jul 14, 2011 at 3:28 PM, anshul mehta > wrote: > >> by what least no. 675 be multiplied to obtain a no. which is a perfect >> cube? >> >> -- >> You received this message because you are subscribed to the Google Groups >

Re: [algogeeks]

2011-07-14 Thread Piyush Sinha
5 On Thu, Jul 14, 2011 at 3:28 PM, anshul mehta wrote: > by what least no. 675 be multiplied to obtain a no. which is a perfect > cube? > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@go

Re: [algogeeks] Output ( File Handling)

2011-07-14 Thread kavitha nk
dis s just becoz u ve declared as unsigned char(i.e.) EOF valu is -1 and the range of ch will be form 0 to 255...so -1 is never reached...dis is error...if i'm wrong correct me... //BE COOL// kavi -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" g

Re: [algogeeks] # References !!!!

2011-07-14 Thread sagar pareek
#include using namespace std; int main(void) { int a=10 ,b=4; int& c=a; cout<<"\n-" This is also somewhat compiler dependant as some compilers store references > in symbol table while others do so using stack.This one runs on stack > fundamentals.This is again

[algogeeks]

2011-07-14 Thread anshul mehta
by what least no. 675 be multiplied to obtain a no. which is a perfect cube? -- 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 algog

Re: [algogeeks] Output ( File Handling)

2011-07-14 Thread Aniket Dutta
1. in ur program it will always output 1 because precedence of != is greater than = (assignment) On Thu, Jul 14, 2011 at 2:57 PM, Aniket Dutta wrote: > yeah i just figured it out > > > On Thu, Jul 14, 2011 at 2:47 PM, rajeev bharshetty > wrote: > >> @Aniket Its getc itself !! >> >> On Thu, Jul

Re: [algogeeks] Output ( File Handling)

2011-07-14 Thread Aniket Dutta
addtion to previous post while((ch=getc(fp))!=EOF) then 2 case will occur On Thu, Jul 14, 2011 at 3:16 PM, Aniket Dutta wrote: > 2. the value of EOF is an integer which equals -1 (0x) >and not 0xff becoz this is a valid Ascii character >for this reason of tructation the while loop

Re: [algogeeks] Output ( File Handling)

2011-07-14 Thread Aniket Dutta
2. the value of EOF is an integer which equals -1 (0x) and not 0xff becoz this is a valid Ascii character for this reason of tructation the while loop will always be true. On Thu, Jul 14, 2011 at 3:13 PM, Aniket Dutta wrote: > 1. in ur program it will always output 1 because

[algogeeks] Re: help..

2011-07-14 Thread rj7
@sunny how did you arrive at the bit wise operation thing1 -- 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.

Re: [algogeeks] C output

2011-07-14 Thread Gaurav Jain
@Abhi Have a look at this. http://codepad.org/zMV45iFY On Thu, Jul 14, 2011 at 2:26 PM, Abhi wrote: > @gaurav jain: > http://ideone.com/mRS9N > > lvalue is required as LHS of assignment operator is a constant 'value'. > > -- > You received this message because you are subscribed to the Google G

[algogeeks] Re: plz explain if the solution is possible with less than 2n-3 comparisons??

2011-07-14 Thread Nitish Garg
Yes, Sunny mentioned just the right number of comparisons required. Read the tournament method to find the second largest or second smallest number in your case. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discussion on the

Re: [algogeeks] Output ( File Handling)

2011-07-14 Thread Aniket Dutta
yeah i just figured it out On Thu, Jul 14, 2011 at 2:47 PM, rajeev bharshetty wrote: > @Aniket Its getc itself !! > > On Thu, Jul 14, 2011 at 2:45 PM, Aniket Dutta wrote: > >> i think i should be like this >> while((c=fgetc(fp))!=EOF) and not getc >> >> >> On Thu, Jul 14, 2011 at 2:41 PM, rShetty

Re: [algogeeks] C Output

2011-07-14 Thread saurabh singh
ignore anything i wrote above.I am an idiot anyway. On Thu, Jul 14, 2011 at 2:42 PM, saurabh singh wrote: > then the version of spoj compiler for d must be belonging to an entirely > different world.I have solved a few problems using D and it had entirely > different syntax > > > On Thu, Jul 14,

Re: [algogeeks] Output ( File Handling)

2011-07-14 Thread rajeev bharshetty
@Aniket Its getc itself !! On Thu, Jul 14, 2011 at 2:45 PM, Aniket Dutta wrote: > i think i should be like this > while((c=fgetc(fp))!=EOF) and not getc > > > On Thu, Jul 14, 2011 at 2:41 PM, rShetty wrote: > >> // File Handling >> #include >> #include >> int main() >> { >> unsigned char ch; //

[algogeeks] Re: plz explain if the solution is possible with less than 2n-3 comparisons??

2011-07-14 Thread shiv narayan
@sunny iam asking minimum no of comaparisons. On Jul 14, 10:22 am, sunny agrawal wrote: > n+lgn-2 no of comparisions will do > > On Thu, Jul 14, 2011 at 10:19 AM, shiv narayan > wrote: > > > Describe an optimal algorithm to find the second minimum number in an > > array of numbers. What is the

Re: [algogeeks] Output ( File Handling)

2011-07-14 Thread Aniket Dutta
i think i should be like this while((c=fgetc(fp))!=EOF) and not getc On Thu, Jul 14, 2011 at 2:41 PM, rShetty wrote: > // File Handling > #include > #include > int main() > { > unsigned char ch; // I think there is problem somewhere in this > line ! Help !! > FILE *fp; > fp = fopen("abc","r")

Re: [algogeeks] C Output

2011-07-14 Thread saurabh singh
then the version of spoj compiler for d must be belonging to an entirely different world.I have solved a few problems using D and it had entirely different syntax On Thu, Jul 14, 2011 at 9:39 AM, shilpa gupta wrote: > if you have any doubt than run it i have done so..it is running > > On

[algogeeks] Output ( File Handling)

2011-07-14 Thread rShetty
// File Handling #include #include int main() { unsigned char ch; // I think there is problem somewhere in this line ! Help !! FILE *fp; fp = fopen("abc","r"); if(fp==NULL) { printf("Unable to Open"); exit(1); } while((ch = getc(fp)!=EOF)) printf("%c",ch); fclose(fp); printf("\n",ch)

[algogeeks] Re: amazon

2011-07-14 Thread Amit Gupta
Just replace the 1's with { and 0's with } -- 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/-/H1GtxuX8Zq4J. To post to this group, send email to algogeeks@goog

Re: [algogeeks] C output

2011-07-14 Thread Abhi
@gaurav jain: http://ideone.com/mRS9N lvalue is required as LHS of assignment operator is a constant 'value'. -- 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

[algogeeks] Re: Dynamic Programming Cormen

2011-07-14 Thread Nitish Garg
I just read that had the cost of a line be defined as just the number of extra spaces and not as the cube of the number of extra spaces, then the greedy approach I mentioned in the above post, can anybody explain why not in the first case? -- You received this message because you are subscribe

[algogeeks] Re: amazon

2011-07-14 Thread Amit Gupta
I think Nitish is right. The output shoud be as mentioned by Nitish. And the code for that #include int n; void f(int *,int,int,int); int main() { scanf("%d",&n); int arr[n]; f(arr,0,0,0); getchar(); getchar(); return 0; } void f(int arr[], int open, int close, int index

[algogeeks] Re: amazon

2011-07-14 Thread Nitish Garg
Err.. I think the question must be to print all the balanced parenthesizations given a number n. As the total number of balanced parentheses are given by Catalan Numbers, I think the answer for 3 must be ((())) ()(()) ()()() (())() (()()) for a total of 5. If not can you please

Re: [algogeeks] C output

2011-07-14 Thread Gaurav Jain
@Anika The code executes just all right. @Abhishek This is related to one of those irritating issues about precedence of operators. ++ and * have the same precedence and have right-to-left associativity. So your expression reads as ++(*b) = ++(*b) RHS evaluates to 36 which gets stored in (*b) an

[algogeeks] Dynamic Programming Cormen

2011-07-14 Thread Nitish Garg
I was going through this question : Printing Neatly (15.2, Cormen) Consider the problem of neatly printing a paragraph on a printer. The input text is a sequence of n words of lengths l1, l2, . . . , ln, measured in characters. We want to print this paragraph neatly on a number of lines that ho

Re: [algogeeks] Can any one please post the questions they faced during Amazon campus recruitment both online test and the interview rounds??

2011-07-14 Thread Reynald Suz
Hope this blog helps a little: http://amazon-interview-questions.blogspot.com/ On Thu, Jul 14, 2011 at 12:36 PM, sinhanurag wrote: > Can any one please post the questions they faced during Amazon campus > recruitment both online test and the interview rounds?? > > -- > You received this message

Re: [algogeeks] C Output

2011-07-14 Thread Anil Arya
@nicks ---solving 295c questions .good dude.. On Thu, Jul 14, 2011 at 8:01 AM, nicks wrote: > Hey Guys, plz help me in getting these 2 C output problems > > *PROBLEM 1>.* > * > * > *#*include > int main() > { > short int a,b,c; > scanf("%d%d",&a,&b); > c=a+b; > printf("%d",c); >

Re: [algogeeks] MS

2011-07-14 Thread surender sanke
its failing for 9*12 with n=7, if i take max square considered of hcf(9,12), left space is 6*6 and 3*3. i'll have more left space than what i consider three 4*4 squares, four 1*1 squares. leftspace is 1*5. i think needs different trick surender On Mon, Jul 11, 2011 at 9:59 PM, Yogesh Yadav wrot

Re: [algogeeks] Re: amazon

2011-07-14 Thread shilpa gupta
@atul ...i got the code ignore my previous comment... On Thu, Jul 14, 2011 at 12:30 PM, shilpa gupta wrote: > @kranthi.{} {} {} {} > {{}} {{}} > {{{}}} {} > {} {{{}}} > as according to sequence i think ..if it should be some th

Re: [algogeeks] C Output

2011-07-14 Thread Gaurav Jain
@Nicks *Problem 1* %d is used to take a signed integer as input. To take a short integer as input, use %hi. That way, you would get the correct answer as 2. *Problem 2:* a:1 means that variable a is of width *1 bit* Similarly, b:2 means that b is of width *2 bits* b = 6 sets the two bits as 10,

[algogeeks] Can any one please post the questions they faced during Amazon campus recruitment both online test and the interview rounds??

2011-07-14 Thread sinhanurag
Can any one please post the questions they faced during Amazon campus recruitment both online test and the interview rounds?? -- 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] Re: amazon

2011-07-14 Thread shilpa gupta
@kranthi.{} {} {} {} {{}} {{}} {{{}}} {} {} {{{}}} as according to sequence i think ..if it should be some thing else than than tell me On Thu, Jul 14, 2011 at 12:23 PM, shilpa gupta wrote: > @atul i think there is some pro