Re: [algogeeks] C o/p help

2012-01-26 Thread rahul sharma
@ atul...got nw..thnx

On Thu, Jan 26, 2012 at 11:26 PM, atul anand wrote:

> think in terms of pointers...
>
> they are same :-
>
> p[-1] = *(p - 1)
>
>
> On Thu, Jan 26, 2012 at 11:15 PM, rahul sharma wrote:
>
>> [-1] in end is same as -1 ??
>>
>>
>> On Thu, Jan 26, 2012 at 11:11 PM, atul anand wrote:
>>
>>> btw your compiler has sizeof(int)=4;
>>> thats why o/p = fg
>>>
>>> On Thu, Jan 26, 2012 at 11:09 PM, atul anand wrote:
>>>
>>>> output depends on sizeof(int)so it may be different if you run on
>>>> different compilers.
>>>>
>>>> considering *sizeof(int) = 2;*
>>>>
>>>> argv[] is array of pointers.
>>>>   (p+=sizeof(int))[-1];
>>>> p=p+2 // 2=sizeof(int);
>>>>
>>>> now p will be pointing at index *argv[2];
>>>> then you are doing
>>>>
>>>> p=p-1;
>>>>
>>>> i.e p will point to *argv[1]
>>>>
>>>> hence output will be
>>>> o/p = cd
>>>>
>>>> On Thu, Jan 26, 2012 at 10:53 PM, rahul sharma >>> > wrote:
>>>>
>>>>> #include
>>>>> #include
>>>>> void fun(char **);
>>>>>
>>>>> int main()
>>>>> {
>>>>> char *argv[]={"ab","cd","de","fg"};
>>>>> fun(argv);
>>>>> getch();
>>>>> return 0;
>>>>> }
>>>>>
>>>>> void fun(char **p)
>>>>> {
>>>>>  char *t;
>>>>>  t=(p+=sizeof(int))[-1];
>>>>>  printf("%s\n",t);
>>>>> }
>>>>>
>>>>> o/p: fg
>>>>>
>>>>> can nyone xplain
>>>>>
>>>>> the 2nd statement in fun?
>>>>>
>>>>>  --
>>>>> 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, visit this group at
>>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>>
>>>>
>>>>
>>>  --
>>> 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, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> 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, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C o/p help

2012-01-26 Thread rahul sharma
[-1] in end is same as -1 ??

On Thu, Jan 26, 2012 at 11:11 PM, atul anand wrote:

> btw your compiler has sizeof(int)=4;
> thats why o/p = fg
>
> On Thu, Jan 26, 2012 at 11:09 PM, atul anand wrote:
>
>> output depends on sizeof(int)so it may be different if you run on
>> different compilers.
>>
>> considering *sizeof(int) = 2;*
>>
>> argv[] is array of pointers.
>>   (p+=sizeof(int))[-1];
>> p=p+2 // 2=sizeof(int);
>>
>> now p will be pointing at index *argv[2];
>> then you are doing
>>
>> p=p-1;
>>
>> i.e p will point to *argv[1]
>>
>> hence output will be
>> o/p = cd
>>
>> On Thu, Jan 26, 2012 at 10:53 PM, rahul sharma 
>> wrote:
>>
>>> #include
>>> #include
>>> void fun(char **);
>>>
>>> int main()
>>> {
>>> char *argv[]={"ab","cd","de","fg"};
>>> fun(argv);
>>> getch();
>>> return 0;
>>> }
>>>
>>> void fun(char **p)
>>> {
>>>  char *t;
>>>  t=(p+=sizeof(int))[-1];
>>>  printf("%s\n",t);
>>> }
>>>
>>> o/p: fg
>>>
>>> can nyone xplain
>>>
>>> the 2nd statement in fun?
>>>
>>>  --
>>> 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, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>  --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] C o/p help

2012-01-26 Thread rahul sharma
#include
#include
void fun(char **);

int main()
{
char *argv[]={"ab","cd","de","fg"};
fun(argv);
getch();
return 0;
}

void fun(char **p)
{
 char *t;
 t=(p+=sizeof(int))[-1];
 printf("%s\n",t);
}

o/p: fg

can nyone xplain

the 2nd statement in fun?

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] OS question

2012-01-25 Thread Rahul
Google search this
6.033
You will get the basics of processor mode of execution
and rings of execution
Hope I got the question !
On Wed, Jan 25, 2012 at 4:21 PM, UTKARSH SRIVASTAV
wrote:

> I have a doubt when each process has it's own separate page table then why
> is there s system wide page table required ? Also if Page table is such
> that it maps virtual address to a physical address then I think two process
> may map to same physical address because all process have same virtual
> address space
>
> any good link on system wide page table may also solve my problem
>
> --
> *UTKARSH SRIVASTAV
> CSE-3
> B-Tech 3rd Year
> @MNNIT ALLAHABAD*
>
>
>  --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] anybody c output?

2012-01-24 Thread rahul sharma
cant get the o/p...is the replacement of (char *)p create local copy of p
or gloabl p will be typecatsted.nhyone plz xplain...

On Sun, Jan 22, 2012 at 11:10 PM, him  wrote:

> http://ideone.com/hOdAt
>
> code:
>
>
> #include 
> char *p = "Hello World";
>
> #define PTR (char *)
> char a[10];
> void initA()
> {
> int i;
> PTR p;
>
> for ( p = a,i = 0; i < 5; i++)
> {*p++='a' +i;}
>
>
> }
>
> int main(void)
> {
> initA();
> printf("%s\n", p);
>
> getchar();
> return 0;
> }
>
> --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Amazon Interview Question

2012-01-19 Thread rahul patil
Looks like classic example of backtrack !!!

On Thu, Jan 19, 2012 at 1:05 PM, Prakash D  wrote:

> ignore my last comment.. misunderstood
>
>
> On Thu, Jan 19, 2012 at 1:04 PM, Prakash D  wrote:
>
>> why can't u simply place it as 1 2 3 4 5 6 7 1 2 3 4 5 6 7?
>>
>>
>> On Thu, Jan 19, 2012 at 2:05 AM, NEERAJ KODDHAN wrote:
>>
>>> int[] a = new int[2*n];
>>> put(a, n);
>>>
>>> static void put(int[] a,int i){
>>>  if(i>0){
>>>  for(int j=0;j>> if(a[j]==0 && a[j+i+1]==0){
>>>  a[j]=i;
>>> a[j+i+1]=i;
>>> put(a, i-1);
>>>  a[j]=0;
>>> a[j+i+1]=0;
>>> }
>>>  }
>>> }else if(i==0){
>>> for (int k : a) {
>>>  System.out.print(k +" ");
>>> }
>>> System.out.println();
>>>  }
>>> }
>>>
>>>
>>> On Wed, Jan 18, 2012 at 10:04 PM, Coding Geek wrote:
>>>
>>>> Place N number from 1 to N, in 2N positions in such a way so that there
>>>> are
>>>>
>>>> Exactly “n” number of cells between two placed locations of number “n”.
>>>> Write a program to display numbers placed in this way.
>>>>
>>>> Example:-
>>>>
>>>> (1) One of the possible placement for 7 numbers in 14 positions is :
>>>> 5 7 2 3 6 2 5 3 4 7 1 6 1 4
>>>>
>>>>
>>>>
>>>> --
>>>>
>>>> "To Iterate is Human, To Recurse is Divine"
>>>>
>>>> --
>>>> 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, visit this group at
>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>
>>>
>>>  --
>>> 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, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>  --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Regards,
Rahul Patil

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C QUESTION???

2012-01-10 Thread Rahul Verma
thanks for the info

-- 
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/-/E1c87OjP6LAJ.
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.



Re: [algogeeks] c output ??

2012-01-10 Thread Rahul Verma
@amol this is not the behaviour of printf, its totally about the typecasting

-- 
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/-/GPVlt15S3V0J.
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.



Re: [algogeeks] Re: String passing

2012-01-04 Thread rahul patil
When u say char p[]="hello";

memory to array is allocated on stack and "hello" is written into that
array. so u can modify "hello" by saying p[0]= 'y';

=

when u say char *x="hello";

memory to x is allocated on stack, but string "hello" is placed in the read
only memory section(sometimes called as literal section)
and address to "hello" is stored in variable x. this type of string are
called as read only strings. so u can modify x, but not the contents of the
constant string "hello".

So x=p; // valid , modified variable on stack
but x[0]='z' // invalid, tried to modify the constant string


On Wed, Jan 4, 2012 at 1:07 PM, Arun Vishwanathan wrote:

> if instead of passing "hello" directly to function if we passed char array
> p then this would not show as an error right? and why is this so? is it due
> to the fact tat p array was not possibly allocated in the read only segment
> of memory and hence when passed it can be modified by function? so if const
> string is passed directly what causes the error?
>
>
> On Sat, Aug 27, 2011 at 11:28 AM, sagar pareek wrote:
>
>> @raj
>>
>> u already mentioned that if we write :-
>> char *p="hello";
>> p[0]='k'; // gives runtime error
>>
>>
>> so if we are passing arguments as
>>
>> modify(char a[],char *b)
>> {
>> .
>> .
>> }
>>
>> main()
>> {
>> .
>> .
>> modify("hello","hi");
>> .
>> .
>> }
>>
>>
>> then its actually
>> char arr[]="hello";
>> char *b="hi";
>>
>> so ofcourse now
>> b[0]='a'; // give u runtime error
>>
>> now u may be confuse about
>> arr[0]='a'; //gives runtime error
>>
>> here i would like to tell you that arr is char pointer not char array
>> you can check by yourself in :-   http://www.ideone.com/EQrjj
>>
>> On Sat, Aug 27, 2011 at 10:39 PM, raj kumar wrote:
>>
>>>
>>> "monsters are monsters"
>>>
>>>
>>>
>>> -- Forwarded message --
>>> From: raj kumar 
>>> Date: Sat, Aug 27, 2011 at 10:30 PM
>>> Subject: Re: [algogeeks] Re: String passing
>>> To: algogeeks@googlegroups.com
>>>
>>>
>>> can't understand what are you trying to say
>>>
>>> source
>>>
>>>  --
>>> 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, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> **Regards
>> SAGAR PAREEK
>> COMPUTER SCIENCE AND ENGINEERING
>> NIT ALLAHABAD
>>
>>  --
>> 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, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
>  "People often say that motivation doesn't last. Well, neither does
> bathing - that's why we recommend it daily."
>
>  --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Regards,
Rahul Patil

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C output????

2012-01-03 Thread Rahul
it's near to a common mis conception that string liberals are in data
sections of THE PROGRAM


PLEASE READ THE FILE
a.out.h

and find the difference between initialized data and non initialized data

On 9/6/11, Sandy  wrote:
> String constants (literals) are saved into the .data section of the program,
>  Here is the sample program to show that.  if() is essentially comparing the
> addresses of two pointers which is same.
>
> int main()
> {
> char *p="persons";
> char *q="persons";
> char *r="persons";
> char *s="persons";
>  printf("%x %x %x %x\n",p,q,r,s);
> if(p=="persons")
> printf("technical %s",p);
> else
> printf("true %s",p);
> return 0;
> }
> -
> Output:
> 403021 403021 403021 403021
> technical persons
>
> On Tue, Sep 6, 2011 at 9:04 PM, sivaviknesh s wrote:
>
>>
>> main()
>> {
>> char *p="persons";
>> clrscr();
>> if(p=="persons")
>> printf("technical %s",p);
>> else
>> printf("true %s",p);
>> return 0;
>> }
>>
>> ..op : technical persons ..plz explain .. how come it works like an strcmp
>> operation???
>> --
>> Regards,
>> $iva
>>
>>  --
>> 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, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
>
> *Sandeep Kumar,*
>  ( Mobile +91-9866507368
>
> *“I believe in smart work, Believe Me”*
>
> --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: check Similar array

2012-01-03 Thread rahul patil
@samm: Rather than adding numbers could we add squares(or cube) of numbers
which could also be done in linear time?

On Wed, Jan 4, 2012 at 10:56 AM, rahul patil
wrote:

> @samm: Ur solution is great. It could be used to tell that arrays are not
> similar, in linear time. But cant tell that they are 100% similar
> ur solution fails for the simple case.
> arr1: 3,4
> arr2: 5,1
>
> On Wed, Jan 4, 2012 at 10:49 AM, SAMMM  wrote:
>
>> No it's not if u use the AP series mathematical formula n(n+1)/2..
>> Then it will be of O(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, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>
>
> --
> Regards,
> Rahul Patil
>



-- 
Regards,
Rahul Patil

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: check Similar array

2012-01-03 Thread rahul patil
@samm: Ur solution is great. It could be used to tell that arrays are not
similar, in linear time. But cant tell that they are 100% similar
ur solution fails for the simple case.
arr1: 3,4
arr2: 5,1

On Wed, Jan 4, 2012 at 10:49 AM, SAMMM  wrote:

> No it's not if u use the AP series mathematical formula n(n+1)/2..
> Then it will be of O(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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
Regards,
Rahul Patil

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Facebook Question

2011-12-21 Thread rahul
@harish What if all the points are in the same quadrant and and are equidistant 
from 0,0. 

-- 
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/-/NjysUthIqgYJ.
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.



[algogeeks] Re: Reverse n-Ary Tree and Return List of Leaf Nodes as Output - FYI Google MV

2011-12-21 Thread rahul
How abt representing the tree as a graph. If you represent it in
adjacency mattix or as a map of edges e.g. Edge{from}{to}=edge weight,
which could be a constant in this case. all you need to is to reverse
the pairs.

Order of complexity is o(e) and you can reach to leaf nodes and push
them in a list

On Dec 21, 1:43 am, Ankur Garg  wrote:
> A better representation for a n-ary tree would be
>
> struct node{
>     int data;
>    node* left;
>    node* sibling;
>
> }
>
> Like in a binary tree the second ptr points to its right child . Here it
> points to its sibling.This one saves space and also We know in each level
> we have how many nodes
> @Shashank,
> I think we can reverse the n-ary tree ,but again my doubt is what will be
> leaf nodes then in that case , It seems it will be original root , so i was
> confused . anyway , I will concentrate on reversing the tree only for now
> based on ur definition.
>
> Regards
> Ankur
>
> On Wed, Dec 21, 2011 at 1:08 PM, WgpShashank 
> wrote:
>
>
>
>
>
>
>
> > @atul,, yeah , but can you write some proper psuedo code/ Algorithm then
> > we can discus more about test cases.
>
> > Thanks
> > Shashank
>
> > --
> > 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/-/VPZpHM8D_WcJ.
>
> > 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.

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: Reverse n-Ary Tree and Return List of Leaf Nodes as Output - FYI Google MV

2011-12-20 Thread rahul
How do you represent the N-ary tree? If you represent child nodes as a
list, reversing this child node list at each node will solve the
problem right? I may be wrong.

On Dec 20, 10:50 am, atul anand  wrote:
> @ankur : for the given tree above instead of parent pointing to its child ,
> it would be child pointing to its parent after reversing
> i guess thats wat he is trying to say.
>
>
>
>
>
>
>
> On Tue, Dec 20, 2011 at 11:38 PM, Ankur Garg  wrote:
> > Hey Shashank
>
> > Unfortunately I cudnt understand the problem
>
> > What do u mean by reversing the tree here :(..
>
> > On Tue, Dec 20, 2011 at 11:23 PM, WgpShashank 
> > wrote:
>
> >> here is my code
>
> >> List list=new LinkeList();
>
> >> public List reverseTreeandReturnListContainingAllLeafNOdes(Node n)
> >> {
> >>        int i=0;
> >>        static int j=0;
>
> >>        if(n==null)
> >>        {
> >>             n=n.children[++j];
> >>             return null;
> >>        }
>
> >>        if(n.children[i]==null)
> >>        {
> >>         list.add(n);
>
> >>                 return list;
> >>        }
>
> >>        list=reverseTreeandReturnListContainingAllLeafNOdes(n.children[i]);
> >>        n.children[i]=n;
>
> >>      return list;
> >> }
>
> >> may contains the bug ? any modification / suggestion will be appreciated
>
> >> Thanks
> >> Shashank
>
> >>  --
> >> 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/-/2puK42n-1yYJ.
>
> >> 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.
>
> >  --
> > 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, visit this group at
> >http://groups.google.com/group/algogeeks?hl=en.

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Any book suggestion for Data structure and algo.

2011-12-17 Thread Rahul
If you have time then Do a Google this
www.algo-class.org


On Sat, Dec 17, 2011 at 3:13 PM, Abhishek Goswami wrote:

> Cool Rahul
>
>
> On Sat, Dec 17, 2011 at 3:09 PM, Rahul  wrote:
>
>> Google this
>> 6.046
>>
>> You should not ask any more suggestion  till you complete the above
>>
>> On Sat, Dec 17, 2011 at 3:07 PM, Abhishek Goswami > > wrote:
>>
>>>
>>>  --
>>> 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, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> 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, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Any book suggestion for Data structure and algo.

2011-12-17 Thread Rahul
Google this
6.046

You should not ask any more suggestion  till you complete the above

On Sat, Dec 17, 2011 at 3:07 PM, Abhishek Goswami wrote:

>
>  --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] MYSIS AND DRISHTI-SOFT

2011-12-13 Thread rahul sharma
On Tue, Dec 13, 2011 at 3:21 PM, hary rathor  wrote:

> aal puzzle from techinterview. more then 50 % came from there .
>
> --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
@aayush all the memebers approx. have joined both the groups

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Detect a loop with just head ptr given

2011-12-11 Thread rahul sharma
for linked we always have only head

On Thu, Dec 8, 2011 at 11:40 PM, sayan nayak  wrote:

> @Himanshu: If I follow ur algo..then I have to remove the loop..Otherwise
> there will not be any head for the reversed linked-list.
> If u wanna say..First remove the loop,make it a normal linked list,reverse
> it.and then again loop it remembering the
> previous link..then it's possible.But the Time overhead will be huge.
>
> Regards,
> Sayan
>
>
> On Thu, Dec 8, 2011 at 11:34 PM, himanshu kansal <
> himanshukansal...@gmail.com> wrote:
>
>> @sayan: take a singley linked list (not circular) with a loop in
>> ittry to reverse it.you will get why i gave this algo...it can be
>> reversedand it always ends up landing at original head of list if it
>> contains a loop
>> give it a try...
>>
>>
>> On Thu, Dec 8, 2011 at 11:30 PM, sayan nayak wrote:
>>
>>> @Himanshu: How can u reverse a linked list which has only the
>>> beginning(head) but no tail...
>>>
>>> And even if I consider that by some means u have reversed it..then also
>>> there is no guarantee that u reach the head..
>>> Because the LinkedList is not necessarily circular..a circular
>>> Linkedlist and a linkedlist with loop are not same...Cicular is one
>>> specific case of Loop.
>>>
>>> Pls correct me If I have misunderstood your explanation.
>>>
>>> Regards,
>>> Sayan
>>>
>>>
>>>
>>> On Thu, Dec 8, 2011 at 10:27 PM, himanshu kansal <
>>> himanshukansal...@gmail.com> wrote:
>>>
 if u cant create new ptrsthen i think horse and tortoise strategy
 will fail.
 then you can only modify the linked lists to detect the loop.

 one other strategy could be to reverse the linked list.after
 reversing the linked list, if you arrive at the head itself then the list
 contains the loop

 i know reversing of list will require additional three ptrsbt this
 is also one of the way


 On Thu, Dec 8, 2011 at 9:43 PM, hary rathor wrote:

> take two pointer
> run first with one speed and another with two until they meet,
> now take a first pointer and assign with head of list .
> now move again both same speed (only one forward at a time )
> now as they meet at point that will be your  starting pointer of loop.
>
> On 12/8/11, Deepak Nettem  wrote:
> > If you allow storing an extra bit with every node (to mark whether a
> node
> > has been visited), you can do it with just one pointer. But that's
> less
> > space efficient (O(n)) than using two pointers of varying speeds.
> >
> > On Thu, Dec 8, 2011 at 9:04 AM, Ankur Garg 
> wrote:
> >
> >> U cant create any new ptrs .Just use this ptr :)
> >>
> >>
> >> On Thu, Dec 8, 2011 at 6:30 PM, Prem Krishna Chettri
> >> wrote:
> >>
> >>> Ofcourse we can..
> >>>
> >>>U knw the head address now U start visit the list what is the
> big
> >>> deal?? Jst u gotto create two pointer say fast and slow with two
> diff
> >>> speed
> >>> of action..
> >>>
> >>> On Thu, Dec 8, 2011 at 6:27 PM, Ankur Garg 
> wrote:
> >>>
>   Can we detect if a loop is present in Linked List if only head
> ptr is
>  given
> 
>  --
>  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, visit this group at
>  http://groups.google.com/group/algogeeks?hl=en.
> 
> >>>
> >>>  --
> >>> 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, visit this group at
> >>> http://groups.google.com/group/algogeeks?hl=en.
> >>>
> >>
> >>  --
> >> 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, visit this group at
> >> http://groups.google.com/group/algogeeks?hl=en.
> >>
> >
> >
> >
> > --
> >
> > --
> > 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, visit this group at
>

Re: [algogeeks] MYSIS AND DRISHTI-SOFT

2011-12-10 Thread rahul sharma
@aayush...this group is dedicated to algorithmthere is a separate group
for thesei dnt knw y still these queries are allowed

On Sat, Dec 10, 2011 at 10:58 PM, Anika Jain  wrote:

> drishti latest test:
> 1st round written : 25 questions technical( 12 from c, 6 from java, 7 from
> os), 25 questions aptitude(logic and quant) total 1.5 hr
> 2nd round coding: 5 codes on arrays, linked lists, trees, matrices, total
> time 1.5 hr
> 3rd round puzzle interview round: high level 10-12 puzzles
> 4th round: technical interview: around 6-7 questions high level coding
>
>
> On Sat, Dec 10, 2011 at 7:49 PM, tech coder wrote:
>
>> about drishtisoft
>>
>> test pattern
>> 1: technical + aptitude   2 hours  abt 60  questions   c 20  apti 30  and
>> others 10
>> 2round  coding 4 to 5 questions
>> 3 round 1 technical interview  , they wiil ask u write working code ,
>> list and tree problems.
>>
>>
>> On Fri, Dec 9, 2011 at 12:44 PM, aayush jain  wrote:
>>
>>> can anybody tell me the pattern of  MYSIS AND DRISHTI-SOFT plz..
>>> is MYSIS is vistied any NIT if yes so plz share the
>>> experienceand DRISHTI-SOFT also
>>>
>>> --
>>> 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, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> *
>>
>>  Regards*
>> *"The Coder"*
>>
>> *"Life is a Game. The more u play, the more u win, the more u win , the
>> more successfully u play"*
>>
>>  --
>> 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, 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, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] finding duplicate set of paranthesis

2011-12-10 Thread rahul venkat
hi everyone,

can u suggest an algorithm for finding the duplicate paranthesis in a given
expression ?

for example , the expression (( a + b ) * (( c + d ))) has a set of
duplicate paranthesis.

thanks in advance .

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Permutation Problem with repeating characters

2011-12-07 Thread Rahul
http://www.youtube.com/watch?v=NdF1QDTRkck&list=PLFE6E58F856038C69&index=10&feature=plpp_video

Watch and formulate yourself
#9
#10
#11


On Wed, Dec 7, 2011 at 6:31 PM, Aniket  wrote:

> Write a programme to produce all permutations of a given string where
> characters are not unique. That means you are not allowed to print the
> duplicate strings.
>
> Ex:
>
> If input is aaa
> The output should be only aaa
>
> --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Thanks To aLgOgEeKs

2011-12-02 Thread rahul sharma
plz post how you prepared for MS..like the books or websites you
followedwould b of gr8 help.

On Fri, Dec 2, 2011 at 9:42 PM, rahul sharma wrote:

> gr8...congrats dude
>
>
> On Fri, Dec 2, 2011 at 9:05 PM, Karthikeyan V.B wrote:
>
>> Congratulations:)
>>
>> --
>> 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, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Thanks To aLgOgEeKs

2011-12-02 Thread rahul sharma
gr8...congrats dude

On Fri, Dec 2, 2011 at 9:05 PM, Karthikeyan V.B  wrote:

> Congratulations:)
>
> --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Link list Q

2011-12-01 Thread rahul vatsa
detects the loop in singly linked list.


On Thu, Dec 1, 2011 at 1:42 PM, Vijay Khandar wrote:

> What does the following program do on the singly linked list?
>
> p=head;
> q=head->next;
> while(p!=null && q!null)
> {
> if(p==q)
> {
> exit(0)
> }
> p=p->next;
> q=(q->next)?(q->next->next):q->next;
> }
>
> a)traverse the entire singly linked list
> b)detects the duplicate nodes
> c)detects the loop in singly linked list
> d)detects the duplicate nodes at alternate places
>
> plz explain anyone with correct option..
>
> --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] One small doubt??

2011-11-27 Thread rahul sharma
plz dnt post these type of questions .

On Sun, Nov 27, 2011 at 11:40 AM, kumar raja wrote:

> So does list can be a linked list or similar data structure , right??
>
>
> On 27 November 2011 11:17, saurabh singh  wrote:
>
>> ans 1) Array is a *contigous elements.*The elements of a list need not
>> be contigous.
>> ans 2)Ordered array is one in which the position of elements in array is
>> constrained by some property.For example a sorted array where the property
>> is relative magnitude of the element.In an unordered array the position of
>> elements in the array is not constrained by anything i.e. given the
>> position of an element in the array you cant say anything about it with
>> reference to other elements.same goes for list.
>>
>> On Sun, Nov 27, 2011 at 10:07 AM, kumar raja wrote:
>>
>>> Can someone explain the following terms  and their differences clearly?
>>>
>>> 1) Array and List
>>>
>>> 2) Ordered array and Unordered Array
>>>
>>> 3) Ordered List and Unordered List
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> --
>>> Regards
>>> Kumar Raja
>>> M.Tech(SIT)
>>> IIT Kharagpur,
>>> 10it60...@iitkgp.ac.in
>>>
>>>
>>>  --
>>> 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, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> Saurabh Singh
>> B.Tech (Computer Science)
>> MNNIT ALLAHABAD
>>
>>
>>  --
>> 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, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Regards
> Kumar Raja
> M.Tech(SIT)
> IIT Kharagpur,
> 10it60...@iitkgp.ac.in
>
>
>  --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] structure padding query

2011-11-24 Thread rahul sharma
struct abc
{
  int g;
  float f;
  double gj;
  };

like in this int takes 4 bytes and we want align in 8 bytes so i wana know
that whether the float should put with int as 4 bytes are there to complete
8 or float should be int+4 bytes padding and then store the float..


acc to o/p float is stores after int

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Xor Linked lists

2011-11-24 Thread rahul sharma
go to link i said..n at bottom u can find sum programs that are user
responshop it helps

On Thu, Nov 24, 2011 at 8:45 PM, kumar raja wrote:

> @rahul:
>
> when i tried the following i got an error
>
> int a=3,b=2;
>
> printf("%p", (&a)^(&b));
>
>
> On 24 November 2011 06:28, rahul sharma  wrote:
>
>> address can be xored easily with xor operator...
>>
>> http://www.geeksforgeeks.org/archives/12367
>>
>> On Thu, Nov 24, 2011 at 7:37 PM, kumar raja wrote:
>>
>>>
>>> http://en.wikipedia.org/wiki/XOR_linked_list
>>>
>>> In this link i have seen about Xor linked list ,but my doubt is how will
>>> u perform xor on Address of nodes.
>>>
>>> I have tried to perform xor on addresses of two values ,so how is it
>>> possible to use that technique.
>>>
>>> Also tell me whether there are any extra rules to follow during
>>> insert,delete and search
>>> --
>>> Regards
>>> Kumar Raja
>>> M.Tech(SIT)
>>> IIT Kharagpur,
>>> 10it60...@iitkgp.ac.in
>>>
>>>
>>>  --
>>> 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, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> 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, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Regards
> Kumar Raja
> M.Tech(SIT)
> IIT Kharagpur,
> 10it60...@iitkgp.ac.in
>
>
>  --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Xor Linked lists

2011-11-24 Thread rahul sharma
address can be xored easily with xor operator...

http://www.geeksforgeeks.org/archives/12367

On Thu, Nov 24, 2011 at 7:37 PM, kumar raja wrote:

>
> http://en.wikipedia.org/wiki/XOR_linked_list
>
> In this link i have seen about Xor linked list ,but my doubt is how will u
> perform xor on Address of nodes.
>
> I have tried to perform xor on addresses of two values ,so how is it
> possible to use that technique.
>
> Also tell me whether there are any extra rules to follow during
> insert,delete and search
> --
> Regards
> Kumar Raja
> M.Tech(SIT)
> IIT Kharagpur,
> 10it60...@iitkgp.ac.in
>
>
>  --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Silly question

2011-11-20 Thread rahul sharma
u just solve as many problems as u can...everybody has same
knowledge...just solve more and more and u will be gud and dnt look at
answer frst try urself ..no matter hw many minute and hours it
take.it happens wen we have a sol we jsut read it and dnt solve it by
ourselfso solve urself instead of looking at answer and u will be
perfectall the best

On Sun, Nov 20, 2011 at 11:09 PM, amrit harry wrote:

> i have a silly question to ask.
> im gud in ALGO and gud in DATA STR. but i can solve a problem if i
> know the algorithm or if earlier faced it.
> i can't able to think my own logics and solve new mathematical
> problems. even i dont know about how to come up with new TEST DATA. i
> knw we can develop this skill only by practice. but is there any
> method or steps to be followed during solving a problem?
>
> --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] function overloading query

2011-11-20 Thread rahul vatsa
yes, it will work.

On Sun, Nov 20, 2011 at 9:12 PM, Akash Coder wrote:

> no it wont work ... const is not a datatype. its  a qualifier
>
>
> On Sun, Nov 20, 2011 at 7:49 PM, rahul sharma wrote:
>
>> void fun(char *)
>> void fun(const char *)
>>
>>
>>
>> is this overloading works or these are same type of arguments??
>>
>> --
>> 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, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
> --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] function overloading query

2011-11-20 Thread rahul sharma
void fun(char *)
void fun(const char *)



is this overloading works or these are same type of arguments??

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] regarding start of loop in linked list

2011-11-19 Thread rahul sharma
when a loop is found then

slow=fast  //pointers;

then to find start we move one of any pointer at start and other at same
palce and move both @ speed of 1...then where they meet is startr,,,


can nyone xplain the logic behind this in simple words that how they meet
at startthnx in advance

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Computer Organisation Q

2011-11-18 Thread rahul sharma
not all...i have read it somehwr...

On Fri, Nov 18, 2011 at 2:33 PM, Vijay Khandar wrote:

> but why?
>
> On Nov 18, 9:14 am, "((** VICKY **))"  wrote:
> > False not necessarily.
> >
> > On Nov 17, 4:03 pm, Vijay Khandar  wrote:
> >
> > > Can anyone explain following sentence-> True or False and explain
> >
> > > "All instructions affect the flags"
> >
> > > Vijay Khandar...
>
> --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] deep vs shallow copy

2011-11-17 Thread rahul sharma
plz give me xample of these two .as per from book m not able to get
thesw clearly,...i have reda from wiki and got it but cant relate with
these...plz differ b/w these two with xample..thnx in advance


a shallow copy of an object copies all the member field values.this works
well if the fields are values,but may not be what we want for fields that
point to dynamically allocsted value.The pointer will be copied.But memory
it point will not be copied.


a deep cpy copies all fields,and makes copies of dynamically allocated
memory pointed to by the fields..

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Weird Behaviour of Fork()

2011-11-10 Thread rahul vatsa
wen u write something in printf, its 1st stored in the stdout buffer,  and
then wen buffers gets filled up, it goes to std output, u can forcly flush
it by using a fflush(stdout) api aftr ur printf st, or by putting a new
ln..

On Fri, Nov 11, 2011 at 12:49 PM, rachel  wrote:

> oh, so what you want to say is that when '\n' is not there in print
> command and then it is stored in stdout buffer unless it receives a '\n'
> and executes only in the end if '\n' is not received.
>
> thanks rahul :)
>
>
> On Fri, Nov 11, 2011 at 12:31 PM, rahul vatsa wrote:
>
>> u have a new line in 2nd prog bt not in the st, that makes the difference.
>> when u do fork in 1st code, the "algo" is nt printed on the terminal,
>> rather it is in the stdout buffer oly, which gets duplicated in the forked
>> pr also. nd wen the prog terminates, whtver is ther in the buffer gets
>> printed on terminal.
>> bt in the 2nd code, due to new line, it gets flushed off before fork, nd
>> so the forkd pr doesn't print this.
>>
>>   On Fri, Nov 11, 2011 at 12:22 PM, rachel  wrote:
>>
>>>   main()
>>> {
>>> printf("algo ");
>>> fork();
>>> // do anything
>>> }
>>> in this program, it is printing "algo" two times.
>>>
>>>
>>> main()
>>>  {
>>> printf("algo \n");
>>> fork();
>>> // do anything
>>> }
>>> in this program, it is printing "algo" only once.
>>>
>>> when a fork() is done, processes gets doubled and the execution starts
>>> from the part of the program below the fork() command, am i correct ?
>>>
>>> Thanks in advance.
>>>
>>> --
>>> 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, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>> --
>> 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, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Weird Behaviour of Fork()

2011-11-10 Thread rahul vatsa
wen u write anything in printf, it 1st goes to stdout buffer,

On Fri, Nov 11, 2011 at 12:49 PM, rachel  wrote:

> oh, so what you want to say is that when '\n' is not there in print
> command and then it is stored in stdout buffer unless it receives a '\n'
> and executes only in the end if '\n' is not received.
>
> thanks rahul :)
>
>
> On Fri, Nov 11, 2011 at 12:31 PM, rahul vatsa wrote:
>
>> u have a new line in 2nd prog bt not in the st, that makes the difference.
>> when u do fork in 1st code, the "algo" is nt printed on the terminal,
>> rather it is in the stdout buffer oly, which gets duplicated in the forked
>> pr also. nd wen the prog terminates, whtver is ther in the buffer gets
>> printed on terminal.
>> bt in the 2nd code, due to new line, it gets flushed off before fork, nd
>> so the forkd pr doesn't print this.
>>
>>   On Fri, Nov 11, 2011 at 12:22 PM, rachel  wrote:
>>
>>>   main()
>>> {
>>> printf("algo ");
>>> fork();
>>> // do anything
>>> }
>>> in this program, it is printing "algo" two times.
>>>
>>>
>>> main()
>>>  {
>>> printf("algo \n");
>>> fork();
>>> // do anything
>>> }
>>> in this program, it is printing "algo" only once.
>>>
>>> when a fork() is done, processes gets doubled and the execution starts
>>> from the part of the program below the fork() command, am i correct ?
>>>
>>> Thanks in advance.
>>>
>>> --
>>> 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, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>> --
>> 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, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Weird Behaviour of Fork()

2011-11-10 Thread rahul vatsa
u have a new line in 2nd prog bt not in the st, that makes the difference.
when u do fork in 1st code, the "algo" is nt printed on the terminal,
rather it is in the stdout buffer oly, which gets duplicated in the forked
pr also. nd wen the prog terminates, whtver is ther in the buffer gets
printed on terminal.
bt in the 2nd code, due to new line, it gets flushed off before fork, nd so
the forkd pr doesn't print this.

On Fri, Nov 11, 2011 at 12:22 PM, rachel  wrote:

> main()
> {
> printf("algo ");
> fork();
> // do anything
> }
> in this program, it is printing "algo" two times.
>
>
> main()
>  {
> printf("algo \n");
> fork();
> // do anything
> }
> in this program, it is printing "algo" only once.
>
> when a fork() is done, processes gets doubled and the execution starts
> from the part of the program below the fork() command, am i correct ?
>
> Thanks in advance.
>
> --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Facebook Online Question India

2011-11-09 Thread rahul sharma
facebook visit DCE???wats package???

On Wed, Nov 9, 2011 at 9:22 PM, Decipher  wrote:

> This question was asked by Facebook during their 2 hour online exam (Only
> 1 question in 2 hour as per my junior) in DCE.
>
> Given a list of words wordlist on 1st line (no of words <= 100) and a
> string qstr of len <= 1 million on 2nd line, print the index at qstr where
> a continuous substring exists that contains all the given words in wordlist.
>
> Don't ask any further questions as I got this information from some junior
> in my college.
>
> --
> 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/-/JwSnPn-5WRUJ.
> 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.
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] what will be the focus of yahoo in written exam ,what to study for it. please respond ASAP..

2011-11-09 Thread rahul sharma
i also want to knw...somebody who has faced yahoo this year plz post.

On Wed, Nov 9, 2011 at 11:50 PM, kumar raja wrote:

>
>
> --
> Regards
> Kumar Raja
> M.Tech(SIT)
> IIT Kharagpur,
> 10it60...@iitkgp.ac.in
>
>
>  --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Does anyone know the written pattern of Amazon??

2011-11-09 Thread rahul patil
once i had appeared to amazon interview, questions are as follows,
Hello all,

These are the questions for Amazon interview i faced on last Saturday.

==
===
   1st Round   -- written (coding)
=

Write functions for Q 1,2, 3 . Think of complexity and optimization also.

1>  (easy) write a function to swap consequent nodes in a link list.
 i/p=  head to list 1->  2-> 3-> 4-> 5-> 6-> 7->NULL
0/p= head to list   2->  1-> 4-> 3-> 6-> 5-> 7->NULL
Do not swap values , swap nodes.

node*   swapNode(node *Head) ;

2> (medium) Write a function which will tell u whether given tree in
balanced or not.

Tree in balanced only if diff  between height of roots left-subtree and
right subtree is 0,1 or -1.Otherwise it is imbalaced
(The problem was check only root is balanced or not, If any other subtree's
root is imbalaced and root is balanced
the result should return true i,e tree is balanced. Though you, for your
improvement/knowledge, can write it a function
in which it will check whether all the nodes are balanced or not)

i/p=  root of tree
o/p=  1-true if tree is balanced  0-false if tree is imbalanced

bool IsBalanced(Node  *root);

3> (Hard) Convert Binary tree into  the DLL but in following format.
(Do not assume that it is complete binary tree).
You have to convert those nodes of tree into the linklist nodes like
nodes->left in tree will denote that its nodes next element in linklist
and nodes->right in tree will denote that its nodes prev element in linklist
Extra space is allowed.

1  -

     2  <--  3  <---

  > 4 ---> 5 -->6 --->7 

 ---8 <9<10<11<-12<---13<---14<--- 15---

 > so on in zig-zag manner



so linklist will look like


NULL <-- 1   <=> 3  <=> 3 <=> 2 <=> 4 <=> 5 <=> 6  <=> 7 <=>  15 <=> 14 <=>
13 <=> 12 <=> 11 <=> 10 <=> 9 <=> 8 --> NULL
Node * createDLL(Node *root)


===
   2nd Round = One on one - interview checking approach and
datastructure Use
===


In this round they asked me two question.
They tried to check two things.How I approach the problem and use which
data structure.

1> Reg expression.
He asked me , what would be my approach if i have to implement  a '?'
operator in reg expesion
which matches either with character before it or with nothings like
ac?de can have two matching strings acde(('c' matched)) and ade('c'not
matched)
a?b can have two matching strings ab(('a' matched)) and b('a'not matched)

After my answer
Then he asked me to think about approach and use of datastructure which I
can use so that
i can easily add new operator like '-'  '*' etc.


2> Store a binary tree into file
and again reading file create it.
Your approach and  a datastructure you will use.


Finally not selected but a nice interview.
If u have question please feel free to ask me


On Tue, Nov 8, 2011 at 10:03 PM, kumar raja wrote:

> Thanks rahul
>
>
> On 8 November 2011 03:32, rahul sharma  wrote:
>
>> apti + technical + 3 prog (mainly linked list)
>>
>> On Tue, Nov 8, 2011 at 3:09 PM, kumar raja wrote:
>>
>>>
>>>
>>> --
>>> Regards
>>> Kumar Raja
>>> M.Tech(SIT)
>>> IIT Kharagpur,
>>> 10it60...@iitkgp.ac.in
>>>
>>>
>>>  --
>>> 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, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> 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, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Regards
> Kumar Raja
> M.Tech(SIT)
> IIT Kharagpur,
> 10it60...@iitkgp.ac.in
>
>
>  --
> You received this message because you are subscribed to th

Re: [algogeeks] Does anyone know the written pattern of Amazon??

2011-11-09 Thread rahul sharma
hey in our college this is the procedure for internship...n ppo is ther
based on profromance

On Tue, Nov 8, 2011 at 10:03 PM, kumar raja wrote:

> Thanks rahul
>
>
> On 8 November 2011 03:32, rahul sharma  wrote:
>
>> apti + technical + 3 prog (mainly linked list)
>>
>> On Tue, Nov 8, 2011 at 3:09 PM, kumar raja wrote:
>>
>>>
>>>
>>> --
>>> Regards
>>> Kumar Raja
>>> M.Tech(SIT)
>>> IIT Kharagpur,
>>> 10it60...@iitkgp.ac.in
>>>
>>>
>>>  --
>>> 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, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> 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, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Regards
> Kumar Raja
> M.Tech(SIT)
> IIT Kharagpur,
> 10it60...@iitkgp.ac.in
>
>
>  --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Does anyone know the written pattern of Amazon??

2011-11-08 Thread rahul sharma
apti + technical + 3 prog (mainly linked list)

On Tue, Nov 8, 2011 at 3:09 PM, kumar raja  wrote:

>
>
> --
> Regards
> Kumar Raja
> M.Tech(SIT)
> IIT Kharagpur,
> 10it60...@iitkgp.ac.in
>
>
>  --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] program to convert roman to integer.........

2011-11-06 Thread rahul sharma
i.p: v
o/p 5
i/p ix
o/p:9

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c output

2011-10-29 Thread rahul sharma
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 wrote:

> let this statement int x=100,y=5;printf("%*d",x,y);
> in this line first x is assign to '*' and it become "%100d"
> and it will padd 100 spaces before print. and if we use( "%*d",x)
> then x is assign to '*' and garbage value wud be printed.
>
>
> On Fri, Oct 28, 2011 at 8:53 PM, annarao kataru 
> wrote:
>
>> can u plz tell me what exactly %*d  means?
>>
>> --
>> 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, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>
>
> --
> AMRIT
>
>
>  --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Search an element in an Infinite array

2011-10-25 Thread rahul sharma
@sharmila...wat r u saying??cant get u?

On Tue, Oct 25, 2011 at 4:57 PM, sharmila saru wrote:

>
>
> Give Idea 2 study for GATE...
>
> --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Search an element in an Infinite array

2011-10-25 Thread rahul sharma
yeah...first search in 2^0 and 2^1if elemtn range is between this thern
search in this length with Binary search else
searchin 2^1 and 1^2 and apply same procedure until element range is found
and if element is not found in range then it means element not found

On Tue, Oct 25, 2011 at 3:12 PM, Bittu Sarkar  wrote:

> @Saurabh I think you did not get the question clearly. It's
> a theoretical question because in practice you cannot have an infinite
> length array of non-decreasing numbers anyways. Yes the sequence 1,1,1,...
> is infinite and the algorithm cannot just know all by itself what the
> largest number is, just because it has processed millions of 1s. In this
> case no algorithm can find the required number (>1) in which case the
> algorithm does not terminate.
>
>
> On 25 October 2011 13:46, saurabh singh  wrote:
>
>> Really?
>> the array is infinite length..
>> what if the sequence is
>> 1,1,1,1,1,1,1,1...infinity?
>> We need to know the max in order the algorithm is terminating..
>>
>> On Tue, Oct 25, 2011 at 11:32 AM, Bittu Sarkar wrote:
>>
>>> @Saurabh There is no biggest number in an infinite array [?]
>>>
>>>
>>> On 25 October 2011 09:07, saurabh singh  wrote:
>>>
>>>> suppose the element doesn't lies in the array and is bigger than the
>>>> biggest number:D
>>>> everything  will fail...
>>>>
>>>>
>>>> On Mon, Oct 24, 2011 at 9:43 PM, ravindra patel <
>>>> ravindra.it...@gmail.com> wrote:
>>>>
>>>>> using power of 2 approach doubles the scope of search each time.
>>>>> How about using approximation. Say I have lower bound lb and upper
>>>>> bound ub. Now -
>>>>>
>>>>> initially lb = 0, ub = 1;
>>>>>
>>>>> while (a[ub] < k)
>>>>> {
>>>>> lb = ub;
>>>>> ub = (ub*k) / a[ub];
>>>>> }
>>>>>
>>>>> after end of this loop we'll have a lower bound and upper which should
>>>>> provide a narrow scope.
>>>>>
>>>>> Feedback welcome :-),
>>>>> - Ravindra
>>>>>
>>>>> On Mon, Oct 24, 2011 at 7:09 PM, Bittu Sarkar wrote:
>>>>>
>>>>>> @Ankur Don't think there's any major reason for using powers of 2
>>>>>> except the fact that computing the powers of 2 can be done very 
>>>>>> efficiently
>>>>>> than computing the powers of any other number. Complexity in any case
>>>>>> remains the same.
>>>>>>
>>>>>>
>>>>>> On 24 October 2011 10:29, rahul sharma wrote:
>>>>>>
>>>>>>> +1 ankur
>>>>>>>
>>>>>>>
>>>>>>> On Mon, Oct 24, 2011 at 1:26 AM, Ankur Garg wrote:
>>>>>>>
>>>>>>>> Use Binary Search
>>>>>>>>
>>>>>>>> start = 2^n-1 high =2^n where n=0,1
>>>>>>>>
>>>>>>>> On Mon, Oct 24, 2011 at 12:28 AM, sunny agrawal <
>>>>>>>> sunny816.i...@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> hint 1: try to find 2 indexes i, j such that a[i] <= K <= a[j]
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Sun, Oct 23, 2011 at 11:23 PM, Ankuj Gupta >>>>>>>> > wrote:
>>>>>>>>>
>>>>>>>>>> Given a sorted array of Infinite size, find an element ‘K’ in the
>>>>>>>>>> array without using extra memory in O (lgn) time
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> 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, visit this group at
>>>>>>>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>>>>>>>
>>>>

Re: [algogeeks] Search an element in an Infinite array

2011-10-24 Thread rahul sharma
+1 ankur

On Mon, Oct 24, 2011 at 1:26 AM, Ankur Garg  wrote:

> Use Binary Search
>
> start = 2^n-1 high =2^n where n=0,1
>
> On Mon, Oct 24, 2011 at 12:28 AM, sunny agrawal 
> wrote:
>
>> hint 1: try to find 2 indexes i, j such that a[i] <= K <= a[j]
>>
>>
>> On Sun, Oct 23, 2011 at 11:23 PM, Ankuj Gupta wrote:
>>
>>> Given a sorted array of Infinite size, find an element ‘K’ in the
>>> array without using extra memory in O (lgn) time
>>>
>>> --
>>> 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, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>>
>>
>>
>> --
>> Sunny Aggrawal
>> B.Tech. V year,CSI
>> Indian Institute Of Technology,Roorkee
>>
>>
>>  --
>> 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, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Code it...

2011-10-19 Thread Rahul
http://www.dgp.toronto.edu/~ajr/209/notes/memoryos.html
Rahul


On Wed, Oct 19, 2011 at 2:29 PM, Rahul  wrote:

> http://valgrind.org/
>
> I am not sure but this may help on linux.
> I have a question that how to determine the number of system calls a
> program has made ?
> That too of a particular type
> Rahul
>
>
> On Wed, Oct 19, 2011 at 11:07 AM, kumar raja wrote:
>
>> Can someone give me an idea about how to see the range of segments like
>> data ,heap,stack and text segments of an executable file.(a.out)
>>
>> Is there anyway to access the those segments from the program itself
>> (while in execution), like using stack pointer for stack segment ??
>>
>>
>>
>>
>> On 18 October 2011 19:54, sravanreddy001 wrote:
>>
>>> @Don, Gene:
>>> very good insights,
>>> didn't even thought of the changing the executable, but it indeed is one
>>> way to do.
>>> :)
>>>
>>> @Don: agree with scripts and interpreted code.. :)
>>> [coming out of the same language helps answers some questions easily]
>>>
>>> --
>>> 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/-/ONw7a6q9VRMJ.
>>>
>>> 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
>> Kumar Raja
>> M.Tech(SIT)
>> IIT Kharagpur,
>> 10it60...@iitkgp.ac.in
>>
>>
>>  --
>> 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, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Code it...

2011-10-19 Thread Rahul
http://valgrind.org/

I am not sure but this may help on linux.
I have a question that how to determine the number of system calls a program
has made ?
That too of a particular type
Rahul


On Wed, Oct 19, 2011 at 11:07 AM, kumar raja wrote:

> Can someone give me an idea about how to see the range of segments like
> data ,heap,stack and text segments of an executable file.(a.out)
>
> Is there anyway to access the those segments from the program itself (while
> in execution), like using stack pointer for stack segment ??
>
>
>
>
> On 18 October 2011 19:54, sravanreddy001  wrote:
>
>> @Don, Gene:
>> very good insights,
>> didn't even thought of the changing the executable, but it indeed is one
>> way to do.
>> :)
>>
>> @Don: agree with scripts and interpreted code.. :)
>> [coming out of the same language helps answers some questions easily]
>>
>> --
>> 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/-/ONw7a6q9VRMJ.
>>
>> 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
> Kumar Raja
> M.Tech(SIT)
> IIT Kharagpur,
> 10it60...@iitkgp.ac.in
>
>
>  --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: print vertical sums of a binary tree

2011-10-18 Thread rahul patil
On Tue, Oct 18, 2011 at 6:31 PM, rahul patil
wrote:

> Use recursion with the code as follows
>
>
sum array of sums, with horizontal levels, level 0 is  for leftmost element

>
> void add(node *root, int *sum, int level)
> {



>  if(root->left)
>
 {
 if(level != -1)

>  level = add(root->left,sum, level-1);
>
 else   /* go till left with level =- 1 i.e uninitialized*/

> level = add(root->left,sum, level);
>

 /*level of root is level  of left node plus 1*/
 level += 1;
 }

 /*set  level =0 for leftmost element*/
 if(level == -1)
level = 0;
 /*level of right node is level of parent +1 */
 if(root->right)
  level = add(root->right,sum, level+1);
 return level;
}



call with add(root, sum, -1);

>
>
>
> On Tue, Oct 18, 2011 at 8:58 AM, sravanreddy001 
> wrote:
>
>> I that is what is suggested in the above code. Even here you can avoid the
>> sorting and add all with same x coordinate.. O(n) space as suggested..
>>
>> --
>> 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/-/CZ2rgqRAlW0J.
>> 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,
> Rahul Patil
>



-- 
Regards,
Rahul Patil

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Reconstruct BST from preorder traversal

2011-10-18 Thread rahul patil
On Tue, Oct 18, 2011 at 6:30 PM, sravanreddy001 wrote:

> This might sound silly. But I have a doubt here.when you mean convert
> inorder or preorder to a bst. Are the inorder traversel elements given and
> we need to construct a bst?
>

Yes inorder traversal elements are given.  and u have to give a generalise
approach which could be applied to any preorder array.


>
> --
> 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/-/3TnK7Rk4vtcJ.
> 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,
Rahul Patil

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: print vertical sums of a binary tree

2011-10-18 Thread rahul patil
Use recursion with the code as follows


void add(node *root, int *sum)
{

}




On Tue, Oct 18, 2011 at 8:58 AM, sravanreddy001 wrote:

> I that is what is suggested in the above code. Even here you can avoid the
> sorting and add all with same x coordinate.. O(n) space as suggested..
>
> --
> 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/-/CZ2rgqRAlW0J.
> 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,
Rahul Patil

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Reconstruct BST from preorder traversal

2011-10-18 Thread rahul patil
@Anshu: for a tree
  15
15
7 18and
717

17   18
inorder traversal is same: 7,15,17,18
then how it could be possible to recreate the specific one. Preorder of BST
is sorted one, so possible solution could be any BST containing   all the
elements in the preorder array.

On Tue, Oct 18, 2011 at 1:41 PM, anshu mishra wrote:

> @Anand
>
> As given it is a BST so any single traversal(pre or post or in) is
> sufficient to construct the tree. :P
>
> --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Regards,
Rahul Patil

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Adobe

2011-10-14 Thread rahul sharma
i dnt knw why still these posts are allowed in algogeeks

On Fri, Oct 14, 2011 at 7:37 PM, WgpShashank wrote:

> @All Join Interview-Street Group For Detailed Discussion About Interview
> Process of Particular Company , if You Have particular question & wants to
> discuss here , put that directly , All Interview Related Task Now Shifted
> Interview-Street Group until Whole Thing is Done , You Can Search
> The Archive rather then creating new thread..
>
>
>
>
> Thanks
> Shashank
> CSE, BIT Mesra
>
> --
> 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/-/AZMotOCplFwJ.
>
> 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.
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Amazon Question - Find Pythagorean triplet in an unsorted array

2011-10-14 Thread rahul patil
suppose sorted array is

1,2,3,5,10,12,13,17,19,25

so if u want to find possible combinations, with 25 as hypotenuse, then only
range 10 ... 19 could have answer

as 19 + 10 > 25

On Fri, Oct 14, 2011 at 3:14 PM, Ankur Garg  wrote:

> @Rahul
>
> Pls elaborate with an example ...
>
>
> On Fri, Oct 14, 2011 at 2:35 PM, rahul patil <
> rahul.deshmukhpa...@gmail.com> wrote:
>
>> You can take advantage of a basic property of triagle that
>>
>> sum of largest side of triangle < sum of other two sides,
>>
>> After sorting you could easily deside the range in which possible solution
>> could be found for a chosen hypotenuse
>>
>> On Fri, Oct 14, 2011 at 11:10 AM, ravindra patel <
>> ravindra.it...@gmail.com> wrote:
>>
>>> @Wladimir, yeah I have heard about that. Another way of populating
>>> primitive pythagoreans is, for any natural number m > 1  (m^2 - 1, 2m, m^2 +
>>> 1) forms a pythagorean triplet. This is useful in populating pythagorean
>>> tiplets but here the problem is to search such triplets from a given int
>>> array.
>>>
>>> @ rahul, Hash of z^2 - x^2 for each pair of z,x itself will of the size
>>> n*(n-1). I am not sure how it will work in O(n) time then.
>>>
>>> Thanks,
>>> - Ravindra
>>>
>>>
>>> On Fri, Oct 14, 2011 at 12:25 AM, Ankur Garg wrote:
>>>
>>>> @rahul...How do u choose z and x for computing z^2 -x^2 ?
>>>>
>>>> On Thu, Oct 13, 2011 at 11:34 PM, rahul  wrote:
>>>>
>>>>> You can create a hash with sqrt(z2-x2). This will make it o(n). The
>>>>> interviewer just made it lil tricky. That's all
>>>>>
>>>>> --
>>>>> 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/-/2Ge2pjt4N-4J.
>>>>> 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.
>>>>>
>>>>>
>>>>  --
>>>> 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, visit this group at
>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>
>>>
>>>  --
>>> 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, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> Regards,
>> Rahul Patil
>>
>>  --
>> 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, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Regards,
Rahul Patil

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Amazon Question - Find Pythagorean triplet in an unsorted array

2011-10-14 Thread rahul patil
You can take advantage of a basic property of triagle that

sum of largest side of triangle < sum of other two sides,

After sorting you could easily deside the range in which possible solution
could be found for a chosen hypotenuse

On Fri, Oct 14, 2011 at 11:10 AM, ravindra patel
wrote:

> @Wladimir, yeah I have heard about that. Another way of populating
> primitive pythagoreans is, for any natural number m > 1  (m^2 - 1, 2m, m^2 +
> 1) forms a pythagorean triplet. This is useful in populating pythagorean
> tiplets but here the problem is to search such triplets from a given int
> array.
>
> @ rahul, Hash of z^2 - x^2 for each pair of z,x itself will of the size
> n*(n-1). I am not sure how it will work in O(n) time then.
>
> Thanks,
> - Ravindra
>
>
> On Fri, Oct 14, 2011 at 12:25 AM, Ankur Garg  wrote:
>
>> @rahul...How do u choose z and x for computing z^2 -x^2 ?
>>
>> On Thu, Oct 13, 2011 at 11:34 PM, rahul  wrote:
>>
>>> You can create a hash with sqrt(z2-x2). This will make it o(n). The
>>> interviewer just made it lil tricky. That's all
>>>
>>> --
>>> 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/-/2Ge2pjt4N-4J.
>>> 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.
>>>
>>>
>>  --
>> 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, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Regards,
Rahul Patil

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Amazon Question - Find Pythagorean triplet in an unsorted array

2011-10-13 Thread rahul
You can create a hash with sqrt(z2-x2). This will make it o(n). The interviewer 
just made it lil tricky. That's all

-- 
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/-/2Ge2pjt4N-4J.
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.



Re: [algogeeks] adobe question help

2011-10-11 Thread rahul patil
this will do the same thing

N = ((N>>(j+1)) << (j+1)) | (M << i) | (~(~0 << i) & N);


On Tue, Oct 11, 2011 at 12:39 PM, Gaurav Kumar  wrote:

>
> This is a question from Laakman.
>
> This code operates by clearing all bits in N between position i and j, and
> then ORing to put M in there
> 1 public static int updateBits(int n, int m, int i, int j) {
> 2  int max = ~0; /* All 1's */
> 3
> 4  // 1's through position j, then 0's
> 5  int left = max - ((1 << j) - 1);
> 6
> 7  // 1's after position i
> 8int right = ((1 << i) - 1);
> 9
> 10  // 1's, with 0s between i and j
> 11  int mask = left | right;
> 12
> 13  // Clear i through j, then put m in there
> 14  return (n & mask) | (m << i);
> 15 }
>
>
> Gaurav
>
>
> On Oct 1, 2011, at 4:26 AM, rahul sharma  wrote:
>
>
> You are given two 32-bit numbers, N and M, and two bit positions, i and j.
> Write a method to set all bits between i and j in N equal to M (e.g., M
> becomes a substring of N located at i and starting at j).
> EXAMPLE:
> Input: N = 100, M = 10101, i = 2, j = 6
> Output: N = 10001010100
> _
>
>
> #include
> #include
> int main()
> {
> int N,M,i,j;
> printf("Enter value  of N \n");
> scanf("%d",&N);
> fflush(stdin);
> printf("Enter value  of M \n");
> scanf("%d",&M);
> fflush(stdin);
> printf("Enter value  of i \n");
> scanf("%d",&i);
> fflush(stdin);
> printf("Enter value  of j \n");
> scanf("%d",&j);
> fflush(stdin);
> int a=0,k;
> for( k=0;k {
>   a= a<<1;
>   a=a|1;
> }
> for(k =0;k {
>   a=a<<1;
> }
>
> N = N &(~a);
> printf("value of N is %d",N);
> for(k=0;k M=M<<1;
> N=N|M;
> printf("value of N is %d",N);
> getchar();
> }
>
>
> isnt it give us wrong mask
>
> say i=2;
>
> j=6;
>
> it gives mask as(i.e ~a)
>
> 0011
>
> but i think from 2 to 6 5 0's are neededplz tell the above prog is 
> ok???or not???check by giving any input whose 7thy bit is set...thnx in 
> advance
>
>  --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>  --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Regards,
Rahul Patil

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] remove duplicate words from a string

2011-10-10 Thread rahul sharma
if the string is sorted then

int rmvDup(char arr[],int arrLen)
{
int i,j;
for (i =1,j=0; i< arrLen;i++)
{
if (arr[j] != arr[i])
{
arr[j+1] = arr[i];
j = j+1;
}
}

 arr[j]='\0';
return j+1;
}


On Tue, Oct 11, 2011 at 9:18 AM, sunny agrawal wrote:

> @Ankur
> in Trie at each Node there will be 26 Pointers Stored, and Most of them
> would be NULL, thats why i think it will waste space,
>
> in Balanced Binary Tree i was thinking of storing the Complete Words at a
> Node.
>
> But now i think this is Better -> Ternary Search 
> Tries
>
>
>
>
>
> --
> Sunny Aggrawal
> B.Tech. V year,CSI
> Indian Institute Of Technology,Roorkee
>
>  --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Fwd: why we can not swap values using macro?

2011-10-10 Thread rahul sharma
macros i thnik cant swap pointers..i have doubt for same it is test ur c
skil question

On Sun, Oct 9, 2011 at 10:08 PM, sunny agrawal wrote:

> because you have not made any call to swap values of x and y
>
> I Don't know what you are trying to do here
> if you want to swap values why are you not calling macro swap(x,y,int)
> you are making a macro call to swap pointers and you can check that pointer
> will get swapped.
>
>
> On Sun, Oct 9, 2011 at 9:20 PM, Rajesh Kumar wrote:
>
>>
>>
>> -- Forwarded message --
>> From: Rajesh Kumar 
>> Date: Sun, Oct 9, 2011 at 2:58 PM
>> Subject: why we can not swap values using macro?
>> To: algogeeks@googlegroups.com
>>
>>
>> why this code doesn't swap values of x and y?
>>
>> #include
>> #define swap(a,b,c) c t;t=a,a=b,b=t;
>> main()
>> {
>> float x=10,y=20;
>> float *p,*q;
>> p=&x,q=&y;
>> swap(p,q,float *);
>> printf("%d %d\n",x,y);
>> }
>>
>>
>> --
>> Regards
>> Rajesh Kumar
>>
>>
>>
>>
>>
>> --
>> Regards
>> Rajesh Kumar
>>
>>
>>  --
>> 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, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Sunny Aggrawal
> B.Tech. V year,CSI
> Indian Institute Of Technology,Roorkee
>
>
>  --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: amazon,microsoft link list probs

2011-10-10 Thread rahul patil
On Thu, Oct 6, 2011 at 3:30 PM, 9ight coder <9ightco...@gmail.com> wrote:

> hey ankit can u show me 1st question solution
>
> On Oct 5, 9:06 pm, Ankur Garg  wrote:
> > Implement recursive merge sort for first question(Implement recursive
> merge sort for first question )
> >
> > For second just swap the values of node and node b
> >
> >
> >
> >
> >
> >
> >
> > On Wed, Oct 5, 2011 at 9:18 PM, 9ight coder <9ightco...@gmail.com>
> wrote:
> > > 1.perform inplace(we cant create new node)merge sort of two sorted
> > > linked list.(asked in amazon 1 mon before)
> > > 2.a->b->c->d->e  convert to b->a->d->c->e  without creating new node.
> > > (asked in microsoft on 4rth oct at thapar).
> >
>

Please elaborate the question. It must be condition that you should not swap
elements, you have to change the link pointer.




 > > sugeest solutions.
> >
> > > --
> > > 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, visit this group at
> > >http://groups.google.com/group/algogeeks?hl=en.
>
> --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
Regards,
Rahul Patil

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: MS test cases type Questions

2011-10-09 Thread rahul sharma
there r lot of stuff for this in algogeeks.plz u all r requested to post
these kind of quries on interview-street..i can tell u this last tym...
for testing profyl questions will be :
1.u open word fyl and do wrk and save...what can be test cases that error
can pccur.
2. u taking to frnd on phn..suddenly connection cut off...write for thta..

for devloper...
1. 2 server access same data from main data..hw to maintain integrity.

no need to prrpare..these r general


On Sun, Oct 9, 2011 at 1:42 AM, payal gupta  wrote:

> k...
> thanx...your info vud be of great help for me in future..
>
> regards,
> PAYAL GUPTA,
> CSE 3RD YR
> NIT_B
>
>
>
> On Wed, Sep 14, 2011 at 11:38 PM, KK  wrote:
>
>> U must mention all the boundary cases, very large input cases, -ve nos
>> and must throw appropriate exception while coding during interviews...
>> Questions are not too hard in MS... just they dont want buggy code...
>> even if u allocate memory.. u should take an if condition i.e. if (p !
>> = NULL)...and avoid such other silly mistakes...
>>
>> --
>> 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, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>  --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Database Classes

2011-10-08 Thread Rahul Verma
You are welcome.

-- 
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/-/WJz0FGP5wUgJ.
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.



Re: [algogeeks] SUGGESTIOn TO ALGo GEEKS

2011-10-08 Thread rahul sharma
no..i dnt knw the procedure..actually i was searching about some
companies..i have to post my query on interview-street..but look for
archieve in algogeeks..so by my personal experience i thought its gud to
have this all info in one group..procedure which i think is that the
intersted member of algogeeks takes the respnsibility..like one person
should take one company responsibility..and that person search for that
companies info in algo geeks archieve and by extarcting the best 2-3 posts
from algogeeks and then putting them on street-interview..(linke
pateern,ctc,question paper)..No one should be given any work..@shady.u as
owner post query that if sumone like to do so coz alone u is not possible to
do..if more peaple take part its a work of 15 min..there is a chance that 2
or more peaple post about same company but it can be handled further coz our
aim is to clean algogeeks..and grow iterview street...hope it  helps...

On Sat, Oct 8, 2011 at 11:06 PM, shady  wrote:

> ya, how to do it ?
> how to move all discussions from one group to another if you know the
> procedure then reply. :D
>
> On Sat, Oct 8, 2011 at 10:41 PM, rahul sharma wrote:
>
>> I have a suggestion to made...as a new group interview-street is
>> there..but still a lot more info is available here in algogeeks only..so
>> cant the owner of group move all the info about all the companies from
>> algogeeks to interview-street.like pattern n ctc n etc..so that if somebody
>> try to find then he/she cnt find and has to goto interview-street..this will
>> filters the algogeeks from non algo problems and laso make interview-street
>> to grow fast...wat say guys
>>
>> --
>> 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, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] SUGGESTIOn TO ALGo GEEKS

2011-10-08 Thread rahul sharma
I have a suggestion to made...as a new group interview-street is there..but
still a lot more info is available here in algogeeks only..so cant the owner
of group move all the info about all the companies from algogeeks to
interview-street.like pattern n ctc n etc..so that if somebody try to find
then he/she cnt find and has to goto interview-street..this will filters the
algogeeks from non algo problems and laso make interview-street to grow
fast...wat say guys

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Database Classes

2011-10-08 Thread Rahul Verma
Hi friends,

Sorry for this off topic, but I found that it would be interesting for us 
that now we have online classes of Databases from Stannford.db-class.org

-- 
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/-/zpcbKJ1elvMJ.
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.



Re: [algogeeks] Re: explain the output please.....

2011-10-07 Thread rahul sharma
o/p : fail 1
between c and u they will be in range so stored as it is
but i is -16
converted to 2 complement n become -32
thats y



On Sat, Oct 8, 2011 at 2:02 AM, Rahul Tiwari wrote:

> o/p - fail1
>pass2
>
> xplaination - as char range = (-127 to +127) so char c=-64 is ok
> so (c>i) condition z not true ..so else part got executed .
>
> but u is unsigned so its actual value z , u = some very high + no.
> so i
> if u want to verify then put this sentence in ur code & then run :
> printf("%u\n",u);   u got ur ans ...
>
>
>
>
>
> On Oct 8, 1:11 am, Raghav Garg  wrote:
> > i have run the program in turbo c and getting same o/p as i wrote
> earlier..
> > which compiler you are using?
> >
> > On 10/8/11, gaurav yadav  wrote:
> >
> > > @raghav garg...run the code and see the output,the output comes
> >
> > > fail1pass2
> >
> > > --
> > > 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, visit this group at
> > >http://groups.google.com/group/algogeeks?hl=en.
> >
> > --
> > Thanking you
> >
> > *With regards-
> > Raghav garg
> > Contact no. 9013201944www.facebook.com/rock.raghavag
> > B. tech (IT), 5th sem
> > University School Of Information Technology
> > Guru Govind Singh Indraprastha University
> > Delhi*
>
> --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Operating System

2011-10-07 Thread Rahul
CROWLEY +1
Rahul


On Sat, Oct 8, 2011 at 2:26 AM, saurabh araiyer  wrote:

> OS by Crowly (design oriented approach) is a nice book
>
> --
> Regards
> Saurabh Araiyer
> http://www.decapsulatingabstraction.blogspot.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 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.
>
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: explain the output please.....

2011-10-07 Thread Rahul Tiwari
o/p - fail1
pass2

xplaination - as char range = (-127 to +127) so char c=-64 is ok
so (c>i) condition z not true ..so else part got executed .

but u is unsigned so its actual value z , u = some very high + no.
so i wrote:
> i have run the program in turbo c and getting same o/p as i wrote earlier..
> which compiler you are using?
>
> On 10/8/11, gaurav yadav  wrote:
>
> > @raghav garg...run the code and see the output,the output comes
>
> > fail1pass2
>
> > --
> > 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, visit this group at
> >http://groups.google.com/group/algogeeks?hl=en.
>
> --
> Thanking you
>
> *With regards-
> Raghav garg
> Contact no. 9013201944www.facebook.com/rock.raghavag
> B. tech (IT), 5th sem
> University School Of Information Technology
> Guru Govind Singh Indraprastha University
> Delhi*

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: implementation of malloc

2011-10-07 Thread Rahul Tiwari
http://www.sendspace.com/file/wxqx5l




On Oct 7, 10:09 am, saurabh singh  wrote:
> It uses the system call brk
>
> On Fri, Oct 7, 2011 at 10:23 AM, praneethn  wrote:
> > can somebody provide the link or explain how malloc is implemented
> > internally as googling didn't help me.
>
> > --
> > 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, visit this group at
> >http://groups.google.com/group/algogeeks?hl=en.
>
> --
> Saurabh Singh
> B.Tech (Computer Science)
> MNNIT ALLAHABAD

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] print all numbers in a given range without using any loop statements, jump statements and recursion

2011-10-07 Thread rahul sharma
yeah fyn

On Fri, Oct 7, 2011 at 1:18 PM, tanuj chawla  wrote:

> @rahul - ya sure. i write the code for printing 1 to 100 and vice
> versa.. u can remove --i in the destructor.. sorry...
>
>  --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] print all numbers in a given range without using any loop statements, jump statements and recursion

2011-10-06 Thread rahul sharma
it will work without having --i in destructor???y is it here?>

On Fri, Oct 7, 2011 at 11:44 AM, tanuj chawla  wrote:

> #include
> int i;
> class A
> {
> public:
> A(){cout< ~A(){cout<<--i< }
> int main()
> {
> A a[100];
> return 0;
> }
>
>
>
> On Thu, Oct 6, 2011 at 10:42 PM, shiva@Algo wrote:
>
>> cant find in archives plz someone
>>
>>
>> On Sun, Oct 2, 2011 at 6:03 PM, Sahil Garg wrote:
>>
>>> plz post the soln.. i cant find it..
>>>
>>> Sahil Garg
>>> Computer Engineering
>>> Delhi College of Engineering
>>>
>>>
>>>
>>> On Tue, Sep 27, 2011 at 3:41 PM, shady  wrote:
>>>
 discussed, kindly look at archives


 On Tue, Sep 27, 2011 at 3:13 PM, surender sanke wrote:

> print all numbers in a given range *without* using any loop
> statements, jump statements and recursion
>
> surender
>
> --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

  --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.

>>>
>>>  --
>>> 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, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> 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, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: Qualcomm

2011-10-05 Thread Rahul Tiwari
@prag .. dude those 2 guys r not frm cs-it  & 1 more thine udit is
also from our college (MNNIT Allahabad ) .. & udit hi vo banda hai
jiska technical sabse achha gaya tha qualcomm me but after 1 hour good
tech round, w/o any reason QUALCOMM rejects udit .. udit z jst
xpressing his xperiance .






On Oct 5, 10:17 pm, Prags  wrote:
> @Udit- U r wrong my frnd. Qualcomm visited to my college (MNNIT Allahabad)
> and recruited 2 students. So its nt true that if u r nt a IITIAN then
> Qualcomm wont take u Just we need to do hard work to satisfy their
> requirement . thats it. ... :)
>
> On Wed, Sep 28, 2011 at 11:28 AM, Udit Gupta  wrote:
> > forget dude if u not an iitian, then forget about qualcomm
>
> > On Wed, Sep 28, 2011 at 11:07 AM, siva viknesh 
> > wrote:
>
> >> plz share the latest qualcomm questions and interview pattern if
> >> anyone had attended
>
> >> On Sep 25, 12:52 am, mohit mittal  wrote:
> >> > Hello yar,
> >> > Please share the written paper format and interview questions.
> >> > If dont want to display openly, plz share with my id
> >> mohitm.1...@gmail.com.
>
> >> > It will be of great help to me.
>
> >> --
> >> 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, visit this group at
> >>http://groups.google.com/group/algogeeks?hl=en.
>
> >  --
> > 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, visit this group at
> >http://groups.google.com/group/algogeeks?hl=en.

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] nagle's algorithm

2011-10-05 Thread Rahul Tiwari
plz suggest any good link that covers the complete basics abt nagle's
algo ...

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] unix book

2011-10-05 Thread rahul patil
the design of operating system by morris bach !!!
He has covered all basics about unix.

On Wed, Oct 5, 2011 at 5:07 PM, bihari  wrote:

> tell me good books on unix
>
> --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
Regards,
Rahul Patil

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] suggestion

2011-10-05 Thread rahul sharma
dnt agreee..everyone should get chance...the admin should post that wat
to post n wat not not toif again someone post abou the companies n ctc
etc.. he should be warn...else on second chance he should be droped from the
group

On Wed, Oct 5, 2011 at 11:03 AM, saurabh singh  wrote:

> well lets face it.90 pc of the posts these days are queries on
> companies recruiting interview questions etc.even the algorithm
> questions asked are not strictly algorithmic in nature.only a few
> people keep giving solutions other just keep doing +1.the point is
> with over 5000 members its not possible anymore to maintain this group
> as a quality discussion forum.why not create a seperate group with
> restricted membership and trying to maintain the quality there.the
> membership basis can be left on the discretion of admins.
>
> On 10/3/11, sunny agrawal  wrote:
> > And About Posting Questions on The Group
> > It is a humble request to the members of the group (who are reading this
> > post) that Please Don't Post Question in the subject of the message.
> > rather put related topic name in the subject, which can give a idea what
> the
> > question is about.
> >
> > On Mon, Oct 3, 2011 at 8:09 PM, sunny agrawal
> > wrote:
> >
> >> There is a Website that was initiated after the success of its community
> >> Algorithms on ORKUT
> >> but if i will post the link here people will start spamming there also
> :P
> >> like shady sad :(
> >>
> >> People have taken this group from Algorithms Group to
> >> X_Interview_Questions_Database_Group.
> >> seriously Bad :(
> >>
> >>
> >>
> >>
> >> On Mon, Oct 3, 2011 at 7:54 PM, shady  wrote:
> >>
> >>> people can't even post questions properly
> >>> same question being asked again and again, so many coders from Russia,
> >>> Poland, have stopped participating here :-(
> >>> all discussions are which company ? what is ctc ? what is asked ? what
> >>> should i do ? if one gets job and then that person becomes immune :-/
> >>> seriously lol
> >>>
> >>>
> >>> On Mon, Oct 3, 2011 at 7:50 PM, Ankur Garg 
> wrote:
> >>>
>  Nice Idea but for pulling this you need committed people :)
> 
>  On Mon, Oct 3, 2011 at 7:36 PM, sukran dhawan
>  wrote:
> 
> > Hello guys,
> > Here is a suggestion.With so much talented people in this group,why
> > cant
> > we a website that is similar to geeksforgeeks.
> > It will be really helpful to others if all the topics are well
> > organised
> > in the form of website
> > This is just a suggestion.just ignore the message if im wrong or u
> guys
> > don like the idea
> >
> > --
> > 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, visit this group at
> > http://groups.google.com/group/algogeeks?hl=en.
> >
> 
>   --
>  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, visit this group at
>  http://groups.google.com/group/algogeeks?hl=en.
> 
> >>>
> >>>  --
> >>> 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, visit this group at
> >>> http://groups.google.com/group/algogeeks?hl=en.
> >>>
> >>
> >>
> >>
> >> --
> >> Sunny Aggrawal
> >> B.Tech. V year,CSI
> >> Indian Institute Of Technology,Roorkee
> >>
> >>
> >
> >
> > --
> > Sunny Aggrawal
> > B.Tech. V year,CSI
> > Indian Institute Of Technology,Roorkee
> >
> > --
> > 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, visit this group at
> > http://groups.google.com/group/algogeeks?hl=en.
> >
> >
>
>
> --
> Saurabh Singh
> B.Tech (Computer Science)
> MNNIT ALLAHABAD
>
> --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Gee

Re: [algogeeks] Re: best way to learn data structure

2011-10-04 Thread Rahul
http://www.stanford.edu/class/cs106x/



http://see.stanford.edu/see/courseinfo.aspx?coll=11f4f422-5670-4b4c-889c-008262e09e4e


Awesome
You need to have Visual Studio 2005

On Tue, Oct 4, 2011 at 10:14 PM, shady  wrote:

> there is nothing like best book... which covers all concepts... books are
> there just to provide basics... you have to think on your own after that.
>
>
> On Tue, Oct 4, 2011 at 10:08 PM, SUDHIR RAHEJA <
> raheja.sudhirah...@gmail.com> wrote:
>
>> me too..also want to know how do i start with data structues...which book
>> is the best which covers almost every concept??
>>
>>  --
>> 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, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: best way to learn data structure

2011-10-04 Thread Rahul Verma
Hey Raghav,
 
No methods are worst or best.
 
Just go through any book you have and try the atleast 5 or 6 problems of 
various difficulty level based on that data structure.
 
Try to think about the functionality of the data structure, so that you can 
implement it in various situations or use it in different ways.

-- 
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/-/1V_bOqlY3T0J.
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.



Re: [algogeeks] New Group For Practicing and Learning Efficient Ways of Coding

2011-10-03 Thread Rahul Verma
Hey,
 
I have a suggestion that why we don't have a discussion on some topic for 
full one week and after that we can discuss problems from various 
programming sites and discuss the best solution of the problems..

-- 
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/-/S3FSxSWlnJAJ.
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.



Re: [algogeeks] Re: MS question

2011-10-03 Thread rahul sharma
got it..thnx yr

On Tue, Oct 4, 2011 at 8:34 AM, rahul sharma wrote:

> so we shoul d aslo add loop at the top to find only for firrst row and
> column the initial values
>
>
> On Tue, Oct 4, 2011 at 8:30 AM, Ashish Goel  wrote:
>
>> 0 in 0th row as well as 0 in 0th col and hence true
>>
>>
>> Best Regards
>> Ashish Goel
>> "Think positive and find fuel in failure"
>> +919985813081
>> +919966006652
>>
>>
>> On Tue, Oct 4, 2011 at 8:28 AM, rahul sharma wrote:
>>
>>> row0 and col0 initilayy true coz we have 0 in 0 row???or these r default
>>> values?
>>>
>>>
>>> On Tue, Oct 4, 2011 at 8:07 AM, Ashish Goel  wrote:
>>>
>>>> 1 1 0 1
>>>> 0 1 1 1
>>>> 1 1 1 1
>>>> 1 1 1 0
>>>>
>>>> row0 is true
>>>> col0 is true
>>>>
>>>> for (int i=1; i>>> for (int j=1;j>>> if (a[i][j] == 0) {a[i][0]=0; a[0][j]=0;}
>>>>
>>>> now after this
>>>> 1 1 0 0
>>>> 0 1 1 1
>>>> 1 1 1 1
>>>> 0 1 1 0
>>>>
>>>> for (int i=1; i>>>   if (a[i][0] ==0) for (int j=1; j>>> for (int j=1; i>>>   if (a[0][j] ==0) for (int i=1; i>>>
>>>> after this
>>>> 1 1 0 0
>>>> 0 0 0 0
>>>> 1 1 0 0
>>>> 0 0 0 0
>>>>
>>>>
>>>> because of row0 and col0 vars
>>>>
>>>>
>>>> final output is
>>>> 0 0 0 0
>>>> 0 0 0 0
>>>> 0 1 0 0
>>>> 0 0 0 0
>>>>
>>>> Best Regards
>>>> Ashish Goel
>>>> "Think positive and find fuel in failure"
>>>> +919985813081
>>>> +919966006652
>>>>
>>>>
>>>> On Tue, Oct 4, 2011 at 7:49 AM, rahul sharma 
>>>> wrote:
>>>>
>>>>> @ashish can u give an xample.plz...i have read a lot archives
>>>>> ...but cant find in 0(1) spaceu using 2 var only...plz give
>>>>> xample...nended urgent.thnx
>>>>>
>>>>>
>>>>> On Tue, Oct 4, 2011 at 7:26 AM, Ashish Goel  wrote:
>>>>>
>>>>>> keep two var row0 and col0 for checking if there is any 0 in row0flag
>>>>>> /col0flag
>>>>>>
>>>>>> now walk over elements from 1,1 to n,m and set corresponding entry in
>>>>>> 0th row /column if you hit a zero.
>>>>>>
>>>>>> now walk over zeroth column and rwo and set the complete row/col if a
>>>>>> 0 is there in 0th row/col.
>>>>>>
>>>>>> after this based on row0flag/col0flag, set oth col/row values to 0.
>>>>>>
>>>>>> Best Regards
>>>>>>  Ashish Goel
>>>>>> "Think positive and find fuel in failure"
>>>>>> +919985813081
>>>>>> +919966006652
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Mon, Oct 3, 2011 at 12:08 PM, rahul sharma <
>>>>>> rahul23111...@gmail.com> wrote:
>>>>>>
>>>>>>> yeah it is wrong..i have a solution but uses 0(n+m) space.i
>>>>>>> need it in 0(n*m) tymand o(1) space
>>>>>>>
>>>>>>>
>>>>>>> On Mon, Oct 3, 2011 at 11:55 AM, shady  wrote:
>>>>>>>
>>>>>>>> search archives :-/
>>>>>>>>
>>>>>>>>
>>>>>>>> On Mon, Oct 3, 2011 at 11:47 AM, pranav agrawal <
>>>>>>>> pranav.is.cool.agra...@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> @rahul sharma, i ran this code, it is producing wrong answer :|
>>>>>>>>>
>>>>>>>>> check it,  http://codepad.org/THv1hJq1
>>>>>>>>>
>>>>>>>>> anyone with correct solution?
>>>>>>>>>
>>>>>>>>>  --
>>>>>>>>> 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/-/26XU3UBqZ6EJ.
>>

Re: [algogeeks] Re: MS question

2011-10-03 Thread rahul sharma
so we shoul d aslo add loop at the top to find only for firrst row and
column the initial values

On Tue, Oct 4, 2011 at 8:30 AM, Ashish Goel  wrote:

> 0 in 0th row as well as 0 in 0th col and hence true
>
>
> Best Regards
> Ashish Goel
> "Think positive and find fuel in failure"
> +919985813081
> +919966006652
>
>
> On Tue, Oct 4, 2011 at 8:28 AM, rahul sharma wrote:
>
>> row0 and col0 initilayy true coz we have 0 in 0 row???or these r default
>> values?
>>
>>
>> On Tue, Oct 4, 2011 at 8:07 AM, Ashish Goel  wrote:
>>
>>> 1 1 0 1
>>> 0 1 1 1
>>> 1 1 1 1
>>> 1 1 1 0
>>>
>>> row0 is true
>>> col0 is true
>>>
>>> for (int i=1; i>> for (int j=1;j>> if (a[i][j] == 0) {a[i][0]=0; a[0][j]=0;}
>>>
>>> now after this
>>> 1 1 0 0
>>> 0 1 1 1
>>> 1 1 1 1
>>> 0 1 1 0
>>>
>>> for (int i=1; i>>   if (a[i][0] ==0) for (int j=1; j>> for (int j=1; i>>   if (a[0][j] ==0) for (int i=1; i>>
>>> after this
>>> 1 1 0 0
>>> 0 0 0 0
>>> 1 1 0 0
>>> 0 0 0 0
>>>
>>>
>>> because of row0 and col0 vars
>>>
>>>
>>> final output is
>>> 0 0 0 0
>>> 0 0 0 0
>>> 0 1 0 0
>>> 0 0 0 0
>>>
>>> Best Regards
>>> Ashish Goel
>>> "Think positive and find fuel in failure"
>>> +919985813081
>>> +919966006652
>>>
>>>
>>> On Tue, Oct 4, 2011 at 7:49 AM, rahul sharma wrote:
>>>
>>>> @ashish can u give an xample.plz...i have read a lot archives ...but
>>>> cant find in 0(1) spaceu using 2 var only...plz give xample...nended
>>>> urgent.thnx
>>>>
>>>>
>>>> On Tue, Oct 4, 2011 at 7:26 AM, Ashish Goel  wrote:
>>>>
>>>>> keep two var row0 and col0 for checking if there is any 0 in row0flag
>>>>> /col0flag
>>>>>
>>>>> now walk over elements from 1,1 to n,m and set corresponding entry in
>>>>> 0th row /column if you hit a zero.
>>>>>
>>>>> now walk over zeroth column and rwo and set the complete row/col if a 0
>>>>> is there in 0th row/col.
>>>>>
>>>>> after this based on row0flag/col0flag, set oth col/row values to 0.
>>>>>
>>>>> Best Regards
>>>>>  Ashish Goel
>>>>> "Think positive and find fuel in failure"
>>>>> +919985813081
>>>>> +919966006652
>>>>>
>>>>>
>>>>>
>>>>> On Mon, Oct 3, 2011 at 12:08 PM, rahul sharma >>>> > wrote:
>>>>>
>>>>>> yeah it is wrong..i have a solution but uses 0(n+m) space.i
>>>>>> need it in 0(n*m) tymand o(1) space
>>>>>>
>>>>>>
>>>>>> On Mon, Oct 3, 2011 at 11:55 AM, shady  wrote:
>>>>>>
>>>>>>> search archives :-/
>>>>>>>
>>>>>>>
>>>>>>> On Mon, Oct 3, 2011 at 11:47 AM, pranav agrawal <
>>>>>>> pranav.is.cool.agra...@gmail.com> wrote:
>>>>>>>
>>>>>>>> @rahul sharma, i ran this code, it is producing wrong answer :|
>>>>>>>>
>>>>>>>> check it,  http://codepad.org/THv1hJq1
>>>>>>>>
>>>>>>>> anyone with correct solution?
>>>>>>>>
>>>>>>>>  --
>>>>>>>> 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/-/26XU3UBqZ6EJ.
>>>>>>>>
>>>>>>>> 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.
>>>>>>>>
>>>>>>>
>>>>>>>  --
>>>>>>> You received this message because you are subscribed to the Google
>>&

Re: [algogeeks] Re: MS question

2011-10-03 Thread rahul sharma
row0 and col0 initilayy true coz we have 0 in 0 row???or these r default
values?

On Tue, Oct 4, 2011 at 8:07 AM, Ashish Goel  wrote:

> 1 1 0 1
> 0 1 1 1
> 1 1 1 1
> 1 1 1 0
>
> row0 is true
> col0 is true
>
> for (int i=1; i for (int j=1;j if (a[i][j] == 0) {a[i][0]=0; a[0][j]=0;}
>
> now after this
> 1 1 0 0
> 0 1 1 1
> 1 1 1 1
> 0 1 1 0
>
> for (int i=1; i   if (a[i][0] ==0) for (int j=1; j for (int j=1; i   if (a[0][j] ==0) for (int i=1; i
> after this
> 1 1 0 0
> 0 0 0 0
> 1 1 0 0
> 0 0 0 0
>
>
> because of row0 and col0 vars
>
>
> final output is
> 0 0 0 0
> 0 0 0 0
> 0 1 0 0
> 0 0 0 0
>
> Best Regards
> Ashish Goel
> "Think positive and find fuel in failure"
> +919985813081
> +919966006652
>
>
> On Tue, Oct 4, 2011 at 7:49 AM, rahul sharma wrote:
>
>> @ashish can u give an xample.plz...i have read a lot archives ...but
>> cant find in 0(1) spaceu using 2 var only...plz give xample...nended
>> urgent.thnx
>>
>>
>> On Tue, Oct 4, 2011 at 7:26 AM, Ashish Goel  wrote:
>>
>>> keep two var row0 and col0 for checking if there is any 0 in row0flag
>>> /col0flag
>>>
>>> now walk over elements from 1,1 to n,m and set corresponding entry in 0th
>>> row /column if you hit a zero.
>>>
>>> now walk over zeroth column and rwo and set the complete row/col if a 0
>>> is there in 0th row/col.
>>>
>>> after this based on row0flag/col0flag, set oth col/row values to 0.
>>>
>>> Best Regards
>>>  Ashish Goel
>>> "Think positive and find fuel in failure"
>>> +919985813081
>>> +919966006652
>>>
>>>
>>>
>>> On Mon, Oct 3, 2011 at 12:08 PM, rahul sharma 
>>> wrote:
>>>
>>>> yeah it is wrong..i have a solution but uses 0(n+m) space.i need
>>>> it in 0(n*m) tymand o(1) space
>>>>
>>>>
>>>> On Mon, Oct 3, 2011 at 11:55 AM, shady  wrote:
>>>>
>>>>> search archives :-/
>>>>>
>>>>>
>>>>> On Mon, Oct 3, 2011 at 11:47 AM, pranav agrawal <
>>>>> pranav.is.cool.agra...@gmail.com> wrote:
>>>>>
>>>>>> @rahul sharma, i ran this code, it is producing wrong answer :|
>>>>>>
>>>>>> check it,  http://codepad.org/THv1hJq1
>>>>>>
>>>>>> anyone with correct solution?
>>>>>>
>>>>>>  --
>>>>>> 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/-/26XU3UBqZ6EJ.
>>>>>>
>>>>>> 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.
>>>>>>
>>>>>
>>>>>  --
>>>>> 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, visit this group at
>>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>>
>>>>
>>>>  --
>>>> 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, visit this group at
>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>
>>>
>>>  --
>>> 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, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> 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, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: MS question

2011-10-03 Thread rahul sharma
@ashish can u give an xample.plz...i have read a lot archives ...but
cant find in 0(1) spaceu using 2 var only...plz give xample...nended
urgent.thnx

On Tue, Oct 4, 2011 at 7:26 AM, Ashish Goel  wrote:

> keep two var row0 and col0 for checking if there is any 0 in row0flag
> /col0flag
>
> now walk over elements from 1,1 to n,m and set corresponding entry in 0th
> row /column if you hit a zero.
>
> now walk over zeroth column and rwo and set the complete row/col if a 0 is
> there in 0th row/col.
>
> after this based on row0flag/col0flag, set oth col/row values to 0.
>
> Best Regards
> Ashish Goel
> "Think positive and find fuel in failure"
> +919985813081
> +919966006652
>
>
>
> On Mon, Oct 3, 2011 at 12:08 PM, rahul sharma wrote:
>
>> yeah it is wrong..i have a solution but uses 0(n+m) space.i need
>> it in 0(n*m) tymand o(1) space
>>
>>
>> On Mon, Oct 3, 2011 at 11:55 AM, shady  wrote:
>>
>>> search archives :-/
>>>
>>>
>>> On Mon, Oct 3, 2011 at 11:47 AM, pranav agrawal <
>>> pranav.is.cool.agra...@gmail.com> wrote:
>>>
>>>> @rahul sharma, i ran this code, it is producing wrong answer :|
>>>>
>>>> check it,  http://codepad.org/THv1hJq1
>>>>
>>>> anyone with correct solution?
>>>>
>>>>  --
>>>> 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/-/26XU3UBqZ6EJ.
>>>>
>>>> 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.
>>>>
>>>
>>>  --
>>> 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, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> 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, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: string compress/expand

2011-10-03 Thread rahul sharma
plz run my code for test i/p:-

#include
#include
int main()
{
cout<<"\nenter the string";
char str[30];
cin>>str;
int c=1;

int index=0;
int i;
for(i=0;str[i];i++)
{

   //cout<<" check string "<1)
 {
//cout<<" count is "< wrote:

> Code for Compression
>
> I am doing it inplace
>
> void convert(char* s,int len){
> int i=0;
> int count=1;
> int index=1; //*maintain the index where number is to be added*
> for(i=1;i<=len;i++){
>if(s[i]==s[i-1])
>count++;
>else{
>s[index-1]=s[i-1];*//put the char first like a3abbb . then this
> step converts it into a3*
>s[index]= (count+'0');/*/convert the count integer into char
> so it becomes a3b4bb*
>count=1;
>index = index+2;
>    }
> }
> s[index-1]='\0'*;//terminate the string* *(a3b4bb will become a3b4)*
>
> }
>
> On Mon, Oct 3, 2011 at 12:12 PM, rahul sharma wrote:
>
>> check my code for compression..
>>
>> check if it is ok
>> abc i/p
>> o/p abc
>>
>> means if character has no count.but still present in string it is its only
>> occurance.plz check that code...
>>
>> #include
>> #include
>> int main()
>> {
>> cout<<"\nenter the string";
>> char str[30];
>> cin>>str;
>> int c=1;
>> for(int i=0;str[i];i++)
>> {
>> if(str[i+1]>='0' && str[i+1]<='9')
>> {
>> c=c+(str[i+1]-'0');
>> for(int j=1;j> cout<>   i++;
>>
>> }
>>
>>else
>>cout<>c=1;
>>
>>
>> }
>>
>> getch();
>>
>>}
>>
>>
>>
>> On Mon, Oct 3, 2011 at 12:08 PM, Rahul Verma wrote:
>>
>>> @rahul sharma
>>>
>>> for that you have to check that string is alphanumeric or not. if it is
>>> alphanumeric then you have to call the function exapansion else you have to
>>> call the compression function.
>>>
>>> and
>>>
>>> if the desired output for *abc *is *a1b1c1* then you have to call the 
>>> *exapnsion
>>> function* or if the desired output is *abc* then you have to add a
>>> feature in the *compression function* i.e. in output the string have to
>>> omit the 1's
>>>
>>> --
>>> 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/-/8olzJ_YJVWMJ.
>>>
>>> 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.
>>>
>>
>>  --
>> 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, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: oracle finance questions

2011-10-03 Thread Rahul Tiwari
colg ?  pkg ???

On Oct 3, 7:36 pm, amit kannaujiya 
wrote:
> if any one know  regarding oracle finance online test, plz post type of
> questions asked in online test .

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Urgent sol needed

2011-10-03 Thread rahul sharma
@shruti ...u have used 2 arrays row n col extra?

On Mon, Oct 3, 2011 at 11:47 PM, Ankur Garg  wrote:

> Many times this problem has been discussed ..Please check the archives yaar
> :(
>
>
>
> On Mon, Oct 3, 2011 at 11:39 PM, Shruti Gupta wrote:
>
>> I had inserted 0 instead of 1 The corrected code will be:
>>  public static void setZeros(int[][] matrix) {
>>int[] row = new int[matrix.length];
>>int[] column = new int[matrix[0].length];
>>// Store the row and column index with value 0
>>  for (int i = 0; i < matrix.length; i++) {
>> for (int j = 0; j < matrix[0].length;j++) {
>> if (matrix[i][j] == 1) {
>>   row[i] = 1;
>>   column[j] = 1;
>>   }
>>   }
>>
>>  }
>>
>>   // Set arr[i][j] to 0 if either row i or column j has a 0
>>for (int i = 0; i < matrix.length; i++) {
>> for (int j = 0; j < matrix[0].length; j++) {
>> if ((row[i] == 1 || column[j] == 1)) {
>>matrix[i][j] = 1;
>> }
>>   }
>>   }
>>
>> On Oct 3, 11:06 pm, Shruti Gupta  wrote:
>> > Hi!
>> > A effecient way to solve the problem in O(1) space is by making use of
>> > the fact that instead of keeping track of which cell has a 0, we can
>> > just know which row or column has zero, as eventually that row/col
>> > will become 0. The code looks like this:
>> >
>> > public static void setZeros(int[][] matrix) {
>> >   int[] row = new int[matrix.length];
>> >   int[] column = new int[matrix[0].length];
>> >   // Store the row and column index with value 0
>> > for (int i = 0; i < matrix.length; i++) {
>> >for (int j = 0; j < matrix[0].length;j++) {
>> >if (matrix[i][j] == 0) {
>> >  row[i] = 1;
>> >  column[j] = 1;
>> >  }
>> >  }
>> >
>> > }
>> >
>> >  // Set arr[i][j] to 0 if either row i or column j has a 0
>> >   for (int i = 0; i < matrix.length; i++) {
>> >for (int j = 0; j < matrix[0].length; j++) {
>> >if ((row[i] == 1 || column[j] == 1)) {
>> >   matrix[i][j] = 0;
>> >}
>> >  }
>> >  }
>> >
>> > Thus there is no extra space taken.
>> >
>> > Shruti
>> >
>> > On Oct 3, 12:27 am, rahul sharma  wrote:
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > > nput is a matrix of size n x m of 0s and 1s.
>> >
>> > > eg:
>> > > 1 0 0 1
>> > > 0 0 1 0
>> > > 0 0 0 0
>> >
>> > > If a location has 1; make all the elements of that row and column = 1.
>> eg
>> >
>> > > 1 1 1 1
>> > > 1 1 1 1
>> > > 1 0 1 1
>> >
>> > > Solution should be with Time complexity = O(n*m) and O(1) extra space
>>
>> --
>> 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, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>  --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] New Group For Practicing and Learning Efficient Ways of Coding

2011-10-03 Thread Rahul Verma
@shady

we need moderators to stop spamming and to restrict the no. of problems

-- 
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/-/gArbDhccZG8J.
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.



Re: [algogeeks] Re: zigzag matrix

2011-10-03 Thread Rahul Verma
@Hatta 

Thanks a lot dear.

-- 
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/-/jCx1kM6n4RwJ.
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.



Re: [algogeeks] Re: zigzag matrix

2011-10-03 Thread Rahul Verma
we can achieve the zigzag form of the matrix by performing below steps:

int i=1,j=1;

For(i=0;i=n && i<=m) j increases upto value of m

Elseif(i>m) j increases upto value of n+m-i. 

}


*For e.g*

*for a 4X6 matrix*

*Input:*

1 2 3 4 5 6 

7 8 9 10 11 12

13 14 15 16 17 18

19 20 21 22 23 24

*Output:*

1

7 2

13 8 3

19 14 9 4 

20 15 10 5

21 16 11 6

22 17 12

23 18

24

-- 
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/-/_j3lxnLAnzQJ.
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.



[algogeeks] c help

2011-10-03 Thread rahul sharma
% p prints the corresponding argument that is pointer.can nyone given an
xample plz?

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] InterNSHIP for PRE final YEAR....................Hydrabaad MS

2011-10-03 Thread rahul sharma
http://www.microsoft-careers.com/job/Hyderabad-Intern-Job/1439341/?feedId=315&utm_source=Indeed

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: zigzag matrix

2011-10-03 Thread Rahul Verma
@Anika
 
What do you mean with the zigzag fashion here in problem?

-- 
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/-/5rO1BmBFlZwJ.
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.



Re: [algogeeks] Re: string compress/expand

2011-10-02 Thread rahul sharma
check my code for compression..

check if it is ok
abc i/p
o/p abc

means if character has no count.but still present in string it is its only
occurance.plz check that code...

#include
#include
int main()
{
cout<<"\nenter the string";
char str[30];
cin>>str;
int c=1;
for(int i=0;str[i];i++)
{
if(str[i+1]>='0' && str[i+1]<='9')
{
c=c+(str[i+1]-'0');
for(int j=1;jwrote:

> @rahul sharma
>
> for that you have to check that string is alphanumeric or not. if it is
> alphanumeric then you have to call the function exapansion else you have to
> call the compression function.
>
> and
>
> if the desired output for *abc *is *a1b1c1* then you have to call the 
> *exapnsion
> function* or if the desired output is *abc* then you have to add a feature
> in the *compression function* i.e. in output the string have to omit the
> 1's
>
> --
> 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/-/8olzJ_YJVWMJ.
>
> 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.
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: string compress/expand

2011-10-02 Thread Rahul Verma
@rahul sharma
 
for that you have to check that string is alphanumeric or not. if it is 
alphanumeric then you have to call the function exapansion else you have to 
call the compression function.
 
and
 
if the desired output for *abc *is *a1b1c1* then you have to call the 
*exapnsion 
function* or if the desired output is *abc* then you have to add a feature 
in the *compression function* i.e. in output the string have to omit the 1's 

-- 
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/-/8olzJ_YJVWMJ.
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.



Re: [algogeeks] Re: MS question

2011-10-02 Thread rahul sharma
yeah it is wrong..i have a solution but uses 0(n+m) space.i need it
in 0(n*m) tymand o(1) space

On Mon, Oct 3, 2011 at 11:55 AM, shady  wrote:

> search archives :-/
>
>
> On Mon, Oct 3, 2011 at 11:47 AM, pranav agrawal <
> pranav.is.cool.agra...@gmail.com> wrote:
>
>> @rahul sharma, i ran this code, it is producing wrong answer :|
>>
>> check it,  http://codepad.org/THv1hJq1
>>
>> anyone with correct solution?
>>
>>  --
>> 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/-/26XU3UBqZ6EJ.
>>
>> 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.
>>
>
>  --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: string compress/expand

2011-10-02 Thread rahul sharma
m talking for string expansion version ..that if i/p like aaabbbccc
then o/p   a3b3c3

n wat to do for abc i/p in that case???

On Mon, Oct 3, 2011 at 11:13 AM, rahul sharma wrote:

> @rahul verma
>
> yeah i know supposes i m doing for
>
> a3b3c3..
>
> o/p :- aaabbbccc
>
>
> if i give i/p: abc to same program
> then should it accept n display then errorrcoz abc not
> accepted...a1b1c1 is aceeptedor it will show abc as such..
> tell me wat to do for abc
>
>
> On Mon, Oct 3, 2011 at 11:04 AM, Rahul Verma wrote:
>
>> @Rahul
>>
>> Parse the string and check the next element of the array if it is exactly
>> the previous one then *increase the counter by 1* else no need to
>> increase the counter.
>>
>> --
>> 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/-/M08JxV-GeAsJ.
>> 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.
>>
>
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: string compress/expand

2011-10-02 Thread rahul sharma
@rahul verma

yeah i know supposes i m doing for

a3b3c3..

o/p :- aaabbbccc


if i give i/p: abc to same program
then should it accept n display then errorrcoz abc not accepted...a1b1c1
is aceeptedor it will show abc as such..
tell me wat to do for abc

On Mon, Oct 3, 2011 at 11:04 AM, Rahul Verma wrote:

> @Rahul
>
> Parse the string and check the next element of the array if it is exactly
> the previous one then *increase the counter by 1* else no need to increase
> the counter.
>
> --
> 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/-/M08JxV-GeAsJ.
> 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.
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: string compress/expand

2011-10-02 Thread Rahul Verma
@Rahul 
 
Parse the string and check the next element of the array if it is exactly 
the previous one then *increase the counter by 1* else no need to increase 
the counter.

-- 
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/-/M08JxV-GeAsJ.
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.



[algogeeks] Re: fibonicci doubt

2011-10-02 Thread rahul sharma
find the sum of all even nos. in the fibbonacci series upto 100

it means   upto when my term in fibonici is 100 stop...???ok?

On Mon, Oct 3, 2011 at 8:06 AM, rahul sharma wrote:

> guys if i have
>
> Print the sum of the even terms occuring in Fibbonaci (till 1000 terms)
>
> then i will go for(i=0;i<=1000;i++)
> {
>
> fibonicii code
>
> add if even
> }
> for 1000 fib terms
>
> if i have Print the sum of the even terms occuring in Fibbonaci (till
> 1000)
> it indicates that we will stop when we reached 1000 ..
>
> m i getting it ryt guys
>

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



<    1   2   3   4   5   6   7   8   9   >