Re: [algogeeks] LEFT MOST set bit in an unsigned integer.

2012-06-14 Thread Anika Jain
to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards Anika Jain -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email

Re: [algogeeks] LEFT MOST set bit in an unsigned integer.

2012-06-14 Thread Anika Jain
sorry note its right shifting in my above post instead of left shift! On Thu, Jun 14, 2012 at 12:47 PM, Anika Jain anika.jai...@gmail.com wrote: keep on left shifting the number till it becomes 0. the moment it becomes 0, the count of how many times you had to right shift the number to get 0

Re: [algogeeks] c prog problem

2012-06-13 Thread Anika Jain
email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards Anika Jain -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email

[algogeeks] Adobe interiew question

2012-06-12 Thread Anika Jain
how can we implement exception handling in c? -- Regards Anika Jain -- 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

[algogeeks] complex notation

2012-06-10 Thread Anika Jain
printf(%d\n, (int) ((int*)0 +1)); its prints no. of bytes in integer. please explain what does this mean? what and how is happening in this? -- Regards Anika Jain -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send

Re: [algogeeks] first Repeating character in a string

2012-06-08 Thread Anika Jain
options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards Anika Jain -- 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: Google Q : all anagrams next to each other

2012-05-24 Thread Anika Jain
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. -- Regards Anika Jain -- You received

Re: [algogeeks] Re: Algo for Search in a 2D Matrix

2012-05-20 Thread Anika Jain
with an example in case i have understood you incorrectly Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 On Thu, May 17, 2012 at 3:33 PM, Anika Jain anika.jai...@gmail.comwrote: there's a solution of O(log n) where 2D matrix has n rows and n

Re: [algogeeks] Re: Algo for Search in a 2D Matrix

2012-05-17 Thread Anika Jain
://groups.google.com/group/algogeeks?hl=en. -- Regards Anika Jain -- 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

Re: [algogeeks] Represent a number in base of minus 2 ????

2012-01-29 Thread Anika Jain
@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. -- Regards Anika Jain -- You received this message because you are subscribed to the Google Groups Algorithm

Re: [algogeeks] 8 box question : MS

2012-01-17 Thread Anika Jain
this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards Anika Jain -- 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

Re: [algogeeks] 8 box question : MS

2012-01-17 Thread Anika Jain
@atul: yes i agree with you.. hmm.. On Tue, Jan 17, 2012 at 10:21 PM, atul anand atul.87fri...@gmail.comwrote: @anika : i guess.if your concern is allowed then i dont think so we can solve this problem. On Tue, Jan 17, 2012 at 9:59 PM, Anika Jain anika.jai...@gmail.comwrote: hey, does

Re: [algogeeks] MYSIS AND DRISHTI-SOFT

2011-12-10 Thread Anika Jain
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. -- Regards Anika Jain

Re: [algogeeks] facebook interview question

2011-12-04 Thread Anika Jain
+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards Anika Jain -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks

Re: [algogeeks] Query: Function returning void pointer

2011-11-21 Thread Anika Jain
yes.. On Tue, Nov 22, 2011 at 1:23 PM, Aniket aniket...@gmail.com wrote: Can a function return a void pointer ? -- 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] Amazon Interview Question

2011-11-13 Thread Anika Jain
I think smallest will be having just one character . it can be a or b or c. On Sat, Nov 12, 2011 at 3:07 PM, Snoopy Me thesnoop...@gmail.com wrote: Given a string consisting of a,b and c's, we can perform the following operation: Take any two adjacent distinct characters and replace it with

[algogeeks] an os question

2011-11-13 Thread Anika Jain
You have written some code/program and delivered it to d customer. Now u dont have the source code with u. The program is not working fine at the customer's place. How will u catch the bug?(remember u dont have the source code wid u). This is an OS question. I dont know the answer. It was asked

Re: [algogeeks] Amazon Question

2011-11-13 Thread Anika Jain
its coming out be either 1 or 2 in all cases On Sun, Nov 13, 2011 at 1:55 PM, UTKARSH SRIVASTAV usrivastav...@gmail.comwrote: @Surinder give some proof or logic On Sun, Nov 13, 2011 at 10:25 AM, surender sanke surend...@gmail.comwrote: @nitin yes i meant the same, if each different

Re: [algogeeks] Re: Binary tree to BST

2011-11-06 Thread Anika Jain
@mohit: your algo will add assurance that the tree is balanced.. otherwise ankit's approach is sufficient. On Sat, Nov 5, 2011 at 8:49 PM, mohit verma mohit89m...@gmail.com wrote: another way is : convert binary tree to link list , sort the list and using divide and conquer approach create

Re: [algogeeks] c output

2011-10-29 Thread Anika Jain
yes 5 will be printed with 99 extra padding spaces. On Sat, Oct 29, 2011 at 4:16 PM, rahul sharma rahul23111...@gmail.comwrote: does y goes to d of %*d and it print 5???i hav a doubt On Fri, Oct 28, 2011 at 9:32 PM, amrit harry dabbcomput...@gmail.comwrote: let this statement int

Re: [algogeeks] Re: Inplace Array Convertion

2011-10-15 Thread Anika Jain
initial call to this function is arrange(arr,n/3,n/3) where n is actually 3*n as per the question , like n=30 for a1,...,a10,b1,...,b10,c1,c10 The idea used here is that for some i-1 ranging from 1 to 9 for above example, i-1 goes to 3*(i-1), n+i-1 to 3*(i-1) +1, and 2*n+i-1 to 3*(i-1)+2..

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

[algogeeks] Re: Amdocs

2011-10-02 Thread Anika Jain
hey sachin: amdocs is coming for job at wich location?? On Oct 2, 8:55 pm, gaurav yadav gauravyadav1...@gmail.com wrote: my number= +919939569122 gtalk id=gauravyadav1...@gmail.com -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to

[algogeeks] request for approval

2011-10-02 Thread Anika Jain
hello moderators n owners of this group. I have made a new id in gmail for my exclusive study on algogeeks. I sent a request for adding me but it got rejected. Can you please let me get added on this group by that id also , it is anika.jain...@gmail.com. If you want after getting permission on

[algogeeks] Re: Samsung campus visit

2011-10-02 Thread Anika Jain
package is 6lpa On Sep 28, 1:14 pm, sukran dhawan sukrandha...@gmail.com wrote: wats the package ? On Tue, Sep 27, 2011 at 9:08 PM, Nitin coolguyinat...@gmail.com wrote: C questions there are 12 -13 questions given on internet it will be same as it is given in the paper ,i dnt find a

[algogeeks] zigzag matrix

2011-10-02 Thread Anika Jain
for a N * M matrix is is possible to print zigzag fashion of that matrix? For example: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 i want print like 1 6 2 11 7 3 12 8 4 13 9 5 14 10 15 I am able to get this where N !=M.. How can i do this, ?? -- You received this message because you are

[algogeeks] Re: Amdocs

2011-10-02 Thread Anika Jain
hiii... ok i meant job offer is for Pune or NCR area ??if u knw.. On Oct 2, 11:29 pm, sachin goyal monugoya...@gmail.com wrote: h anika.amdocs in coming to thapar on 7 oct. On Sun, Oct 2, 2011 at 11:01 PM, Anika Jain anika.jai...@gmail.com wrote: hey sachin: amdocs

[algogeeks] zig zag

2011-10-02 Thread Anika Jain
only possible for continuous disctees attributes. -- 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: Make My Trip *URGENT*

2011-08-18 Thread Anika Jain
:06 pm, Anika Jain anika.jai...@gmail.com wrote: there will be 15 english fill in the blanks, 5 series questn, 10 aptitude questions, 10 logical questions.. then 10 c++ mcqs and 5 coding questions On Wed, Aug 17, 2011 at 5:28 PM, Brijesh Upadhyay brijeshupadhyay

Re: [algogeeks] De shaw ques!

2011-08-18 Thread Anika Jain
hey but 935*2+69 = 1939 and when this is divided by 38 remainder iscoming to be 1..i guess so.. is it ryt? On Wed, Aug 17, 2011 at 9:55 PM, aditya kumar aditya.kumar130...@gmail.comwrote: i guess if the option is provided it would have been an appropiate question . On Wed, Aug 17, 2011 at

Re: [algogeeks] Make My Trip *URGENT*

2011-08-17 Thread Anika Jain
there will be 15 english fill in the blanks, 5 series questn, 10 aptitude questions, 10 logical questions.. then 10 c++ mcqs and 5 coding questions On Wed, Aug 17, 2011 at 5:28 PM, Brijesh Upadhyay brijeshupadhyay...@gmail.com wrote: has anyone given MMT written test.?? please reply , what is

Re: [algogeeks] matrix question ???!!!!!!!!!!??????????

2011-08-16 Thread Anika Jain
i didnt get it tht even if there are distinct elements how scanning sum three lines return us the max n min elements? how will this scan whole matrix for finding the max n min elements??? On Wed, Aug 17, 2011 at 1:32 AM, priya ramesh love.for.programm...@gmail.com wrote: are these algos

Re: [algogeeks] Re: array question

2011-08-16 Thread Anika Jain
i cudnt understand how is it done here by using xor by chen.. aftergetting F it wud be the xor of of odd occuring elements, fine, then he wrote if(xor)A1 ==0 how is this logic used?? On Wed, Aug 17, 2011 at 8:17 AM, saurabh singh saurab...@gmail.com wrote: +1 to dave.xor is the way to

Re: [algogeeks] Re: Closest ancestor of two nodes

2011-08-15 Thread Anika Jain
node *common_ancestor(node *root, node **prev, int x,int y) { if(root-a==x || root-a==y) return *prev; else if(root-a x root-a y) { prev=root; return common_ancestor(root-l,prev, x,y); } else if(root-a x root-a

Re: [algogeeks] Adobe Interview Question

2011-08-15 Thread Anika Jain
i m sorry i cant understand the question.. if there are n no. steps to cross and he can take only one step at a time.. then suppose n=3 then obviously doesnt he need to take step 1 first then step 2 then step 3.. ?? m confused! On Sun, Aug 14, 2011 at 12:38 AM, Kamakshii Aggarwal

Re: [algogeeks] Doubt !!!!!!

2011-08-14 Thread Anika Jain
in the first code the output is 4 bcoz *p means *p[0] that means p[0] that is some address so for 32 bit machine its coming to be 4 bytes.. in the 2nd it is 80 as 20*sizeof(int *) and not as you mentioned.. On Sun, Aug 14, 2011 at 6:12 PM, rShetty rajeevr...@gmail.com wrote: Please explain this

Re: [algogeeks] Re: Printing a Number triangle

2011-08-14 Thread Anika Jain
plz tell me that for this triangle.. if 12 is given then what to do? On Sun, Aug 14, 2011 at 7:49 PM, muruga vel murugavidya1...@gmail.comwrote: I was asked to find out the no of rows given n . i.e. how we say 4 rows for 10 ??? On 14 Aug 2011 10:54, sagar pareek sagarpar...@gmail.com wrote:

Re: [algogeeks] Re: TRee question...

2011-08-13 Thread Anika Jain
@ashmantak: the figure of dipankar is incorrect but his point is correct.. for a tree like 4 /\ 2 10 / \ 13 successor of 3 shall be 4 not 2.. On Fri, Aug 12, 2011 at 4:48 PM, ashmantak

Re: [algogeeks] Re: TRee question...

2011-08-13 Thread Anika Jain
It is the solution for inorder successor without having parent pointer.. node *inorder_succ(node *root, int x) { node *prev=NULL; node *p=findspcl(root,prev, x); if(p-r) { p=p-r; while(p-l) p=p-l; return p;

Re: [algogeeks] what is mean by %2.3d in scanf

2011-08-13 Thread Anika Jain
@gaurav: nyc one ;) how u made this one well? On Sat, Aug 13, 2011 at 6:14 PM, SANDEEP CHUGH sandeep.aa...@gmail.comwrote: lol On Sat, Aug 13, 2011 at 6:12 PM, Gaurav Menghani gaurav.mengh...@gmail.com wrote: http://lmgtfy.com/?q=scanf+float+precision+format On Sat, Aug 13, 2011 at

Re: [algogeeks] output

2011-08-11 Thread Anika Jain
this code has so many errors On Thu, Aug 11, 2011 at 11:36 PM, manvir siyo manis...@gmail.com wrote: output of the program? #define prn(a) printf(%d,a) #define print(a,b,c) prn(a), prn(b), prn(c) #define max(a,b) (a main() { int x=1, y=2; print(max(x++,y),x,y); print(max(x++,y),x,y);

Re: [algogeeks] amazon

2011-08-10 Thread Anika Jain
i understand longest subsequence.. but what is longest increasing subsequence .. i dont know the difference between them..plz sumbody tel .. On Tue, Aug 9, 2011 at 9:41 AM, Akash Mukherjee akash...@gmail.com wrote: @udit : thanx man...they were really helpful 2 allcan u plzz chk d

Re: [algogeeks] amazon

2011-08-10 Thread Anika Jain
okk thanx On Wed, Aug 10, 2011 at 11:58 AM, sagar pareek sagarpar...@gmail.comwrote: like u have given array *1 2 3 4 5 7* 6 7 8 9 *1 2 3 4 5 6 *5 4 3 6 7 8 ans will be 6 On Wed, Aug 10, 2011 at 11:30 AM, Anika Jain anika.jai...@gmail.comwrote: i understand longest subsequence

Re: [algogeeks] Re: Microsoft written!!!

2011-08-09 Thread Anika Jain
@brijesh: if we have to find leftmost right cousin for 9 in the same tree.. then it shall be 8.. but 9 is in right subtree of 7.. On Tue, Aug 9, 2011 at 2:11 PM, Brijesh Upadhyay brijeshupadhyay...@gmail.com wrote: 10 4 5 2

Re: [algogeeks] Re: Microsoft written!!!

2011-08-09 Thread Anika Jain
ah.. my mistake sorry On Tue, Aug 9, 2011 at 9:24 PM, Anika Jain anika.jai...@gmail.com wrote: @brijesh: if we have to find leftmost right cousin for 9 in the same tree.. then it shall be 8.. but 9 is in right subtree of 7.. On Tue, Aug 9, 2011 at 2:11 PM, Brijesh Upadhyay brijeshupadhyay

Re: [algogeeks] reason?????????

2011-08-01 Thread Anika Jain
u save its output in a file and note nos. from 32676 to a large value 4294967295 are missing in this.. On Tue, Aug 2, 2011 at 12:59 AM, jagrati verma jagrativermamn...@gmail.comwrote: it is nt an infinite loop it ends at 4294967295 On Tue, Aug 2, 2011 at 12:53 AM, vijay goswami

Re: [algogeeks] Re: Interview ques

2011-07-31 Thread Anika Jain
what if we write that function as private of base class.. and make a function in derived class that is friend function of the base class do that it can call tht private function of base.?? On Sun, Jul 31, 2011 at 8:25 PM, muthu raj muthura...@gmail.com wrote: Yeah but there is no equivalent of

Re: [algogeeks] problem of structur

2011-07-31 Thread Anika Jain
In C default return type is int and as you havent given return type for f function compiler assumes it as int but u r not returning any integer from that function On Sun, Jul 31, 2011 at 8:33 PM, Rajesh Kumar testalgori...@gmail.comwrote: What is Error in This program??plzrply #includestdio.h

Re: [algogeeks] Odd one out

2011-07-31 Thread Anika Jain
@gopi: in 2nd of urs we after tree creation we will need to search each element in array that will take o(nlogn) time.. is there any appraoch tht reduces this? On Sun, Jul 31, 2011 at 6:39 PM, *$* gopi.komand...@gmail.com wrote: Q1-Construct a binary tree , in such a way that if element

Re: [algogeeks] Re: Interview ques

2011-07-31 Thread Anika Jain
being overridden in derived class. *Muthuraj R IV th Year , ISE PESIT , Bangalore* On Sun, Jul 31, 2011 at 8:04 AM, Anika Jain anika.jai...@gmail.comwrote: what if we write that function as private of base class.. and make a function in derived class that is friend function of the base class

[algogeeks] C++ urgent friend func doubt

2011-07-31 Thread Anika Jain
class B; class A { int a; public: int f2(){} friend int B::func(A ob); }; class B:public A { public: int func(A ob) { } }; why compilation error is coming over here for friend statement n forward protype declaration of class B ?? -- You received this message

Re: [algogeeks] Re: Interview ques

2011-07-31 Thread Anika Jain
and calling the version of f() that belong to derived class B .. ie is the same class object is calling the same class function . correct me if i m wrong . On Sun, Jul 31, 2011 at 8:42 AM, Anika Jain anika.jai...@gmail.comwrote: @ muthu : not declaring tht function as virtual wont save

Re: [algogeeks] Re: Interview ques

2011-07-31 Thread Anika Jain
overriding redefining virtual function.. Well then as per this definition not defining the func as virtual is nt the solution.. On Sun, Jul 31, 2011 at 10:04 PM, aditi garg aditi.garg.6...@gmail.comwrote: @ Ankit: Wat is overriding actually thn? On Sun, Jul 31, 2011 at 9:58 PM, Anika Jain

Re: [algogeeks] Re: Interview ques

2011-07-31 Thread Anika Jain
sorry overriding is redifining virtual function On Sun, Jul 31, 2011 at 10:05 PM, Anika Jain anika.jai...@gmail.com wrote: overriding redefining virtual function.. Well then as per this definition not defining the func as virtual is nt the solution.. On Sun, Jul 31, 2011 at 10:04 PM, aditi

Re: [algogeeks]

2011-07-29 Thread Anika Jain
this is the recursive code..Iterative does any1 know? On Thu, Jul 28, 2011 at 7:58 AM, ambika iyer balu200...@gmail.com wrote: @tushar : thnx!! On Thu, Jul 28, 2011 at 8:11 PM, Tushar Bindal tushicom...@gmail.comwrote: it should be O(n) where n is number of nodes as we get into the

Re: [algogeeks] rotate a matrix NVIDIA question

2011-07-27 Thread Anika Jain
is it lyk for {1,2,3 4,5,6, 7,8,9} to be {3,2,1, 6,5,4, 9,8,7}?? On Wed, Jul 27, 2011 at 9:37 AM, Deoki Nandan deok...@gmail.com wrote: rotate a 2D matrix by angle 180 -- **With Regards Deoki Nandan Vishwakarma * * -- You

Re: [algogeeks] Small Doubt

2011-07-27 Thread Anika Jain
no we cant.. coz when we do say int *p=4000; its fine till now.. and if we do *p=10; it is segmentation fault.. On Wed, Jul 27, 2011 at 10:35 PM, rShetty rajeevr...@gmail.com wrote: Usually when I declare a variable it will be stored in memory location with some address . Such as consider I

Re: [algogeeks] Small Doubt

2011-07-27 Thread Anika Jain
program. On Wed, Jul 27, 2011 at 11:26 PM, Puneet Gautam puneet.nsi...@gmail.comwrote: @Anika : pls elaborate the segmentatin part...! On 7/27/11, Anika Jain anika.jai...@gmail.com wrote: no we cant.. coz when we do say int *p=4000; its fine till now.. and if we do *p=10; it is segmentation

Re: [algogeeks] Nagarro Coding Round Ques......

2011-07-26 Thread Anika Jain
int palin(char *p) { int x=0; while(*p) { x^=1(*p-'a'); p++; } int i=0,count=0; while(i26) { count+=(1i x)i; i++; } if(count1) return 0; else return 1; } -- You received this message because you are

Re: [algogeeks] C output

2011-07-26 Thread Anika Jain
a is a pointer to somewhere where string is written.. p is a pointer to somewhere where new sring is written. temp is made to point at same location to which a is currently pointing that is at string by malloc some new memory is alloted and a is made to point to thast memory.. temp remains to

Re: [algogeeks] output plzz

2011-07-23 Thread Anika Jain
in this in scanf one,two, four five will b thr, no thr.. and sumbody plz tell afterwards this change why the o/p is this is 10 times charlie thisis10charlie why in 'four' empty string is going?? On Sat, Jul 23, 2011 at 9:37 PM, geek forgeek geekhori...@gmail.com wrote: #includestdio.h

Re: [algogeeks] Adobe ques

2011-07-21 Thread Anika Jain
\n); else printf(big endian\n); } On Thu, Jul 21, 2011 at 3:53 AM, Piyush Sinha ecstasy.piy...@gmail.comwrote: @Anika..can u give one example?? On 7/21/11, Anika Jain anika.jai...@gmail.com wrote: write a c code that takes a 32 bit ip address n prints it in dotted notation

Re: [algogeeks] Adobe ques

2011-07-21 Thread Anika Jain
sorry its 32 bit no. not 323..wrote tht by mistake On Thu, Jul 21, 2011 at 1:57 PM, Anika Jain anika.jai...@gmail.com wrote: @piyush: lets say 323 bit integer given is the one with its binary as 1110 00011000 0101 00110011 then output shall be 14.24.65.51 both for little as well

Re: [algogeeks] Adobe ques

2011-07-21 Thread Anika Jain
thanx all :) On Thu, Jul 21, 2011 at 2:26 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote: http://www.ideone.com/4Rq51 -- *Piyush Sinha* *IIIT, Allahabad* *+91-7483122727* * https://www.facebook.com/profile.php?id=10655377926 NEVER SAY NEVER * -- You received this message

[algogeeks] Adobe ques

2011-07-20 Thread Anika Jain
write a c code that takes a 32 bit ip address n prints it in dotted notation as a.b.c.d. The code shall work for big endian as well as for little endian.. In this how can i make it common for big endian and little endian?? if in little endian my lower order 8 bits shall be d but for big endian

Re: [algogeeks] interview question

2011-07-19 Thread Anika Jain
here T becomes char *.. u r trying to add two addreses here... On Tue, Jul 19, 2011 at 9:46 PM, nidhi jain nidhi.jain311...@gmail.comwrote: Consider a c++ template funtion templateclass T T Add(T a, T b) {return a+b ;} if this function is called as T c = Add(SAM, SUNG); what will happen?

Re: [algogeeks] Reverse a List with Recursion

2011-07-17 Thread Anika Jain
node *listing::rev(node *p) { if(p-next==NULL) { head=p; return p; } else { node *t=rev(p-next); t-next=p; p-next=NULL; tail=p; return p; } } On Sun, Jul 17, 2011 at 3:21 PM, Nishant Mittal

Re: [algogeeks] Reverse a List with Recursion

2011-07-17 Thread Anika Jain
initial call to this will be rev(head); On Sun, Jul 17, 2011 at 4:28 PM, Anika Jain anika.jai...@gmail.com wrote: node *listing::rev(node *p) { if(p-next==NULL) { head=p; return p; } else { node *t=rev(p-next); t-next=p; p

[algogeeks] c++ probs

2011-07-16 Thread Anika Jain
Q.1 what is the output of following program? #include iostream using namespace std; class A { public: A() { coutConstructing Aendl; } ~A() { coutDestructing Aendl; } }; class B : public A { public: B()

Re: [algogeeks] c code bst mirror prob

2011-07-14 Thread Anika Jain
locally. Since you are using c++, make the following changes. void swap*(node* p,node* q)* { node *t; t=p; p=q; q=t; } Regards, Sandeep Jain On Thu, Jul 14, 2011 at 1:45 AM, Anika Jain anika.jai...@gmail.comwrote: n sorry i have wriiten it in c++ not c.. On Thu

Re: [algogeeks] C output

2011-07-14 Thread Anika Jain
compilation error lvalue required coz on lhs of ++*b=++*b is not a variable but a value On Thu, Jul 14, 2011 at 11:58 AM, abhishek kumar mailatabhishekgu...@gmail.com wrote: hi friends, i have a doubt about this code. what will be its output and how. int a=35,*b; b=a; ++*b=++*b; --

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 kavithan...@gmail.com wrote: ya i too think de same... //BE COOL// kavi -- You received this

Re: [algogeeks] Re: Adding w/o +

2011-07-13 Thread Anika Jain
a better idea is use this: int a=9,b=4; int sum=printf(%*s%*s,a,,b,); printf(%d\n,sum); On Wed, Jul 13, 2011 at 1:52 PM, nicks crazy.logic.k...@gmail.com wrote: if someone has better idea...then please suggest that. plz explain how this is calculating sum -- sum= (int)p[b]; On Wed,

Re: [algogeeks] c doubt

2011-07-13 Thread Anika Jain
binary equivalent of 5.2 is 101.0011001100110011001100110011(nonterminating).. now it is actually stored in normalised frorm in 32 bits.. like this --1 bit for sign8 bits for exponent-23 bits for fraction-- this is from higher order byte to lower order for little endian..

Re: [algogeeks] Re: Adding w/o +

2011-07-13 Thread Anika Jain
...@gmail.comwrote: Can you explain how its working? On Wed, Jul 13, 2011 at 1:58 PM, Anika Jain anika.jai...@gmail.com wrote: a better idea is use this: int a=9,b=4; int sum=printf(%*s%*s,a,,b,); printf(%d\n,sum); On Wed, Jul 13, 2011 at 1:52 PM, nicks crazy.logic.k...@gmail.com

Re: [algogeeks] Re: Adding w/o +

2011-07-13 Thread Anika Jain
@ vaibhav: ohh sorry, ya its leaving the columns.. so we can do int a=9,b=4; int sum=printf(%*s%*s,a,,b,); printf(\r%d\n,sum); On Wed, Jul 13, 2011 at 6:09 PM, Anika Jain anika.jai...@gmail.com wrote: @vaibhav: no it wont coz its printing empty strings.. nothing will be printed On Wed, Jul

Re: [algogeeks] c doubt

2011-07-13 Thread Anika Jain
sorry its 0100 not 1100 coz 5.2 is a positive no. so sign bit is 0 On Wed, Jul 13, 2011 at 7:58 PM, Piyush Kapoor pkjee2...@gmail.com wrote: Shouldn't the value of 1100 be -64 On Wed, Jul 13, 2011 at 4:53 PM, Anika Jain anika.jai...@gmail.comwrote: binary equivalent of 5.2

[algogeeks] ink list rem dups

2011-07-13 Thread Anika Jain
how to remove duplicates from a linked list?? is it mandatory to sort the list first?l -- 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

Re: [algogeeks] c doubt

2011-07-13 Thread Anika Jain
is the order of numbers reversed? On Wed, Jul 13, 2011 at 8:07 PM, Anika Jain anika.jai...@gmail.comwrote: sorry its 0100 not 1100 coz 5.2 is a positive no. so sign bit is 0 On Wed, Jul 13, 2011 at 7:58 PM, Piyush Kapoor pkjee2...@gmail.comwrote: Shouldn't the value of 1100 be -64

Re: [algogeeks] c doubt

2011-07-13 Thread Anika Jain
at 10:18 PM, Anika Jain anika.jai...@gmail.comwrote: it is not unsigned its signed but positive thts y it is 0.. the order isnt reversed.. look at the code, the code 1st prints lowest order byte then next and then next and then highest soo output is 102 102 -90 64 On Wed, Jul 13, 2011 at 8:08

[algogeeks] c code bst mirror prob

2011-07-13 Thread Anika Jain
can some body tell me that: void swap(node *p,node *q) { node *t; t=p; p=q; q=t; } void mirror(node *p) { if (p==NULL) return; else {mirror(p-r); mirror(p-l); swap(p-r,p-l); } } in this the swapping is occuring but if i do : void

Re: [algogeeks] c code bst mirror prob

2011-07-13 Thread Anika Jain
by using swap function is pointer to a pointer used then?? On Thu, Jul 14, 2011 at 1:36 AM, Piyush Kapoor pkjee2...@gmail.com wrote: u need a pointer to a pointer to swap the pointers... On Thu, Jul 14, 2011 at 1:21 AM, Anika Jain anika.jai...@gmail.comwrote: can some body tell me

Re: [algogeeks] c code bst mirror prob

2011-07-13 Thread Anika Jain
n sorry i have wriiten it in c++ not c.. On Thu, Jul 14, 2011 at 1:44 AM, Anika Jain anika.jai...@gmail.com wrote: by using swap function is pointer to a pointer used then?? On Thu, Jul 14, 2011 at 1:36 AM, Piyush Kapoor pkjee2...@gmail.comwrote: u need a pointer to a pointer to swap

Re: [algogeeks] c doubt

2011-07-13 Thread Anika Jain
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 of floats exponent is stored as exponent +127 i.e here 2 +127 so we get 1001

Re: [algogeeks] Re: sbtration

2011-07-12 Thread Anika Jain
awesum :) thanx all On Tue, Jul 12, 2011 at 8:27 PM, bittu shashank7andr...@gmail.com wrote: Lets Try For Decimal Integer Number how we add them 1 Add 759 + 674, but “forget” to carry I then get 323 2 Add 759 + 674 but only do the carrying, rather than the addition of each digit I then

Re: [algogeeks] Re: remove duplicate chars in a string without using extra memory

2011-07-11 Thread Anika Jain
A c code for this is: int main() { int a[2] = {0}; char str[50]; int i,ind=0; scanf (%s, str); for(i=0;istrlen(str);i++) { if(str[i]='a' str[i]='z') { if(!(a[0] 1str[i]-'a')) { a[0] = a[0] | 1str[i]-'a';

[algogeeks] linked list doubt

2011-07-11 Thread Anika Jain
*if i have to write a code for finding middle element in a linked list.. then for even length linked which will be the middle element both n/2-1 and n/2+1 or just n/2+1??? if its both then how can i make my function two elements?? * -- You received this message because you are subscribed to the

Re: [algogeeks] Re: remove duplicate chars in a string without using extra memory

2011-07-11 Thread Anika Jain
YA.. N YA M USING 2 VARIABLES.. IS IT ALLOWED? On Mon, Jul 11, 2011 at 4:58 PM, saurabh singh saurab...@gmail.com wrote: A similar solution has been proposed above if I am not misinterpreting the code,You are creating a bitmap from the 2 variables.? On Mon, Jul 11, 2011 at 4:55 PM, Anika

Re: [algogeeks] Re: remove duplicate chars in a string without using extra memory

2011-07-11 Thread Anika Jain
@sandeep sir: i didnt get it how is it takin o(n^2) ?? On Mon, Jul 11, 2011 at 5:18 PM, Sandeep Jain sandeep6...@gmail.com wrote: Anika, look closely. Your code takes O(N^2) instead of O(N) Regards, Sandeep Jain On Mon, Jul 11, 2011 at 5:15 PM, Anika Jain anika.jai...@gmail.comwrote

Re: [algogeeks] Re: remove duplicate chars in a string without using extra memory

2011-07-11 Thread Anika Jain
ohh ok! got it! On Mon, Jul 11, 2011 at 8:05 PM, Sandeep Jain sandeep6...@gmail.com wrote: Hint: What is the time complexity of strlen?? Regards, Sandeep Jain On Mon, Jul 11, 2011 at 8:00 PM, Anika Jain anika.jai...@gmail.comwrote: @sandeep sir: i didnt get it how is it takin o(n^2

[algogeeks] sbtration

2011-07-11 Thread Anika Jain
how to do subtraction of two integers widout using subtractn?? -- 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] solve this

2011-07-06 Thread Anika Jain
93747 On Wed, Jul 6, 2011 at 5:05 AM, anurag aggarwal anurag19aggar...@gmail.comwrote: 93747 On Wed, Jul 6, 2011 at 5:28 PM, rupali chauhan chauhanrupal...@gmail.comwrote: Solve Dis! A Boy Forgot His Pin-Code Which Was Of 5 Digits, But Luckily He Remembered Some Hints How To 2 Remind

Re: [algogeeks] find output

2011-07-04 Thread Anika Jain
in this actually whats happening is : int i=0; while((i--)!=0) i-=i++; printf(%d\n,i); here when i is compared to 0 i is 0 and then it is decremented to -1, while loop never gets executed. On Mon, Jul 4, 2011 at 3:54 PM, amit the cool amitthecoo...@gmail.comwrote: main() { int i=0;

Re: [algogeeks] Re: 2 D array(dynamic allocation)

2011-07-01 Thread Anika Jain
do we need to add m in each a[i]?? shudnt it be a[i] = a+ n*i?? i think i m doing a silly mistake.. bt plz tell me.. On Thu, Jun 30, 2011 at 7:41 AM, Dave dave_and_da...@juno.com wrote: @Rizwan: Not completely. What if ROW in your code is a variable (not a constant) that is not known until run

Re: [algogeeks] Longest substring 0's 1's

2011-07-01 Thread Anika Jain
@sunny: in a[2,4] has 2 1s and one 0 then how is it a solution? i mean i didnt get wen a[i]==a[j] then a[i,j] is a solution case.. On Fri, Jul 1, 2011 at 4:13 PM, sunny agrawal sunny816.i...@gmail.comwrote: Take an array of size of the length of the string. fill the array positions with one

Re: [algogeeks] Longest substring 0's 1's

2011-07-01 Thread Anika Jain
] then it means sum does not changes between a[i] to a[j] so from i+1 to j there are equal no of 1's and -1's or in other words equal no of 0's and 1's On Sat, Jul 2, 2011 at 12:42 AM, Anika Jain anika.jai...@gmail.comwrote: @sunny: in a[2,4] has 2 1s and one 0 then how is it a solution? i mean i

[algogeeks] preprocessor query

2011-06-29 Thread Anika Jain
#define FUN(a,b,c)c t; t=a;a=b;b=t; int main() { int a=2,b=3; int *x,*y; x=a,y=b; FUN(x,y,int *); printf(%d %d \n,a,b); return 0; } why doesnt this macro swap pointers wen it can work for variables?? -- You received this message because you are subscribed to the

Re: [algogeeks] query

2011-06-29 Thread Anika Jain
hey, printf(%d ya %u in both same error cming.. On Wed, Jun 29, 2011 at 5:10 PM, sunny agrawal sunny816.i...@gmail.comwrote: Because u copied the code i think :P try writing printf statement yourself again :) On Wed, Jun 29, 2011 at 5:05 PM, Anika Jain anika.jai...@gmail.comwrote: int main

Re: [algogeeks] without sizeof

2011-06-24 Thread Anika Jain
, 2011 at 2:09 AM, vaibhav shukla vaibhav200...@gmail.comwrote: here is the generalized way #includestdio.h #define SIZEOF(var) (size_t)(var+1) - (size_t)(var) main() { double x; printf(The size of x is %d\n,SIZEOF(x)); return 0; } On Fri, Jun 24, 2011 at 1:35 AM, Anika Jain anika.jai

Re: [algogeeks] [Brain Teaser] Sherlock puzzle 24 June

2011-06-24 Thread Anika Jain
she died out of shock or heart attack.. On Fri, Jun 24, 2011 at 12:46 PM, Vishal Thanki vishaltha...@gmail.comwrote: she got killed because of suffocation :P On Fri, Jun 24, 2011 at 12:35 PM, Lavesh Rawat lavesh.ra...@gmail.com wrote: sherlock puzzle Solution - 24 june A wife and her

  1   2   >