Re: [algogeeks] OUTPUT

2011-07-25 Thread sameer.mut...@gmail.com
eft evaluation of printf i shud > be left shifted by 1 bit wgich shud make it 2 ?? > > > On Mon, Jul 25, 2011 at 10:28 AM, sameer.mut...@gmail.com < > sameer.mut...@gmail.com> wrote: > >> yeah output >> 0 >> 1 1 >> *is dis because of side effect

Re: [algogeeks] OUTPUT

2011-07-25 Thread sameer.mut...@gmail.com
yeah output 0 1 1 *is dis because of side effect? * * * * * *Muthuraj R. 4TH Year BE.** Information Science Dept* *PESIT, Bengaluru . * On Mon, Jul 25, 2011 at 10:49 PM, Deoki Nandan wrote: > run on gcc compiler it would be > 0 > 1 1 > > > On Mon, Jul 25, 2011 at 10:35 PM, geek forgeek wrote

Re: [algogeeks] C question

2011-07-25 Thread sameer.mut...@gmail.com
f(20,1)->f(10,2)-1-> f(5,4)-2 ->f(2,8) +4 -> f(1,16)-8 -> f(0,32) +16->return 0 10-1=9 < 12-2=10 <- 8+4=12< 16-8=8 < 0+16 <- - *Muthuraj R. 4TH Year BE.** Information Science Dept* *PESIT, Bengaluru

Re: [algogeeks] C ouput

2011-07-25 Thread sameer.mut...@gmail.com
On 7/25/11, private.joker wrote: > I guess I got that. > (&a + 1) increments the pointer to the array(&a here) according to the size > of array where as p, being a pointer to an int gets incremented by the size > of int(4 byte in 32 bit compiler) with the statement p = p+1 > > Correct me if i am w

Re: [algogeeks] output plzz

2011-07-23 Thread sameer.mut...@gmail.com
strings are defined. *Muthuraj R. 4TH Year BE.** Information Science Dept* *PESIT, Bengaluru . * On Sat, Jul 23, 2011 at 11:34 PM, Anurag atri wrote: > Dev c++ , which one are you using ? > > On Sun, Jul 24, 2011 at 12:01 PM, sameer.mut...@gmail.com < > sameer.mut...@gmail.com&

Re: [algogeeks] output plzz

2011-07-23 Thread sameer.mut...@gmail.com
No. Its not coming like dat. This is 10 times charlie Thisis10charlie This is the output *Muthuraj R. 4TH Year BE.** Information Science Dept* *PESIT, Bengaluru . * On Sat, Jul 23, 2011 at 11:23 PM, shady wrote: > it is not coming like that ? > > > On Sun, Jul 24, 2011 at 11:41 AM, Anu

Re: [algogeeks] output plzz

2011-07-23 Thread sameer.mut...@gmail.com
@Anurag: May i know which compiler gave you the above output? *Muthuraj R. 4TH Year BE.** Information Science Dept* *PESIT, Bengaluru . * On Sat, Jul 23, 2011 at 11:11 PM, Anurag atri wrote: > The output will be > This is 10 times charlie > Thisis10timescharlie > > and it makes sense ,

Re: [algogeeks] output plzz

2011-07-23 Thread sameer.mut...@gmail.com
Declare the character strings char five[7]; char four[7]; int three; char two[7]; char one[7]; int his order and we get the correct output. But i dont know y?Its something to do with Memory location where the strings are defined. *Muthuraj R. 4TH Year BE.** Information Science Dept* *PES

Re: [algogeeks] output plzz

2011-07-23 Thread sameer.mut...@gmail.com
@shady: yes its a good idea to have aptitude puzzles etc in other group On Sat, Jul 23, 2011 at 8:29 AM, shady wrote: > nice idea Saurabh, but i don't think much people will join that group too, > and the difference should be on the basis of type of questions asked. Any > suggestions from others

Re: [algogeeks] C - pre & post increment

2011-07-21 Thread sameer.mut...@gmail.com
i tried in gcc of Ubuntu and its working fineits not goin infinite ... On Thu, Jul 21, 2011 at 6:44 AM, Aman Goyal wrote: > I think it is kind of illegal to use it, cos i tried this code on gcc > compiler oof ubuntu(code b) and the result is infinite loop, which doesnt go > with our logic at

[algogeeks] EXPLAIN THE OUTPUTS

2011-07-19 Thread sameer.mut...@gmail.com
#include int * fun(int a1,int b) { int a[2]; a[0]=a1; a[1]=b; //int c=5; printf("%x\n",&a[0]); return a; } int main() { int *r=fun(3,5); printf("%d\n",r[0]); printf("%d\n",r[0]); } -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] Re: Reverse a List with Recursion

2011-07-17 Thread sameer.mut...@gmail.com
@Navneet: Its not possible to solve this without a single tail pointer. I have come across this question saying it requires a single pointer and that pointer is the tail pointer. So along with head you need a tail pointer or a global pointer. Otherwise cannot keep track of header for reversed lis

Re: [algogeeks] Microsoft Qn: Algo to find the border of a binary tree

2011-07-16 Thread sameer.mut...@gmail.com
@sagar: The question says Algo should be in place. So use of an array to print the right border of tree is not advisable. We can do it recursively without using an array also . On Sat, Jul 16, 2011 at 10:48 PM, sameer.mut...@gmail.com < sameer.mut...@gmail.com> wrote: > @sagar: There is

Re: [algogeeks] Microsoft Qn: Algo to find the border of a binary tree

2011-07-16 Thread sameer.mut...@gmail.com
@sagar: There is one flaw in the code. Trace ur code 15 and 250 get printed twice. otherwise it is fine. On Sat, Jul 16, 2011 at 7:59 PM, sukhmeet singh wrote: > please explain the code a bit more.. unable to understand it..an example > will be better.. > > > On Sun, Jul 17, 2011 at 7:10 AM, Reyn

Re: [algogeeks] C Output

2011-07-13 Thread sameer.mut...@gmail.com
1st problem format specifier is %d whereas memory is allocated only for short int memory allocated-2bytes. but being stored in 4bytes. so a is overwritten by b. In dis case where u give a=1, b=1, a becomes become 0. n so it gives:0+1=1 in d scanf if u use %hd instead u ll get d right output!! O

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

2011-07-13 Thread sameer.mut...@gmail.com
Guys i always have this doubt.Please tell me whether stack frames allocated for each recursive call will be cleared if we return in the middle of a recursive call? On Tue, Jul 12, 2011 at 10:22 PM, Don wrote: > // Similar to other suggestions, but without tail recursion. > > ptr search(ptr root,

Re: [algogeeks] microsoft ques

2011-07-12 Thread sameer.mut...@gmail.com
@kranthi : d solution u ve given is only for 2 continuous elements.. wr as d question doesnt limit it to 2.. It can be d product of any no. of continuous elements. So if the array is 200, 5, -2, -3, -1 den ans shd be 200*5*-2*-3 = 6000 N if m workin ur algo in d right way, den it ll give 1000 On

Re: [algogeeks] c doubt

2011-07-04 Thread sameer.mut...@gmail.com
Continuous memory allocation is used for 2-d array. So a[2][5] will assign 10 continuous memory spaces. Hello will be stored on the 1st 5 spaces. Hi will be saved on the next 2 consecutive spaces itself. There is no null character saved for the 1st string so while printing it prints until it finds

Re: [algogeeks] c doubt

2011-07-04 Thread sameer.mut...@gmail.com
The meaning of 0 is being escaped, it now represents Octal and the following digits are taken to be an octal number. Ascii equivalent of the octal no. is being taken as a character. Ascii equivalent of octal no. 61 is 1. So it takes it to be 4 characters.. S,1,A,B Another example would be.. #incl

Re: [algogeeks] GATE 2011 C Ques

2011-07-02 Thread sameer.mut...@gmail.com
ASCII value of 'A' is 65 and Asciivalue of 'E' is 69. 69-65=4 On Sat, Jul 2, 2011 at 7:12 PM, abhijith reddy wrote: > p[3] = 'E' > p[1] = 'A' > p[3]-p[1] = 4 > ? > > > On Sat, Jul 2, 2011 at 7:10 PM, KK wrote: > >> 10. What does the following fragment of C-program print? >> >> char c[] = "GATE20

Re: [algogeeks] Re: help..

2011-07-02 Thread sameer.mut...@gmail.com
n&n-1 is the expression to find out if n is a power of 2...If n&n-1 returns 0 its a power of 2 else its not. And what sunny said is also ryt On Sat, Jul 2, 2011 at 3:47 PM, sunny agrawal wrote: > @cegprakash > Expression resets the least significant set bit > > > On Sat, Jul 2, 2011 at 3:20

[algogeeks] Delete a node in a BST!!

2011-07-01 Thread sameer.mut...@gmail.com
how to Delete a node in a BST. Handle All Test cases. -- 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...@google

Re: [algogeeks] Re: Test Cases

2011-07-01 Thread sameer.mut...@gmail.com
@hemanth: doing it in seperate for loops or in a single for loop both results in O(n) time.It does not make a difference. I think there cannot be a solution better than O(n) as we need to traverse the array atleast once. On Fri, Jul 1, 2011 at 12:57 PM, Hemanth Sagar wrote: > The most effici

Re: [algogeeks] Re: output plzz

2011-06-28 Thread sameer.mut...@gmail.com
We are getting same output because in this problem we wre typecastin unsigned integer to a signed integer...Hence normal operation results. On 6/28/11, Kamakshii Aggarwal wrote: > #include > > int main() > { > > int array[] = {23,34,12,17,204,99,16}; > int TOTAL_ELEMENTS =(sizeof(array) / sizeof(

Re: [algogeeks] Re: c query

2011-06-28 Thread sameer.mut...@gmail.com
its tryin to acess arr[3] which is not defined and nullhence it is giving null and priniting default value 0.000.arr[2[ is only the last defined array of structure. On Tue, Jun 28, 2011 at 12:07 PM, udit sharma wrote: > I think this is also a compiler dependent program.. > Bcz if u run d

Re: [algogeeks] Reverse

2011-06-27 Thread sameer.mut...@gmail.com
guys temporary variable means not to store string in another variable. On Mon, Jun 27, 2011 at 10:37 PM, hary rathor wrote: > @vishal : dont you think that , i is also a variable? > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > T

Re: [algogeeks] Product of N numbers - with Constraints

2011-06-26 Thread sameer.mut...@gmail.com
#include using namespace std; int main() { int input[10]; int n; cout<<"enter n"<>n; int output[10]; cout<<"enter input array"<>input[i]; int a[n],b[n]; a[0]=1; for(int i=1;i=0;i--) { b[i]=b[i+1]*input[i+1]; } for(int i=0;i wrote: > Given an array A , o

Re: [algogeeks] strange output

2011-06-25 Thread sameer.mut...@gmail.com
It breaks out correctly when test condition value is 0 i.e when value of t is 1 On Sat, Jun 25, 2011 at 4:41 PM, sunny agrawal wrote: > No, Read about the return type of scanf > > > On Sun, Jun 26, 2011 at 4:56 AM, amit the cool wrote: > >> main() >> { >> int i,t; >> for ( t=4;scanf("%d",&i)-

Re: [algogeeks] char *arr and char arr[]

2011-06-25 Thread sameer.mut...@gmail.com
May i know the reason please? On Sat, Jun 25, 2011 at 1:06 PM, hary rathor wrote: > sol 1 : > > #include > using namespace std; > int main(){ >char arr[]="Pilani",*p=arr; > p[0]='K';// does not work. > *(&p[0])='s'; //does not work; >cout } > > sol 2 : > #include > usin