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 rajeevr...@gmail.com wrote: // File Handling #includestdio.h #includestdlib.h int main() { unsigned char ch; // I think there is problem somewhere in this line ! Help !! FILE

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 rajeevr...@gmail.comwrote: @Aniket Its getc itself !! On Thu, Jul 14, 2011 at 2:45 PM, Aniket Dutta aniketdutt...@gmail.comwrote: i think i should be like this while((c=fgetc(fp))!=EOF) and not getc On Thu

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 aniketdutt...@gmail.comwrote: 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

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 aniketdutt...@gmail.comwrote: 1. in ur program

[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

Re: [algogeeks] microsoft ques

2011-07-13 Thread Aniket Dutta
@sunny: right thanks for correcting On Wed, Jul 13, 2011 at 11:33 AM, sunny agrawal sunny816.i...@gmail.comwrote: @Aniket Dutta Solution for your case will be 96 Algorithm Posted by Oppilas will do and is O(n). On Wed, Jul 13, 2011 at 11:28 AM, Aniket Dutta aniketdutt...@gmail.comwrote

Re: [algogeeks] microsoft ques

2011-07-12 Thread Aniket Dutta
what happens when to the '{' in comments i guess your program is also counting that.. On Tue, Jul 12, 2011 at 6:22 PM, nicks crazy.logic.k...@gmail.com wrote: igonre the previous code, here is fully working code..previous one doesn't include check for having { within quotes which

Re: [algogeeks] microsoft ques

2011-07-12 Thread Aniket Dutta
for example /* { { } }*/ On Tue, Jul 12, 2011 at 6:36 PM, Aniket Dutta aniketdutt...@gmail.comwrote: what happens when to the '{' in comments i guess your program is also counting that.. On Tue, Jul 12, 2011 at 6:22 PM, nicks crazy.logic.k...@gmail.com wrote: igonre

Re: [algogeeks] Re: Search node in a binary tree

2011-07-12 Thread Aniket Dutta
@bittu On 7/12/11, Aniket Dutta aniketdutt...@gmail.com wrote: what will happen if node is not found?. you are not checking it On 7/12/11, bittu shashank7andr...@gmail.com wrote: whats the problem with this bool search(root,node) { if(root==node) return 1; else

Re: [algogeeks] Re: Search node in a binary tree

2011-07-12 Thread Aniket Dutta
what will happen if node is not found?. you are not checking it On 7/12/11, bittu shashank7andr...@gmail.com wrote: whats the problem with this bool search(root,node) { if(root==node) return 1; else return search(root-left,node)||search(root-right,node); }

Re: [algogeeks] Re: Search node in a binary tree

2011-07-12 Thread Aniket Dutta
@yeah right On Tue, Jul 12, 2011 at 7:36 PM, ankit sambyal ankitsamb...@gmail.comwrote: @Aniket: Just add a condition at the begining: if(root == NULL) return 0; -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this

Re: [algogeeks] Re: Search node in a binary tree

2011-07-12 Thread Aniket Dutta
@bittu On Tue, Jul 12, 2011 at 8:09 PM, Aniket Dutta aniketdutt...@gmail.comwrote: @yeah right On Tue, Jul 12, 2011 at 7:36 PM, ankit sambyal ankitsamb...@gmail.comwrote: @Aniket: Just add a condition at the begining: if(root == NULL) return 0; -- You received this message

Re: [algogeeks] Re: Search node in a binary tree

2011-07-12 Thread Aniket Dutta
sorry @ankit On Tue, Jul 12, 2011 at 8:10 PM, Aniket Dutta aniketdutt...@gmail.comwrote: @bittu On Tue, Jul 12, 2011 at 8:09 PM, Aniket Dutta aniketdutt...@gmail.comwrote: @yeah right On Tue, Jul 12, 2011 at 7:36 PM, ankit sambyal ankitsamb...@gmail.comwrote: @Aniket: Just add

Re: [algogeeks] Re: linked list doubt

2011-07-12 Thread Aniket Dutta
@anika: according to satistics we need both n/2 and n/2+1 to find the median from an even set ((n/2)+(n/2+1))/2. but here you cannot do this. so i guess n/2+1 or n/2 both are correct because both contribute equally to calculate median. On 7/12/11, bittu shashank7andr...@gmail.com wrote: now try

Re: [algogeeks] output

2011-07-12 Thread Aniket Dutta
@dheeraj: but the prototypes are same. how u are calling it overloading plz explain On 7/12/11, dheeraj tyagi dheeraj2...@gmail.com wrote: const means that it cannot be overloaded..i think due to that this is happening. On Tue, Jul 12, 2011 at 9:26 PM, segfault pawan1991ya...@gmail.com

Re: [algogeeks] output

2011-07-12 Thread Aniket Dutta
@sandeep sir: thanx sir for clearing doubt On 7/12/11, Sandeep Jain sandeep6...@gmail.com wrote: *const* in C++ is not exactly same as *final* in java. SO unlike java adding the keyword const to a function does not affect overriding. Infact, adding in C++ const functions == that they will

Re: [algogeeks] questions related to C

2011-07-12 Thread Aniket Dutta
c=a+b then find b=c-a; if this b equals previous one then ok else overflow On 7/9/11, John Hayes agressiveha...@gmail.com wrote: regarding question related to overflow int ovr_sum(int *sum,int a,int b) { *sum=a+b if(*sum0) return -1; //overflow else return 0; //no

Re: [algogeeks] MS Interview

2011-07-12 Thread Aniket Dutta
you can sort it using external merge sort. if ur file is greater than memory refer henry F. korth Database System Concept On Wed, Jul 13, 2011 at 10:26 AM, rShetty rajeevr...@gmail.com wrote: Given a very big file of words, a word in each line, sort the words . Please provide the algorithm and

Re: [algogeeks] Re: questions related to C

2011-07-12 Thread Aniket Dutta
what about a generic swap function which works for structures also? On Wed, Jul 13, 2011 at 2:23 AM, Don dondod...@gmail.com wrote: To check for overflow, use condition: if (b (maxuint-a)) return error; Where maxuint is the largest value which can be stored in an unsigned integer. Don

Re: [algogeeks] microsoft ques

2011-07-12 Thread Aniket Dutta
@vaibhav: Sir ur algo fails in this array {2,-8,-3,1,2} it should give answer as 24 but ur algo gives 2 On Wed, Jul 13, 2011 at 11:02 AM, varun pahwa varunpahwa2...@gmail.comwrote: please ignore my previous post that solution is wrong. On Wed, Jul 13, 2011 at 11:01 AM,