[algogeeks] Microsoft online questions

2012-07-29 Thread Sanchit Mittal
Hi,

Can anybody help by sharing MS online test pattern and questions ?
I have heard they have also included aptitude questions this time, is that
right?

Thanks
-- 
Sanchit Mittal
Fourth Year Undergraduate
Computer Engineering
Delhi College of Engineering
ph- +919582414494

-- 
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] Stanford Online Study

2011-12-06 Thread sanchit mittal
Regards
--

Sanchit Mittal
Third Year Undergraduate
Computer Engineering
Delhi College of Engineering
ph- +919582414494


>
> Stanford Online Study – Win an iPad 2
>
> The MobiSocial Computing Lab at Stanford University is inviting people to 
> participate in a really cool online study. Please sign up to receive the 
> details. As a token of appreciation we are raffling an iPad 2.
>
> Follow this link.
>
> http://labs.stanford.edu/ipad/fdd3cb1a
>
>

-- 
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: NVIDIA Q

2011-07-06 Thread sanchit mittal
while runnin same code in .cpp format gives 1

On Thu, Jul 7, 2011 at 12:19 AM, sanchit mittal  wrote:

> Run dis in saving the same in .C format
> m getting 0...:)
>
> #include
> #include
>
> struct empty{};
>
> int main()
> {
>struct empty e;
>int x=sizeof(e);
> printf("%d",x);
> getch();
> return 0;
> }
>
>
>
> On Wed, Jul 6, 2011 at 11:58 PM, shiv narayan 
> wrote:
>
>> hey i am getting size of empty struct 1.
>> check my code
>>
>> #include
>> #include
>> using namespace std;
>> struct empty{};
>>
>> int main()
>> {
>>empty e;
>>int x=sizeof(e);
>> cout<> getch();
>> return 0;
>> }
>>
>> when i run this i get "1" as output
>>
>>
>> On Jul 6, 10:16 pm, Ashish Modi  wrote:
>> > @piyush:
>> > No,one can declare the variable of empty struct and access its address
>> via
>> > pointer. So, when you are accessing address via pointer means some
>> memory is
>> > allocated for that variable. But *sizeof()* operator returns *zero*??
>> why???
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > On Wed, Jul 6, 2011 at 10:38 PM, T3rminal  wrote:
>> > > @ashish
>> > > Most probably because empty struct in C have nothing associated with
>> it.
>> > > They are as good as nothing. But empty classes in C++ can have member
>> > > functions. These functions need to be associated with object, having a
>> > > unique address, for that class. And unique address is not possible
>> with
>> > > class of size 0 as already explained above.
>> >
>> > > --
>> > > 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/-/XP8yGGz2YbEJ.
>> >
>> > > 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.
>> >
>> > --
>> > With Regards
>> > Ashish Modi
>> > 9423721478
>>
>> --
>> 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.
>>
>>
>
>
> --
> Sanchit Mittal
> Second Year Undergraduate
> Computer Engineering
> Delhi College of Engineering
> ph- +919582414494
>
>


-- 
Sanchit Mittal
Second Year Undergraduate
Computer Engineering
Delhi College of Engineering
ph- +919582414494

-- 
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: NVIDIA Q

2011-07-06 Thread sanchit mittal
Run dis in saving the same in .C format
m getting 0...:)

#include
#include

struct empty{};

int main()
{
   struct empty e;
   int x=sizeof(e);
printf("%d",x);
getch();
return 0;
}



On Wed, Jul 6, 2011 at 11:58 PM, shiv narayan wrote:

> hey i am getting size of empty struct 1.
> check my code
>
> #include
> #include
> using namespace std;
> struct empty{};
>
> int main()
> {
>empty e;
>int x=sizeof(e);
> cout< getch();
> return 0;
> }
>
> when i run this i get "1" as output
>
>
> On Jul 6, 10:16 pm, Ashish Modi  wrote:
> > @piyush:
> > No,one can declare the variable of empty struct and access its address
> via
> > pointer. So, when you are accessing address via pointer means some memory
> is
> > allocated for that variable. But *sizeof()* operator returns *zero*??
> why???
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > On Wed, Jul 6, 2011 at 10:38 PM, T3rminal  wrote:
> > > @ashish
> > > Most probably because empty struct in C have nothing associated with
> it.
> > > They are as good as nothing. But empty classes in C++ can have member
> > > functions. These functions need to be associated with object, having a
> > > unique address, for that class. And unique address is not possible with
> > > class of size 0 as already explained above.
> >
> > > --
> > > 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/-/XP8yGGz2YbEJ.
> >
> > > 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.
> >
> > --
> > With Regards
> > Ashish Modi
> > 9423721478
>
> --
> 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.
>
>


-- 
Sanchit Mittal
Second Year Undergraduate
Computer Engineering
Delhi College of Engineering
ph- +919582414494

-- 
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: If any one have algorithms for interviews by adnan aziz ebook... Please mail ...

2011-05-06 Thread sanchit mittal
email dis buk to me too... sm14it...@gmail.com

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To 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: RR Scheduling

2011-03-22 Thread sanchit mittal
gtcha:)

-- 
Sanchit Mittal
Second Year Undergraduate
Computer Engineering
Delhi College of Engineering
ph- +919582414494

-- 
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: RR Scheduling

2011-03-21 Thread sanchit mittal
i said dis bcuzaccording to me akshata's algo has linear time while urs,
i guess has square tym complexity..correct me if m wrong

On Tue, Mar 22, 2011 at 12:09 AM, ayush bhutani wrote:

> @sanchit  nested loops does not mean TLE
> I have just traversed the whole process's time array once for each elapse
> time calculations ie O(n)  and O(n^2) in total. I am not able to figure out
> a faster method or a DP approach. Suggestions awaited
>
>  On Mon, Mar 21, 2011 at 11:20 PM, sanchit mittal wrote:
>
>> with so many nested loops u r obvcly goin to get tle
>>
>>
>> On Mon, Mar 21, 2011 at 11:07 PM, ayush bhutani 
>> wrote:
>>
>>> I have got a better algo
>>> But I am also getting TLE
>>> #include
>>> int main(){
>>>int n,i,j;
>>>long t[5];
>>>long  elapse[5];
>>>scanf("%d",&n);
>>>for(i=0;i>>scanf("%ld",&t[i]);
>>>elapse[i]=0;
>>>}
>>>for(i=0;i>>
>>>for(j=0;j>>if(j!=i){
>>>if(t[j]>>elapse[i] +=t[j];
>>>}
>>>else{
>>>if(j>>elapse[i]+=t[i];
>>>}
>>>else{
>>>elapse[i] +=(t[i]-1);
>>>}
>>>}
>>>}
>>>else{
>>>elapse[i] +=t[i];
>>>}
>>>}
>>>}
>>>for(i=0;i>>printf("%ld\n",elapse[i]);
>>>}
>>>
>>>return 0;
>>>  }
>>>
>>>
>>> On 3/21/11, Akshata Sharma  wrote:
>>> > Which data structure to use for getting it accepted?? This algorithm
>>> > gives tle. Using scanf, printf  is also resulting in tle.
>>> >
>>> > On Mar 21, 7:06 pm, radha krishnan 
>>> > wrote:
>>> >> U have to use Some  Advanced Data Structures for this problem
>>> >> :P
>>> >>
>>> >>
>>> >>
>>> >> On Mon, Mar 21, 2011 at 3:02 PM, saurabh singh 
>>> >> wrote:
>>> >> > using scanf and printf and still tle,I am not pretty sure how malloc
>>> or
>>> >> > new
>>> >> > arrays can speed up execution?
>>> >>
>>> >> > On Mon, Mar 21, 2011 at 2:25 PM, sanchit mittal <
>>> sm14it...@gmail.com>
>>> >> > wrote:
>>> >>
>>> >> >> use scanf n printf instead of cin n cout,
>>> >> >> malloc array of structures after reading value of n if working in c
>>> >> >> else
>>> >> >> use new in cpp
>>> >> >> rest i guess...is ok
>>> >> >> On Sun, Mar 20, 2011 at 11:53 PM, ankit sambyal
>>> >> >> 
>>> >> >> wrote:
>>> >>
>>> >> >>> I worked on this problem but cud not get a more efficient algo
>>> than
>>> >> >>> yours.
>>> >> >>> Plz get back 2 me if u find a better algo.
>>> >>
>>> >> >>> On Sun, Mar 20, 2011 at 3:24 AM, Akshata Sharma
>>> >> >>>  wrote:
>>> >>
>>> >> >>>> I tried to solve this problem
>>> >> >>>>https://www.spoj.pl/problems/RRSCHED/
>>> >>
>>> >> >>>> I am getting TLE!! How can I improve my code??
>>> >>
>>> >> >>>> #include
>>> >> >>>> #include
>>> >>
>>> >> >>>> using namespace std;
>>> >>
>>> >> >>>> struct process
>>> >> >>>> {
>>> >> >>>> long time;
>>> >> >>>> int finished;
>>> >> >>>> long elapsed_time;
>>> >> >>>> };
>>> >>
>>> >> >>>> int main()
>>> >> >>>> {
>>> >> >>>> long n,sum=0;
>>> >> >>>> cin>>n;
>>> >> >>>> struct process prss[5];
>>> >> >>>> for(long i=0;i>> >> >>>> {
>>> >&g

Re: [algogeeks] Re: RR Scheduling

2011-03-21 Thread sanchit mittal
with so many nested loops u r obvcly goin to get tle

On Mon, Mar 21, 2011 at 11:07 PM, ayush bhutani wrote:

> I have got a better algo
> But I am also getting TLE
> #include
> int main(){
>int n,i,j;
>long t[5];
>long  elapse[5];
>scanf("%d",&n);
>for(i=0;iscanf("%ld",&t[i]);
>elapse[i]=0;
>}
>for(i=0;i
>for(j=0;jif(j!=i){
>if(t[j]elapse[i] +=t[j];
>}
>else{
>if(jelapse[i]+=t[i];
>}
>else{
>elapse[i] +=(t[i]-1);
>}
>}
>}
>else{
>elapse[i] +=t[i];
>}
>}
>}
>for(i=0;iprintf("%ld\n",elapse[i]);
>}
>
>return 0;
> }
>
>
> On 3/21/11, Akshata Sharma  wrote:
> > Which data structure to use for getting it accepted?? This algorithm
> > gives tle. Using scanf, printf  is also resulting in tle.
> >
> > On Mar 21, 7:06 pm, radha krishnan 
> > wrote:
> >> U have to use Some  Advanced Data Structures for this problem
> >> :P
> >>
> >>
> >>
> >> On Mon, Mar 21, 2011 at 3:02 PM, saurabh singh 
> >> wrote:
> >> > using scanf and printf and still tle,I am not pretty sure how malloc
> or
> >> > new
> >> > arrays can speed up execution?
> >>
> >> > On Mon, Mar 21, 2011 at 2:25 PM, sanchit mittal 
> >> > wrote:
> >>
> >> >> use scanf n printf instead of cin n cout,
> >> >> malloc array of structures after reading value of n if working in c
> >> >> else
> >> >> use new in cpp
> >> >> rest i guess...is ok
> >> >> On Sun, Mar 20, 2011 at 11:53 PM, ankit sambyal
> >> >> 
> >> >> wrote:
> >>
> >> >>> I worked on this problem but cud not get a more efficient algo than
> >> >>> yours.
> >> >>> Plz get back 2 me if u find a better algo.
> >>
> >> >>> On Sun, Mar 20, 2011 at 3:24 AM, Akshata Sharma
> >> >>>  wrote:
> >>
> >> >>>> I tried to solve this problem
> >> >>>>https://www.spoj.pl/problems/RRSCHED/
> >>
> >> >>>> I am getting TLE!! How can I improve my code??
> >>
> >> >>>> #include
> >> >>>> #include
> >>
> >> >>>> using namespace std;
> >>
> >> >>>> struct process
> >> >>>> {
> >> >>>> long time;
> >> >>>> int finished;
> >> >>>> long elapsed_time;
> >> >>>> };
> >>
> >> >>>> int main()
> >> >>>> {
> >> >>>> long n,sum=0;
> >> >>>> cin>>n;
> >> >>>> struct process prss[5];
> >> >>>> for(long i=0;i >> >>>> {
> >> >>>> scanf("%ld",&prss[i].time);
> >> >>>> prss[i].finished=0;
> >> >>>> sum+=prss[i].time;
> >> >>>> }
> >> >>>> long index=0;
> >> >>>>  for(long k=1;k<=sum;k++)
> >> >>>> {
> >> >>>>   while(prss[index].finished==1)
> >> >>>>   index++;
> >>
> >> >>>>   prss[index].time--;
> >>
> >> >>>>   if(prss[index].time==0)
> >> >>>>   {
> >> >>>>prss[index].finished=1;
> >> >>>>prss[index].elapsed_time=k;
> >> >>>>   }
> >>
> >> >>>>   index++;
> >> >>>>   if(index==n)
> >> >>>>   index=0;
> >> >>>> }
> >>
> >> >>>> for(long i=0;i >> >>>> printf("%ld\n",prss[i].elapsed_time);
> >> >>>> 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@googl

Re: [algogeeks] Re: prime number using Sieve of Eratosthenes

2011-03-21 Thread sanchit mittal
hav a look at dis one...prime no upto 10

#define N 10
bool mark [N];
memset (mark, true, sizeof (mark));
mark [0] = mark [1] = false;
for ( int i = 4; i < N; i += 2 ) mark [i] = false;
 for ( int i = 3; i * i <= N; i += 2 ) {

 if ( mark [i] ) {

 for ( int j = i * i; j < N; j += 2 * i ) mark [j] = false;
 }
}

mark[i]=true ,, i represents prime no.
-- 
Sanchit Mittal
Second Year Undergraduate
Computer Engineering
Delhi College of Engineering
ph- +919582414494

-- 
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] RR Scheduling

2011-03-21 Thread sanchit mittal
u tokin of any kinda tree?

On Mon, Mar 21, 2011 at 7:36 PM, radha krishnan <
radhakrishnance...@gmail.com> wrote:

> U have to use Some  Advanced Data Structures for this problem
> :P
>  On Mon, Mar 21, 2011 at 3:02 PM, saurabh singh 
> wrote:
> > using scanf and printf and still tle,I am not pretty sure how malloc or
> new
> > arrays can speed up execution?
> >
> > On Mon, Mar 21, 2011 at 2:25 PM, sanchit mittal 
> wrote:
> >>
> >> use scanf n printf instead of cin n cout,
> >> malloc array of structures after reading value of n if working in c else
> >> use new in cpp
> >> rest i guess...is ok
> >> On Sun, Mar 20, 2011 at 11:53 PM, ankit sambyal  >
> >> wrote:
> >>>
> >>> I worked on this problem but cud not get a more efficient algo than
> >>> yours.
> >>> Plz get back 2 me if u find a better algo.
> >>>
> >>> On Sun, Mar 20, 2011 at 3:24 AM, Akshata Sharma
> >>>  wrote:
> >>>>
> >>>> I tried to solve this problem
> >>>> https://www.spoj.pl/problems/RRSCHED/
> >>>>
> >>>> I am getting TLE!! How can I improve my code??
> >>>>
> >>>> #include
> >>>> #include
> >>>>
> >>>> using namespace std;
> >>>>
> >>>> struct process
> >>>> {
> >>>> long time;
> >>>> int finished;
> >>>> long elapsed_time;
> >>>> };
> >>>>
> >>>> int main()
> >>>> {
> >>>> long n,sum=0;
> >>>> cin>>n;
> >>>> struct process prss[5];
> >>>> for(long i=0;i >>>> {
> >>>> scanf("%ld",&prss[i].time);
> >>>> prss[i].finished=0;
> >>>> sum+=prss[i].time;
> >>>> }
> >>>> long index=0;
> >>>>  for(long k=1;k<=sum;k++)
> >>>> {
> >>>>   while(prss[index].finished==1)
> >>>>   index++;
> >>>>
> >>>>   prss[index].time--;
> >>>>
> >>>>   if(prss[index].time==0)
> >>>>   {
> >>>>prss[index].finished=1;
> >>>>prss[index].elapsed_time=k;
> >>>>   }
> >>>>
> >>>>   index++;
> >>>>   if(index==n)
> >>>>   index=0;
> >>>> }
> >>>>
> >>>> for(long i=0;i >>>> printf("%ld\n",prss[i].elapsed_time);
> >>>> 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.
> >>
> >>
> >>
> >> --
> >> Sanchit Mittal
> >> Second Year Undergraduate
> >> Computer Engineering
> >> Delhi College of Engineering
> >> ph- +919582414494
> >>
> >> --
> >> 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 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.
>
>


-- 
Sanchit Mittal
Second Year Undergraduate
Computer Engineering
Delhi College of Engineering
ph- +919582414494

-- 
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] RR Scheduling

2011-03-21 Thread sanchit mittal
use scanf n printf instead of cin n cout,
malloc array of structures after reading value of n if working in c else use
new in cpp
rest i guess...is ok
On Sun, Mar 20, 2011 at 11:53 PM, ankit sambyal wrote:

> I worked on this problem but cud not get a more efficient algo than yours.
> Plz get back 2 me if u find a better algo.
>
>
> On Sun, Mar 20, 2011 at 3:24 AM, Akshata Sharma  > wrote:
>
>> I tried to solve this problem
>> https://www.spoj.pl/problems/RRSCHED/
>>
>> I am getting TLE!! How can I improve my code??
>>
>> #include
>> #include
>>
>> using namespace std;
>>
>> struct process
>> {
>> long time;
>> int finished;
>> long elapsed_time;
>> };
>>
>> int main()
>> {
>> long n,sum=0;
>> cin>>n;
>> struct process prss[5];
>> for(long i=0;i> {
>> scanf("%ld",&prss[i].time);
>> prss[i].finished=0;
>> sum+=prss[i].time;
>> }
>> long index=0;
>>  for(long k=1;k<=sum;k++)
>> {
>>   while(prss[index].finished==1)
>>   index++;
>>
>>   prss[index].time--;
>>
>>   if(prss[index].time==0)
>>   {
>>prss[index].finished=1;
>>prss[index].elapsed_time=k;
>>   }
>>
>>   index++;
>>   if(index==n)
>>   index=0;
>> }
>>
>> for(long i=0;i> printf("%ld\n",prss[i].elapsed_time);
>> 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.
>



-- 
Sanchit Mittal
Second Year Undergraduate
Computer Engineering
Delhi College of Engineering
ph- +919582414494

-- 
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: chk dis out

2011-03-20 Thread sanchit mittal
@dave...plz read the q carefully before answering the q.
nice link anurag...:))

On Sun, Mar 20, 2011 at 11:03 PM, Dave  wrote:

> @Akash: The sum of the numbers from 1 to n is S(n) = n*(n+1)/2. Thus,
> the sum of the numbers from a to b is S = S(b) - S(a-1) = ( b*(b+1) -
> a*(a-1) ) / 2.
>
> Dave
>
> On Mar 20, 9:08 am, Akash Mukherjee  wrote:
> > Majid is a 3rd-grade elementary student and quite well in mathematics.
> Once,
> > Majid's teacher asked him to calculate the sum of numbers 1 through n.
> >
> > Majid quickly answered, and his teacher made him another challenge. He
> asked
> > Majid to calculate the sum of the digits of numbers 1 through n.
> >
> > Majid did finally find the solution. Now it is your turn, can you find a
> > solution?
> > Input
> >
> > Two space-separated integers 0 <= a <= b <= 109.
> >
> > Program terminates if a and b are -1.
> > Output
> >
> > The sum of the digits of numbers a through b.
> > Example
> >
> > *Input:*
> > 1 10
> > 100 777
> > -1 -1
> > *Output:*
> > 46
> > 8655
> >
> > ne ideas??
>
> --
> 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.
>
>


-- 
Sanchit Mittal
Second Year Undergraduate
Computer Engineering
Delhi College of Engineering
ph- +919582414494

-- 
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] Special Binary Tree Again

2011-02-14 Thread sanchit mittal
explain algo instead of writing the code.
thanx

On Mon, Feb 14, 2011 at 9:28 PM, jalaj jaiswal wrote:

> @tushar that would modify the tree structure
>
> here is a different approach
>
> int count=0;  //global
> void modified_inorder(node *root){
>if(root!=NULL){
>  modified_inorder(root->left);
>  node *temp;
>  if(count==0){
>   root->p=NULL;
>   temp=root;
>   count++;
>   }
>  else{
> if(root->p!=temp){
> root->p=NULL;
> }
> temp=root;
>
> }
>
> }
>
> On Mon, Feb 14, 2011 at 7:59 PM, Tushar Bindal wrote:
>
>> I think the following algo should work:
>> 1. Create a DLL of the inorder traversal of the tree
>> 2. for each node, check whether P of that node points to the previous node
>> in the DLL or not.
>> 3. If not, assign it value NULL
>>
>>
>>
>> --
>> Tushar Bindal
>> Computer Engineering
>> Delhi College of Engineering
>> Mob: +919818442705
>> E-Mail : tusharbin...@jugadengg.com, tushicom...@gmail.com
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To 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.
>>
>
>
>
> --
> With Regards,
> *Jalaj Jaiswal* (+919019947895)
> Software developer, Cisco Systems
> B.Tech IIIT 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.
>



-- 
Sanchit Mittal
Second Year Undergraduate
Computer Engineering
Delhi College of Engineering
ph- +919582414494

-- 
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: Single linked list questions.

2011-01-06 Thread sanchit mittal
lgorithm Geeks" group.
>>>>>>>>>> To post to this group, send email to algoge...@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.
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>  --
>>>>>>>>> SOURABH JAKHAR,(CSE)(3 year)
>>>>>>>>> ROOM NO 167 ,
>>>>>>>>> TILAK,HOSTEL
>>>>>>>>> 'MNNIT ALLAHABAD
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>  The Law of Win says, "Let's not do it your way or my way; let's
>>>>>>>>> do it the best way."
>>>>>>>>>
>>>>>>>>>   --
>>>>>>>>>  You received this message because you are subscribed to the
>>>>>>>>> Google Groups "Algorithm Geeks" group.
>>>>>>>>> To post to this group, send email to algoge...@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 algoge...@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
>>>>>>> Aditya Kumar
>>>>>>> B-tech 3rd year
>>>>>>> Computer Science & Engg.
>>>>>>> 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 algoge...@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 algoge...@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.
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Cheers
>>>>> Naveen Kumar
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Algorithm Geeks" group.
>>>>> To post to this group, send email to algoge...@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 Aditya
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Algorithm Geeks" group.
>>>>> To post to this group, send email to algoge...@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 algoge...@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.
>>>>
>>>
>>>
>>>
>>> --
>>> Cheers
>>> Naveen Kumar
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algoge...@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 algoge...@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.
>>
>
>
>
> --
> S.Nishaanth,
> Computer Science and engineering,
> IIT Madras.
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@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.
>



-- 
Sanchit Mittal
Second Year Undergraduate
Department of Computer Engineering
Delhi College of Engineering
ph- +919582414494

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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] codechef jan challenge

2011-01-02 Thread sanchit mittal
http://www.codechef.com/JAN11/problems/FLUSHOT/

*m getting wrong answer*
*if there is any problem wid my algorythm do let me know*


#include


> int main()

{

int t,D,N,j,i;

float T,*x,*y,*z,maxNo,minNo;

scanf("%d",&t);

while(t--)

{

scanf("%d %f",&N,&T);

x=(float*)malloc(sizeof(float)*(N+1));

y=(float*)malloc(sizeof(float)*(N+1));

z=(float*)malloc(sizeof(float)*(N+1));

for(i=0;imaxNo)

   maxNo=x[i];

  }



}

else

{maxNo=0.0;

 j=0;

 for(i=0;imaxNo)

   { maxNo=y[i];}





 if(z[j]>minNo && j!=0 &&y[i]<0)

{ minNo=z[j];}

 if(y[i]<0)

{j++;}

  if(j==1 &&y[i]<0)

{minNo=z[0];}

}



if(N==2)

 maxNo=maxNo/2;

else maxNo=(maxNo+minNo)/2;



 }



   printf("%.4f\n",maxNo);

}



return 0;

}


-- 
Sanchit Mittal
Second Year Undergraduate
Department of Computer Engineering
Delhi College of Engineering
ph- +919582414494

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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: Float Comparison

2011-01-02 Thread sanchit mittal
oups gt my mistake.btw hnx for replying

On Sun, Jan 2, 2011 at 10:10 PM, juver++  wrote:

> There is no need in epsilon comparison when you need to compare it with <
> or > operators.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@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.
>



-- 
Sanchit Mittal
Second Year Undergraduate
Department of Computer Engineering
Delhi College of Engineering
ph- +919582414494

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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: Float Comparison

2011-01-02 Thread sanchit mittal
#include
#include
int main()
{
int t,D,N,i;
float T,*x,*y,*z,maxNo,minNo;
scanf("%d",&t);
while(t--)
{
scanf("%d %f",&N,&T);
x=(float*)malloc(sizeof(float)*(N+1));
y=(float*)malloc(sizeof(float)*(N+1));
//z=(float*)malloc(sizeof(float)*(N+1));
for(i=0;imaxNo)
   maxNo=x[i];
  }

}
else
{
 for(i=0;imaxNo)
  { printf("max, y%d %f, %f\n",i,maxNo,y[i]);/*here is the
problem max before entering this loop evrytym has value 0.000 which i hav
changed evrytym */
   maxNo=y[i];
   printf("maxafter %f",maxNo);}

 if(y[i] wrote:

> There is no need in epsilon comparison when you need to compare it with <
> or > operators.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@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.
>



-- 
Sanchit Mittal
Second Year Undergraduate
Department of Computer Engineering
Delhi College of Engineering
ph- +919582414494

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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: Float Comparison

2011-01-02 Thread sanchit mittal
i dont know how shud i modify my code using epsilon shall i mail it to
someone or straightaway post it here .?


On Sun, Jan 2, 2011 at 9:58 PM, sanchit mittal  wrote:

> i was doin a check on which one of the two floats is greater using > sign
> but was unable to do soi m actually solving this prob:
> http://www.codechef.com/JAN11/problems/FLUSHOT/
>  <http://www.codechef.com/JAN11/problems/FLUSHOT/>i hav code wid me shud i
> post it here?
>
>
> On Sun, Jan 2, 2011 at 9:13 PM, juver++  wrote:
>
>> a == b ==> a < b - EPS
>> a <= b ==> a < b + EPS
>>
>> all other relations are straighforward.
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algoge...@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.
>>
>
>
>
> --
> Sanchit Mittal
> Department of Computer Engineering
> Delhi College of Engineering
> ph- +919582414494
>



-- 
Sanchit Mittal
Department of Computer Engineering
Delhi College of Engineering
ph- +919582414494

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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: Float Comparison

2011-01-02 Thread sanchit mittal
i was doin a check on which one of the two floats is greater using > sign
but was unable to do soi m actually solving this prob:
http://www.codechef.com/JAN11/problems/FLUSHOT/
<http://www.codechef.com/JAN11/problems/FLUSHOT/>i hav code wid me shud i
post it here?

On Sun, Jan 2, 2011 at 9:13 PM, juver++  wrote:

> a == b ==> a < b - EPS
> a <= b ==> a < b + EPS
>
> all other relations are straighforward.
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@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.
>



-- 
Sanchit Mittal
Department of Computer Engineering
Delhi College of Engineering
ph- +919582414494

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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.