Re: [algogeeks] Re: Array doubt

2011-07-30 Thread Kamakshii Aggarwal
@nivedita:ohhh :P On Sun, Jul 31, 2011 at 1:46 AM, nivedita arora wrote: > that is why i gave BST algo first :) > but rahul wanted me to give O(n) algo > > On Jul 31, 1:15 am, Kamakshii Aggarwal wrote: > > @nivedita :hashing will not work if the range of nos is high >

Re: [algogeeks] Output Help.

2011-07-30 Thread Kamakshii Aggarwal
http://ideone.com/bJBGl >>> >>> <http://ideone.com/bJBGl> >>> >>> On Sun, Jul 31, 2011 at 1:38 AM, aditi garg >>> wrote: >>> >>>> it would be undefined... >>>> >>>> On Sun, Jul 31, 2011 at 1:34 AM,

Re: [algogeeks]

2011-07-30 Thread Kamakshii Aggarwal
s helps > > > On Sun, Jul 31, 2011 at 1:35 AM, gaurav gupta wrote: > >> so u mean der is difference between a and a[0] >> >> >> On Sun, Jul 31, 2011 at 1:30 AM, Kamakshii Aggarwal < >> kamakshi...@gmail.com> wrote: >> >>> &a points to th

Re: [algogeeks] Re: Array doubt

2011-07-30 Thread Kamakshii Aggarwal
@nivedita :hashing will not work if the range of nos is high On Sun, Jul 31, 2011 at 1:40 AM, nivedita arora wrote: > ok lets think in terms of hashmap of number and frequency > we definitly have to maintain an order array . > traverse original array , we check if its present in hashmap ..if no

Re: [algogeeks] Output Help.

2011-07-30 Thread Kamakshii Aggarwal
oh sorry,mane galat pad lia..mane sirf b++ dekha... it is compiler dependent.value of b is changing twice b/w two serial points On Sun, Jul 31, 2011 at 1:37 AM, aseem garg wrote: > @Kamakshi: Run karke dekh leti pehle. :-/ > Aseem > > > > On Sun, Jul 31, 2011 at 1:34 AM,

Re: [algogeeks] Re: Array doubt

2011-07-30 Thread Kamakshii Aggarwal
@neeraj:deleting after printing will adds to complexity.. On Sun, Jul 31, 2011 at 1:34 AM, Neeraj Gupta wrote: > Create a balance BST. > Maintain counter. Whenever You hit duplicate increase the counter while > inserting. > O(nlogn) for creating it and O(N) space. > Now while traverse the array.

Re: [algogeeks] Output Help.

2011-07-30 Thread Kamakshii Aggarwal
3.it is same as b=b+1; On Sun, Jul 31, 2011 at 1:32 AM, aseem garg wrote: > int b=2;b=b++; > b=??? > > Plz explain.. > Aseem > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroup

Re: [algogeeks]

2011-07-30 Thread Kamakshii Aggarwal
&a points to the array.so when u increment it by 1 it will get incremented by the size of array. On Sun, Jul 31, 2011 at 1:28 AM, gaurav gupta wrote: > &a+1 takes to the last element of the array bt is the logic behind dis > > > On Sun, Jul 31, 2011 at 1:25 AM, Kamaksh

Re: [algogeeks]

2011-07-30 Thread Kamakshii Aggarwal
&a+1 will point to the next array(i.e it will skip the whole array) where as &(a+1)will print address of element 2. On Sun, Jul 31, 2011 at 1:21 AM, Sanchit Manchanda wrote: > Sorry my bad. I was wrong. > > On Sun, Jul 31, 2011 at 1:15 AM, gaurav gupta wrote: > >> main() >> { >> int a[5]={1,2,3,4

Re: [algogeeks] Decimal to any base

2011-07-29 Thread Kamakshii Aggarwal
it is selecting ' m 'th word from the string.. On Sat, Jul 30, 2011 at 3:06 AM, aditi garg wrote: > int main() > { decimal_to_anybase(10, 2); > decimal_to_anybase(255, 16); > getch(); } > decimal_to_anybase(int n, int base) > { int i, m, digits[1000], flag; i=0; > printf("\n\n[%d] converted t

Re: [algogeeks] static array

2011-07-29 Thread Kamakshii Aggarwal
yes it works for arrays also On Fri, Jul 29, 2011 at 10:11 PM, sabitha k wrote: > i thought only static variables will be set zero. Even for array too this > works? > -- > *sabitha* > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > T

Re: [algogeeks] Re:

2011-07-28 Thread Kamakshii Aggarwal
in dev c++ o/p is -1...since u r accessing array out of bounds it will give garbage value On Fri, Jul 29, 2011 at 2:30 AM, aditi garg wrote: > I guess its because u have declared the array as static... > > > On Fri, Jul 29, 2011 at 2:25 AM, Rajeshwar Patra > wrote: > >> @nitish plz try out on gc

[algogeeks] generic pointer and void pointer

2011-07-28 Thread Kamakshii Aggarwal
What is the difference between generic pointer and void pointer? both are declared as void *ptr; -- Regards, Kamakshi kamakshi...@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@goog

[algogeeks] permutation of string with repeated characters...

2011-07-27 Thread Kamakshii Aggarwal
how to find all permutations of string with repeated characters.like aabc. -- Regards, Kamakshi kamakshi...@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 unsubs

Re: [algogeeks] Re: Amazon Question

2011-07-27 Thread Kamakshii Aggarwal
in the above example y ac is not included in the substring? On Wed, Jul 27, 2011 at 3:45 PM, saurabh singh wrote: > hmm o(nlogn) was for constructing the tree.Btw sorry for being unclear. > The best solution is the obvious one in this case. > > > On Wed, Jul 27, 2011 at 2:10 PM, surender sanke w

Re: [algogeeks] Re: OUTPUT

2011-07-27 Thread Kamakshii Aggarwal
@abhinav:thanks.:) On Wed, Jul 27, 2011 at 9:23 PM, Abhinav Arora wrote: > Look we wish to allocate memory for an array of 3 integer pointers. > so when we do dynamic allocation we always store the result in a pointer to > the required data type. > for example if you wish to dynamically allocate

Re: [algogeeks] Re: MS c output ques

2011-07-27 Thread Kamakshii Aggarwal
but what input did u give?? if u r giving i/p as siva o/p will be s only On Wed, Jul 27, 2011 at 1:24 AM, aditi garg wrote: > @rajeev > i ran dis code > int main() > { > > char str[80]; > strcpy(str,"siva"); > scanf("%[^india]",str); > printf("%s",str); > return 0; > > > } > and i got the output

Re: [algogeeks] Re: OUTPUT

2011-07-27 Thread Kamakshii Aggarwal
i am not getting any of the ways..can u explain? On Wed, Jul 27, 2011 at 9:06 PM, Abhinav Arora wrote: > I believe the method written is incorrect, it didnt work for me > i guess this is the right way...worked for me: > > int **p; > p=malloc(3*sizeof(int *)); > > -- > You received this messag

Re: [algogeeks] output

2011-07-27 Thread Kamakshii Aggarwal
@piyush:thanks...i got my mistake On Wed, Jul 27, 2011 at 7:30 PM, Piyush Sinha wrote: > char const *s and const char *s are both same...try using char *const s..it > will give error then > > > On Wed, Jul 27, 2011 at 7:21 PM, Kamakshii Aggarwal > wrote: > >> @ma

Re: [algogeeks] output

2011-07-27 Thread Kamakshii Aggarwal
2011 at 7:12 PM, wrote: > ** Its not a const pointer. It is pointer to constant. So only modifying > the value of s will cause error. For constant to pointer the const has to be > between * and the keyword > > Sent from BlackBerry® on Airtel > --

[algogeeks] output

2011-07-27 Thread Kamakshii Aggarwal
#include int main(int argc,char *argv[]) { const char *s=""; char str[]="hello"; s=str; while(*s){ printf("%c",*s++); } system("pause"); return 0; } o/p is hello. why the above code is running normally even when constant char pointer is being incremented...??plss hel

Re: [algogeeks] Re: OUTPUT

2011-07-27 Thread Kamakshii Aggarwal
one more question. how to dynamically allocate memory for int *a[3]; ? On Wed, Jul 27, 2011 at 5:57 PM, Kamakshii Aggarwal wrote: > thanks ankit and ramya..:) > > > On Wed, Jul 27, 2011 at 5:42 PM, Ankit wrote: > >> p is a pointer to an array of 4 ints. >> size

Re: [algogeeks] Re: OUTPUT

2011-07-27 Thread Kamakshii Aggarwal
thanks ankit and ramya..:) On Wed, Jul 27, 2011 at 5:42 PM, Ankit wrote: > p is a pointer to an array of 4 ints. > sizeof(p) gives the size of the pointer which is an int and sizeof(*p) > gives the size of the array it points (4*4=16) > > On Jul 27, 3:44 pm, Kamakshii

[algogeeks] OUTPUT

2011-07-27 Thread Kamakshii Aggarwal
#include # define MAXROW 3 #define MAXCOL 4 int main() { int (*p)[MAXCOL]; p=(int(*)[MAXCOL])malloc(MAXROW*sizeof(*p)); printf("%d %d",sizeof(p),sizeof(*p)); system("pause"); return 0; } THE O/P IS 4 16. I am not getting the reason.plss help -- You received this message becaus

Re: [algogeeks] Re: stacks

2011-07-24 Thread Kamakshii Aggarwal
; elements from the 2nd stack back and push them to the 1st stack. > >>> However, access is O(n) due to the inherent property of a stack which > >>> forbids random access! > >>> > >>> > >>> On Jul 23, 2:00 pm, Kamaks

[algogeeks] stacks

2011-07-23 Thread Kamakshii Aggarwal
consider a language that does no have arrays...but u can define stack data type like stack s; using pop ,push and other operations on 2 stacks,how can one dimensions array can be implemented?? -- Regards, Kamakshi kamakshi...@gmail.com -- You received this message because you are subscribed t

Re: [algogeeks] Sorting in O(n)

2011-07-22 Thread Kamakshii Aggarwal
use counting sort.. On Sat, Jul 23, 2011 at 1:22 AM, rShetty wrote: > How to sort Linked lists in O(n) time ?? > Give the algorithm or the explanation or clue to tackle the problem > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To

Re: [algogeeks]

2011-07-22 Thread Kamakshii Aggarwal
@rakib:can u please explain ur answer On Sat, Jul 23, 2011 at 12:48 AM, Pankaj wrote: > https://ideone.com/tr3Q7 > > > On Sat, Jul 23, 2011 at 12:42 AM, Pankaj wrote: > >> double **p= (double **) malloc(sizeof(double *)); >> >> >> On Sat, Jul 23, 2011 at 12:40 AM, Bhavesh agrawal >> wrote: >> >

Re: [algogeeks] Printf evaluation

2011-07-22 Thread Kamakshii Aggarwal
undefined behaviour. since value of i is changing more than once between two sequence points.. On Fri, Jul 22, 2011 at 5:42 PM, suresh srinivasan wrote: > > Output: > 5,4,3,1 > > *Explanation:* > > Since the brackets acts as right precedence, the execution of the statement > is from right to left

Re: [algogeeks] Re: reverse a line.

2011-07-22 Thread Kamakshii Aggarwal
explanation for dinesh's algo. let the sting is:arr[]="my name is kamakshi" first reverse the whole string by swapping characters from beginning and end strlen(arr)=19; now process till 19/2=9 swap(arr[0].arr[strlen-1]) now swap (arr[1],arr[strlen-2]); this way u will reverse the string in place.

Re: [algogeeks] Microsoft Interview Qn - Looping

2011-07-20 Thread Kamakshii Aggarwal
please some1 tell how to do part 2. On Wed, Jul 20, 2011 at 6:20 PM, kavitha nk wrote: > for 3rd v can replace decrement by an increment operator! > > > > > > //BE COOL// kavi > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > T

Re: [algogeeks] Re: Contiguous subarray with sum zero

2011-07-20 Thread Kamakshii Aggarwal
etting hash function > Thanks in advance > > On Thu, Jul 21, 2011 at 12:39 AM, Kamakshii Aggarwal < > kamakshi...@gmail.com> wrote: > >> @sagar: i read contiguous afterwards therefore i deleted my post... >> and for ankur's approach >> : >> orig

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

2011-07-20 Thread Kamakshii Aggarwal
@anika: Now I am able to understand.thanks anyways.:) On Thu, Jul 21, 2011 at 1:18 AM, Kamakshii Aggarwal wrote: > anika can u pls explain ur solution.I am not getting it. > > > On Wed, Jul 20, 2011 at 1:27 PM, Anurag atri wrote: > >> int a = 20 ; //whatever value y

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

2011-07-20 Thread Kamakshii Aggarwal
anika can u pls explain ur solution.I am not getting it. On Wed, Jul 20, 2011 at 1:27 PM, Anurag atri wrote: > int a = 20 ; //whatever value you like > int b = 30 ; // again > > int sum = a - (-b) ; > cout < > //eh ? > > > On Wed, Jul 13, 2011 at 6:17 PM, vaibhav shukla > wrote: > >> :D :D

Re: [algogeeks] Re: Contiguous subarray with sum zero

2011-07-20 Thread Kamakshii Aggarwal
w 1st 14 and 2nd 14 adds t0 0.(1,5,0,-6)... is it clear now? On Thu, Jul 21, 2011 at 12:22 AM, Kamakshii Aggarwal wrote: > > a little mistake in ankur's solution > 20 , -9 , 3 , 1, 5 , 0, -6 , 9 > 20 , 11,14,15,20,20(instead of 0),14,23 > now if sum of two consecutive terms

Re: [algogeeks] Re: Contiguous subarray with sum zero

2011-07-20 Thread Kamakshii Aggarwal
w 1st 14 and 2nd 14 adds t0 0.(1,5,0,-6)... is it clear now? On Thu, Jul 21, 2011 at 12:22 AM, Kamakshii Aggarwal wrote: > > a little mistake in ankur's solution > 20 , -9 , 3 , 1, 5 , 0, -6 , 9 > 20 , 11,14,15,20,20(instead of 0),14,23 > now if sum of two consecutive terms is

Re: [algogeeks] Re: Contiguous subarray with sum zero

2011-07-20 Thread Kamakshii Aggarwal
a little mistake in ankur's solution 20 , -9 , 3 , 1, 5 , 0, -6 , 9 20 , 11,14,15,20,20(instead of 0),14,23 now if sum of two consecutive terms is same then this means a 0 exists.and hence it can be printed as a subarray..else ankur's sol works fine..:) On Thu, Jul 21, 2011 at 12:06 AM, sagar par

Re: [algogeeks] Re: Contiguous subarray with sum zero

2011-07-20 Thread Kamakshii Aggarwal
for the above example,there are more possible sub arrays like -9,9 -9,0,9 On Thu, Jul 21, 2011 at 12:06 AM, sagar pareek wrote: > @ankur > > pls explain through an example by taking above problem. > > > On Wed, Jul 20, 2011 at 10:52 PM, SAMMM wrote: > >> >> >> Nice solution dude ...

Re: [algogeeks] Re: Microsoft

2011-07-20 Thread Kamakshii Aggarwal
first count the no of elements to be printed say it is 'n'. now start from n-1 and start expanding the array from right to left.. On Wed, Jul 20, 2011 at 10:56 PM, surender sanke wrote: > try from back end > > surender > > > On Wed, Jul 20, 2011 at 9:54 PM, Soumya Prasad Ukil > wrote: > >> Two p

Re: [algogeeks] puzzle

2011-07-19 Thread Kamakshii Aggarwal
any value satisfying 16x=15y. On Wed, Jul 20, 2011 at 12:14 AM, Saket Choudhary wrote: > 16x=15y. Multiple solutions. Actually Infinite. > > > On 19 July 2011 23:58, shiv narayan wrote: > >> There is a temple, whose premises have a garden and a pond. It has 4 >> idols, each of Ram, Shiv, Vishnu

Re: [algogeeks] What is the output of the following program? Why?

2011-07-16 Thread Kamakshii Aggarwal
int by 'a', as a char array by 'b' and > as a float by 'c'. > I thnk i read this read tis somewhere sometime back. ... so aint completely > sure abt it. > > > On Sun, Jul 17, 2011 at 2:08 AM, Kamakshii Aggarwal > wrote: > >> >>

Re: [algogeeks] What is the output of the following program? Why?

2011-07-16 Thread Kamakshii Aggarwal
u can always retrieve that value from the union that has been assigned last.therefore u get correct answer only for x.c in the case of union y y.a=100 and so the output but am not sure why y.b is printing character equivalent of 100. On Sun, Jul 17, 2011 at 1:58 AM, Shubham Maheshwari < shubham.

Re: [algogeeks] what would be the output of following code??

2011-07-16 Thread Kamakshii Aggarwal
he answer. On Sun, Jul 17, 2011 at 12:46 AM, Deoki Nandan wrote: > Give reason not answer . Answer can be found by compiler > > > On Sun, Jul 17, 2011 at 12:38 AM, Kamakshii Aggarwal < > kamakshi...@gmail.com> wrote: > >> answer to the first should be 2 22 23 >>

Re: [algogeeks] C OUTPUT AGAIN

2011-07-16 Thread Kamakshii Aggarwal
@gaurav :y it is -2?y not +2? On Sat, Jul 16, 2011 at 2:13 PM, sukhmeet singh wrote: > for problem1 you can use %hi or %hd .. while scanning .. > > > On Thu, Jul 14, 2011 at 12:03 PM, Gaurav Jain wrote: > >> @Nicks >> *Problem 1* >> >> %d is used to take a signed integer as input. To take a short

Re: [algogeeks] what would be the output of following code??

2011-07-16 Thread Kamakshii Aggarwal
answer to the first should be 2 22 23 On Sat, Jul 16, 2011 at 5:44 PM, varun pahwa wrote: > ignore my previous result. > > the ans to first should be 2 22 2 0. > and the ans to second should be. > > 2 222 > 2 > please correct me if i am wrong. > > > > On Sat, Jul 16, 2011 at 5:38 PM, varun pahwa

Re: [algogeeks] Re: Printf ...

2011-07-16 Thread Kamakshii Aggarwal
@sagain:in dev c it is #s Zi On Sat, Jul 16, 2011 at 3:35 PM, Ankur Khurana wrote: > I am using MinGW compiler (codeblocks , out put is 788 and not 678 . Its > compiler dependent so , let us leave it that way only. > > > On Sat, Jul 16, 2011 at 3:27 PM, shiv narayan > wrote: > >> according

Re: [algogeeks] Printf ...

2011-07-15 Thread Kamakshii Aggarwal
@sagar:o/p is #s zi..can u explain y? On Sat, Jul 16, 2011 at 1:45 AM, Antony Kotre wrote: > can any tell and explain the output of following code > > #include > main() > { int a =5, b=5; > int res1=(++a)+(++a)+(++a); > int res2=(++b)+(++b)*10+(++b)*100; > > printf(

Re: [algogeeks] c doubt

2011-07-13 Thread Kamakshii Aggarwal
@anika:can u please explain the meaning of this line.. so i here get an exponent of 2 as 2 here.. now in exponent 8 bits this exponent is stored as 127+exponent so here it becomes 1001.. On Wed, Jul 13, 2011 at 11:44 PM, Piyush Kapoor wrote: > thanks,i hv just entered 2nd year,so most proba

Re: [algogeeks] C OUTPUT HELP

2011-07-12 Thread Kamakshii Aggarwal
for the second problem,y should the answer be 3 1?.it should be 3 2 and it is working fine on dev c++ giving 3 2. On Tue, Jul 12, 2011 at 2:48 PM, Anand Saha wrote: > > > On Tue, Jul 12, 2011 at 2:36 PM, nicks wrote: >> >> and in problem 3 what i understood after reading with what you wrote is

Re: [algogeeks] Basic String Queries

2011-07-11 Thread Kamakshii Aggarwal
the output is compiler dependent.. On Mon, Jul 11, 2011 at 10:29 PM, Kamakshii Aggarwal wrote: > > puts(str) will print the string copied even if it has no null character. > also strncpy will not create any problem > > > On Mon, Jul 11, 2011 at 10:19 PM, Ankur Khurana >

Re: [algogeeks] Basic String Queries

2011-07-11 Thread Kamakshii Aggarwal
puts(str) will print the string copied even if it has no null character. also strncpy will not create any problem On Mon, Jul 11, 2011 at 10:19 PM, Ankur Khurana wrote: > if we are using strncpy( destination , source , num_of_char) > > then if destination have less space allocated than num_of_ch

Re: [algogeeks] C OUTPUT HELP

2011-07-10 Thread Kamakshii Aggarwal
probelm 5:It must be giving runtime error not segmentation fault coz it is an infinite recursion On Mon, Jul 11, 2011 at 1:09 AM, Kamakshii Aggarwal wrote: > for the first question...it will take #ifdef getchar to be '1' only when it > is defined as a MACRO in your program..

Re: [algogeeks] C OUTPUT HELP

2011-07-10 Thread Kamakshii Aggarwal
for the first question...it will take #ifdef getchar to be '1' only when it is defined as a MACRO in your program..if u dont define macro it will not take it into consideration even if it is defined in header file. On Mon, Jul 11, 2011 at 12:38 AM, nicks wrote: > Someone please help me in unders

Re: [algogeeks] Explanation

2011-07-08 Thread Kamakshii Aggarwal
in my compiler,its giving is rajeev this is string 1 is ra" On Fri, Jul 8, 2011 at 11:33 AM, rajeev bharshetty wrote: > @Vishal : yes I can use strcpy, But What is the problem with memcpy(). > > > On Fri, Jul 8, 2011 at 11:27 AM, Vishal Thanki wrote: > >> memcpy is usually used to co

Re: [algogeeks] Explanation

2011-07-08 Thread Kamakshii Aggarwal
in my compiler,its giving is rajeev this is string 1 is ra" On Fri, Jul 8, 2011 at 11:33 AM, rajeev bharshetty wrote: > @Vishal : yes I can use strcpy, But What is the problem with memcpy(). > > > On Fri, Jul 8, 2011 at 11:27 AM, Vishal Thanki wrote: > >> memcpy is usually used to co

Re: [algogeeks] Re: output plzz

2011-06-29 Thread Kamakshii Aggarwal
thanks sameer. On Wed, Jun 29, 2011 at 10:19 AM, sameer.mut...@gmail.com < sameer.mut...@gmail.com> wrote: > 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, Kamaksh

Re: [algogeeks] Re: output plzz

2011-06-28 Thread Kamakshii Aggarwal
#include int main() { int array[] = {23,34,12,17,204,99,16}; int TOTAL_ELEMENTS =(sizeof(array) / sizeof(array[0])); int d; for(d=-1;d <= (TOTAL_ELEMENTS-2);d++) printf("%d\n",array[d+1]); return 0; } but in this case we are getting the same o/p..can u please again explain whats wrong with the a

Re: [algogeeks] Reverse

2011-06-28 Thread Kamakshii Aggarwal
#include #include void revers(char *s) { if(*s) { revers(++s); s--; printf("%c ",*s); } } int main(int argc, char *argv[]) { char arr[]="string"; revers(arr); system("PAUSE"); return 0; } acording to abov

Re: [algogeeks] Re: MS question

2011-06-28 Thread Kamakshii Aggarwal
@Dave:can u please explain the second method. On Mon, Jun 27, 2011 at 11:24 PM, Dave wrote: > @Nishant: Here are a couple of O(n) alternatives, given that there are > a limited number of "last characters" and no requirement to break ties > in any particular way: > > 1. A counting sort. > > 2. Fo

Re: [algogeeks] Reverse

2011-06-27 Thread Kamakshii Aggarwal
#include #include void revers(char *s) { if(*s) { revers(++s); s--; printf("%c ",*s); } } int main(int argc, char *argv[]) { char arr[]="string"; revers(arr); system("PAUSE"); return 0; } will s be counted

Re: [algogeeks] Re: O(n) Time is the problem. ..

2011-06-26 Thread Kamakshii Aggarwal
der bit. Etc. O(n) + O(n/2) + O(n/4) + ... > = O(n). > > Dave > > On Jun 26, 2:41 am, Kamakshii Aggarwal wrote: >> @dave:can u please give the divide and conquer solution >> >> On 6/26/11, Kamakshii Aggarwal wrote: >> >> >> >> >&g

Re: [algogeeks] Re: O(n) Time is the problem. ..

2011-06-26 Thread Kamakshii Aggarwal
@dave:can u please give the divide and conquer solution On 6/26/11, Kamakshii Aggarwal wrote: > @aditya:it is given in the question that u cannot access the entire > element in single operaion..therefore both your above solution do not > hold for this question. > > On 6/25/11

Re: [algogeeks] Re: O(n) Time is the problem. ..

2011-06-26 Thread Kamakshii Aggarwal
@aditya:it is given in the question that u cannot access the entire element in single operaion..therefore both your above solution do not hold for this question. On 6/25/11, sunny agrawal wrote: > @Dave > yes u r right that integers means it can be big integers too. > generally when we talk about

Re: [algogeeks] Re: find output.

2011-06-16 Thread Kamakshii Aggarwal
i still din't get the solution..please explain.. On 6/16/11, LALIT SHARMA wrote: > ++*p++ > ==> > ++(*p++) , > increments the value stored at p , and also increments p . > > > > On Thu, Jun 16, 2011 at 1:10 PM, sunny agrawal > wrote: > >> The place where strict constness is not enforced is with c

Re: [algogeeks] Re: Explain the o/p

2011-06-16 Thread Kamakshii Aggarwal
I have read this link,still my not getting.Can anybody help?? On 6/15/11, Maksym Melnychok wrote: > that's floating point for you. > > http://en.wikipedia.org/wiki/Floating_point > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To vie

Re: [algogeeks] Re: Explain the o/p

2011-06-16 Thread Kamakshii Aggarwal
I have read this link,still i am not getting.Can anybody help?? On 6/16/11, Kamakshii Aggarwal wrote: > I have read this link,still my not getting.Can anybody help?? > > On 6/15/11, Maksym Melnychok wrote: >> that's floating point for you. >> >> http://en.w

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

2011-06-14 Thread Kamakshii Aggarwal
@akash:can u please explain your code...? On Mon, Jun 13, 2011 at 2:27 AM, Divye Kapoor wrote: > No extra memory except input buffer: O(n log n) time O(n) space (can't do > better than this). > > https://github.com/swagatata/ds_and_algos/blob/master/cpp/trivia/remove_duplicates_without_extra_mem

Re: [algogeeks] Puzzles....NOT Spam

2011-06-14 Thread Kamakshii Aggarwal
I am not able to logincan u help me... On Mon, Jun 13, 2011 at 12:17 AM, ADITYA KUMAR wrote: > http://www.freepuzzles.com > > This is the best site for quality puzzles, > But solutions are not given... > so i request members ,try to solve these puzzles and post their solutions > to this thre

Re: [algogeeks] Re: Interview Question

2011-04-11 Thread Kamakshii Aggarwal
but according to the question,ptr is pointing to the second node in this case On Fri, Apr 8, 2011 at 8:55 PM, Anurag atri wrote: > if innitially temp is pointing to A then there is no problem in deleting > the middle node .. > > > On Fri, Apr 8, 2011 at 4:49 PM, murthy.krishn...@gmail.com < >

Re: [algogeeks] [brain teaser ] 8april

2011-04-11 Thread Kamakshii Aggarwal
a is monkey..B is human On Fri, Apr 8, 2011 at 10:33 PM, balaji a wrote: > Both say liesA is monkey and B is a human... > > On Friday, April 8, 2011, Lavesh Rawat wrote: > > Island Puzzle > > > > > > There are people and strange monkeys on this island, and you can not tell > who is who. The

Re: [algogeeks] Interview Question

2011-04-07 Thread Kamakshii Aggarwal
1st case: if ptr points to the first node, then ptr->next=(ptr->next)->next will do. 2nd case:i think tehre has to be movement of data from third node to the second node. On 4/4/11, Umer Farooq wrote: > Hello friends, > > The following question has appeared in two top companies of my city. I'd >

Fwd: [algogeeks] [brain teaser ] 1april

2011-04-07 Thread Kamakshii Aggarwal
-- Forwarded message -- From: Kamakshii Aggarwal Date: Thu, Apr 7, 2011 at 8:56 PM Subject: Re: [algogeeks] [brain teaser ] 1april To: Manish Pathak @Manish:A can answer only if B and C have same colours.if B and C have different colours A cannot answer..Hence B will answer

Re: [algogeeks] Re: C puzzle

2011-04-07 Thread Kamakshii Aggarwal
in fn,ptr first recieves the address of i,and then by ptr=&val,it now stores the address of val variable. while in fn1,ptr first stores the address of i,and then by *ptr=100,value at the address of i changes to 100.and hence it gives 100 as the answer. On Thu, Apr 7, 2011 at 9:29 AM, rohit agarwa

Re: [algogeeks] [brain teaser ] 1april

2011-04-07 Thread Kamakshii Aggarwal
@Manish:A can answer only if B and C have same colours.if B and C have different colours A cannot answer..Hence B will answer. therefore B is the answer.Hence two cases arises..sorry,my previous answer was not totally correct.I missed out the other case. -- Regards, Kamakshi Netaji subhas Instit

Re: [algogeeks] Interview Question

2011-04-07 Thread Kamakshii Aggarwal
@anurag:the second case of yours requires movement of data if I am not wrong... @umer farooq:pls calrify what does movement of data mean? On Wed, Apr 6, 2011 at 8:33 PM, Anurag atri wrote: > in case you are given a pointer to the first node simply do > temp ->next = ( temp -> next ) -> next . > i

Re: [algogeeks] [brain teaser ] 1april

2011-04-06 Thread Kamakshii Aggarwal
B On 4/1/11, Praveen wrote: > B > > On Fri, Apr 1, 2011 at 1:38 PM, Rajeev Kumar > wrote: > >> Similar question; >> http://www.techinterview.org/post/518744816/more-hat-puzzles >> >> >> On Fri, Apr 1, 2011 at 1:02 PM, Lavesh Rawat >> wrote: >> >>> *Christmas Tree Problem * >>> * >>> *Four angels s

Re: [algogeeks] [brain teaser ] 2april

2011-04-06 Thread Kamakshii Aggarwal
'E' On Mon, Apr 4, 2011 at 4:24 PM, Vandana Bachani wrote: > Letter 'e' > > > On Mon, Apr 4, 2011 at 1:14 PM, Lavesh Rawat wrote: > >> *WHAT AM I Problem Solution* >> * >> *The beginning of eternity. The end of time and space. The beginning of >> every end and the end of every place. What am I? >

Re: [algogeeks] Re: generate ques set

2011-03-26 Thread Kamakshii Aggarwal
@ligerdave:whai if m*k>n. in this case some questions have to be repeated. On Thu, Mar 24, 2011 at 7:10 PM, ligerdave wrote: > let's make this clear. > > you have a total of N questions for K students, and each student gets > M questions, where M1+ M2 + M3 ++ Mn = N; Mx union My = {}empty >

Re: [algogeeks] [brain teaser ] 28february

2011-03-01 Thread Kamakshii Aggarwal
can u please explain the above sol. On Tue, Mar 1, 2011 at 5:53 PM, Subhransu wrote: > The answer is *Wednesday* >> > > > Sunday > > Monday > > Tuesday > > Wednesday > > thrusday > > Friday > > Saturday > > Mon > > tues > > wed > > thrus > > fri > > satu > > sund > > Tues > > wed > > thrus > > fr

Re: [algogeeks] printing without loop

2011-03-01 Thread Kamakshii Aggarwal
#include #include int main(int argc, char *argv[]) { if(printf("1 "))if(printf("2 "))if(printf("3 "))if(printf("4 "))if(printf("5 "))if(printf("6 "))if(printf("7 ")){} system("PAUSE"); return 0; } On Tue, Mar 1, 2011 at 10:52 AM, preetika tyagi wrote: > Can you elaborate on it and pr

Re: [algogeeks] c doubt

2011-02-12 Thread Kamakshii Aggarwal
according to me,it always return false.. On Sat, Feb 12, 2011 at 5:24 PM, snehal jain wrote: > does the check x==x+1 always return false for integer x? > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send emai

Re: [algogeeks] Microsoft

2011-02-06 Thread Kamakshii Aggarwal
@abhijit:quicksort take O(n^2)..We can use counting sort which is O(n). On Sun, Feb 6, 2011 at 6:32 PM, coolfrog$ wrote: > @Decipher > Microsoft is coming in over college.. can you Give some more question which > are recently asked ...in MS test... > @everone.. do share question of MS if some bod

<    1   2