[algogeeks] Feedback of the book!!!!!!!

2011-07-31 Thread AMAN AGARWAL
Hi,

I am planning to buy a book

cracking the coding interview by Gayle Laakmann. Please give your feedbacks.



-- 
AMAN AGARWAL
"Success is not final, Failure is not fatal: It is the courage to continue
that counts!"

-- 
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] How to write the algorithm for longest increasing subsequence problem with complexity O(n logn)

2011-07-31 Thread Piyush Gaurav
u need a 2,4 tree for dat


On 1 August 2011 11:59, Amol Sharma  wrote:

> can be done with some modification on dp solution of O(n^2).
>
> i am comfortable with the O(n^2) solution. but i am also having
> difficulty in O(nlogn) solution
>
> check this link
> http://www.algorithmist.com/index.php/Longest_Increasing_Subsequence
>
>
> --
>
>
> Amol Sharma
> Third Year Student
> Computer Science and Engineering
> MNNIT Allahabad
>
>
>
>
> On Mon, Aug 1, 2011 at 11:49 AM, kumar raja wrote:
>
>>
>>
>> --
>> Regards
>> Kumar Raja
>> M.Tech(SIT)
>> IIT Kharagpur,
>> 10it60...@iitkgp.ac.in
>> 7797137043.
>> 09491690115.
>>
>>  --
>> 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.
>



-- 
3rd Year student
Dept. of Computer Science and Engineering
IIT Kharagpur.

-- 
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: Direct - i ques

2011-07-31 Thread Amol Sharma
check the link given by DK for queue and see my post in this thread for
stack for doing in O(1)..you guys are discussing the things which are
already discussed !!
--


Amol Sharma
Third Year Student
Computer Science and Engineering
MNNIT Allahabad




On Mon, Aug 1, 2011 at 11:20 AM, Aman (neshu) Agarwal <
neshuagarwal1...@gmail.com> wrote:

> Think in terms of vector(C++, STL) :P
>
>
> On Mon, Aug 1, 2011 at 11:01 AM, ankit sablok  wrote:
>
>> finding min will not take O(1) time in a stack i guess
>>
>>
>> On Mon, Aug 1, 2011 at 10:32 AM, kartik sachan 
>> wrote:
>>
>>> I think its stack  where deletion insertion and finding min (as we will
>>> cal min at the time of insertion only by taking min val ) will take O(1)
>>> time
>>>
>>> correct me if i am worng...!
>>>
>>> --
>>> 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.
>>
>
>
>
> --
> Aman Agarwal
>
> "Success is not final, Failure is not fatal: It is the courage to continue
> that counts!"
>
>
>  --
> 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] How to write the algorithm for longest increasing subsequence problem with complexity O(n logn)

2011-07-31 Thread Amol Sharma
can be done with some modification on dp solution of O(n^2).

i am comfortable with the O(n^2) solution. but i am also having
difficulty in O(nlogn) solution

check this link
http://www.algorithmist.com/index.php/Longest_Increasing_Subsequence


--


Amol Sharma
Third Year Student
Computer Science and Engineering
MNNIT Allahabad




On Mon, Aug 1, 2011 at 11:49 AM, kumar raja wrote:

>
>
> --
> Regards
> Kumar Raja
> M.Tech(SIT)
> IIT Kharagpur,
> 10it60...@iitkgp.ac.in
> 7797137043.
> 09491690115.
>
>  --
> 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] How to write the algorithm for longest increasing subsequence problem with complexity O(n logn)

2011-07-31 Thread kumar raja
-- 
Regards
Kumar Raja
M.Tech(SIT)
IIT Kharagpur,
10it60...@iitkgp.ac.in
7797137043.
09491690115.

-- 
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: Direct - i ques

2011-07-31 Thread Aman (neshu) Agarwal
Think in terms of vector(C++, STL) :P

On Mon, Aug 1, 2011 at 11:01 AM, ankit sablok  wrote:

> finding min will not take O(1) time in a stack i guess
>
>
> On Mon, Aug 1, 2011 at 10:32 AM, kartik sachan wrote:
>
>> I think its stack  where deletion insertion and finding min (as we will
>> cal min at the time of insertion only by taking min val ) will take O(1)
>> time
>>
>> correct me if i am worng...!
>>
>> --
>> 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.
>



-- 
Aman Agarwal

"Success is not final, Failure is not fatal: It is the courage to continue
that counts!"

-- 
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: Direct - i ques

2011-07-31 Thread ankit sablok
finding min will not take O(1) time in a stack i guess

On Mon, Aug 1, 2011 at 10:32 AM, kartik sachan wrote:

> I think its stack  where deletion insertion and finding min (as we will cal
> min at the time of insertion only by taking min val ) will take O(1) time
>
> correct me if i am worng...!
>
> --
> 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: Direct - i ques

2011-07-31 Thread kartik sachan
I think its stack  where deletion insertion and finding min (as we will cal
min at the time of insertion only by taking min val ) will take O(1) time

correct me if i am worng...!

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

2011-07-31 Thread Rahul
Refer 6.046 videos
On Aug 1, 2011 8:59 AM, "Amol Sharma"  wrote:
> do it yourselfask if any problem
> --
>
>
> Amol Sharma
> Third Year Student
> Computer Science and Engineering
> MNNIT Allahabad
>
>
>
>
> On Mon, Aug 1, 2011 at 8:48 AM, Atul Verma  wrote:
>
>> do counting sort
>>
>> --
>> 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]

2011-07-31 Thread Amol Sharma
do it yourselfask if any problem
--


Amol Sharma
Third Year Student
Computer Science and Engineering
MNNIT Allahabad




On Mon, Aug 1, 2011 at 8:48 AM, Atul Verma  wrote:

> do counting sort
>
>  --
> 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] binary search

2011-07-31 Thread Anurag atri
int Modified_BinarySearch(int A[], int N, int value) {
   int low = 0;
   int high = N;
   while (low < high) {
   int mid = (low + high)/2;
   if (A[mid] < value)
   low = mid + 1;
   else
high = mid;
   }
   if ((low < N) && (A[low] == value))
   return low;
   else
   return -1;
   }


Regards
Anurag Atri

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

2011-07-31 Thread Atul Verma
do counting sort

-- 
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: 100th Fibonacci number using LL

2011-07-31 Thread bharath
@Saurabh: :)

Well, I could think of a way of solving this without using other
libraries.

Use iterative version of fibonacci numbers but when adding the ith and
(i+1)st values, use circular linked lists (or doubly linked lists) to
add these 2 values. Since the question of integer overflow does not
come into picture when 2 big numbers are added, there is no problem.

As an optimization, one can use linked lists for addition only when
values get close to max integer value.

Bharath.

On Jul 31, 8:38 pm, saurabh singh  wrote:
> By creating a bugnum library using link list:)
>
>
>
>
>
>
>
>
>
> On Sun, Jul 31, 2011 at 11:12 PM, bharath  wrote:
> > @Amit: Thanks for the solution but I have seen this approach. I was
> > wondering how this can be solved using linked lists without using
> > bignum libraries.
>
> > Bharath
>
> > On Jul 31, 12:38 pm, amit karmakar  wrote:
> > > Since long long cannot store the 100th Fibonacci number, you need to
> > > implement or use an existing library for bignum.
>
> > > You may use linked lists to solve this problem.
> > > Read about bignum herehttp://
> > en.wikipedia.org/wiki/Arbitrary-precision_arithmetic
>
> > > Here is my implementation for solving this problem,
> > > #include 
> > > #include 
> > > #include 
>
> > > using namespace std;
>
> > > #define REP(i, n) for(int i = 0; i < (n); i++)
> > > #define FILL(c, v) memset(c, v, sizeof(c))
>
> > > const int MX = 10;
> > > int prv1[MX], prv2[MX], cur[MX], l1, l2, lcur;
>
> > > int main() {
> > >     FILL(prv1, 0); FILL(prv2, 0); FILL(cur, 0);
> > >     int n;
> > >     scanf("%d", &n);
>
> > >     prv1[0] = 0; l1 = 1;
> > >     prv2[0] = 1; l2 = 1;
> > >     cur[0]  = 0; lcur = 1;
> > >     REP(i, n) {
> > >         int mx = max(l1, l2);
> > >         int carry = 0;
> > >         REP(j, mx) {
> > >             int imd = prv1[j]+prv2[j]+carry;
> > >             cur[j]  = imd%10;
> > >             carry   = imd/10;
> > >         }
> > >         if(carry) {
> > >             cur[mx++] = carry;
> > >         }
> > >         lcur = mx;
>
> > >         REP(j, l1)   prv2[j] = prv1[j]; l2=l1;
> > >         REP(j, lcur) prv1[j] = cur[j];  l1=lcur;
> > >     }
> > >     REP(i, lcur) printf("%d", cur[lcur-i-1]); printf("\n");
>
> > > }
>
> > > On Jul 31, 9:31 pm, bharath sriram  wrote:
>
> > > > Since both the "normal" recursive (stack overflow) and non-recursive
> > (data
> > > > type overflow) versions fails, is there a  way one can use linked lists
> > to
> > > > solve this problem?
>
> > > > Bharath.
>
> > --
> > 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] Re: 100th Fibonacci number using LL

2011-07-31 Thread saurabh singh
By creating a bugnum library using link list:)

On Sun, Jul 31, 2011 at 11:12 PM, bharath  wrote:

> @Amit: Thanks for the solution but I have seen this approach. I was
> wondering how this can be solved using linked lists without using
> bignum libraries.
>
> Bharath
>
> On Jul 31, 12:38 pm, amit karmakar  wrote:
> > Since long long cannot store the 100th Fibonacci number, you need to
> > implement or use an existing library for bignum.
> >
> > You may use linked lists to solve this problem.
> > Read about bignum herehttp://
> en.wikipedia.org/wiki/Arbitrary-precision_arithmetic
> >
> > Here is my implementation for solving this problem,
> > #include 
> > #include 
> > #include 
> >
> > using namespace std;
> >
> > #define REP(i, n) for(int i = 0; i < (n); i++)
> > #define FILL(c, v) memset(c, v, sizeof(c))
> >
> > const int MX = 10;
> > int prv1[MX], prv2[MX], cur[MX], l1, l2, lcur;
> >
> > int main() {
> > FILL(prv1, 0); FILL(prv2, 0); FILL(cur, 0);
> > int n;
> > scanf("%d", &n);
> >
> > prv1[0] = 0; l1 = 1;
> > prv2[0] = 1; l2 = 1;
> > cur[0]  = 0; lcur = 1;
> > REP(i, n) {
> > int mx = max(l1, l2);
> > int carry = 0;
> > REP(j, mx) {
> > int imd = prv1[j]+prv2[j]+carry;
> > cur[j]  = imd%10;
> > carry   = imd/10;
> > }
> > if(carry) {
> > cur[mx++] = carry;
> > }
> > lcur = mx;
> >
> > REP(j, l1)   prv2[j] = prv1[j]; l2=l1;
> > REP(j, lcur) prv1[j] = cur[j];  l1=lcur;
> > }
> > REP(i, lcur) printf("%d", cur[lcur-i-1]); printf("\n");
> >
> > }
> >
> > On Jul 31, 9:31 pm, bharath sriram  wrote:
> >
> >
> >
> >
> >
> >
> >
> > > Since both the "normal" recursive (stack overflow) and non-recursive
> (data
> > > type overflow) versions fails, is there a  way one can use linked lists
> to
> > > solve this problem?
> >
> > > Bharath.
>
> --
> 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] Re: Direct - i ques

2011-07-31 Thread DK
This question has already been discussed in depth previously:

There are 2 ways to do this:
1. Using 4 stacks (actually 2 min stacks)
2. Using a queue and a deque

A highly detailed, easy to understand discussion of the problem 
has already taken place in the group previously:

The complete discussion thread:
https://groups.google.com/d/topic/algogeeks/NxFXQjSN7bo/discussion

My Solution for the problem (with additional bonus results) as a method that 
hasn't been posted
anywhere else on the web:
https://groups.google.com/d/msg/algogeeks/NxFXQjSN7bo/iHm62yEZOgcJ

--
DK

http://gplus.to/divyekapoor
http://www.divye.in
http://twitter.com/divyekapoor

-- 
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/-/MD71295a09EJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: Tug of War

2011-07-31 Thread Nitish Garg
Can you explain a bit more?
Thanks
Nitish Garg

-- 
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/-/-LiQq0dHHksJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] HOW GARBAGE COLLECTOR WORKS IN JAVA

2011-07-31 Thread Deepthi Srinivasan
Garbage collector'll never run according to our whims and fancies :P It'll
run only when it wants (mostly when it senses that memory is going down). We
can issue a request using system.gc but we cannot MAKE it run...

On Sun, Jul 31, 2011 at 11:56 PM, vaibhav shukla wrote:

> @mr coder : y do we need to call garbage collector explicitly when it works
> automatically ?
>
>
> On Sun, Jul 31, 2011 at 11:07 PM, coder dumca wrote:
>
>> generally jvm runs on following occasions
>>
>> 1: periodicaliy
>> 2: when program is about to run out of memory the  JVM runs  and finallize
>> the objects.
>> 3: when we call using System.gc  or Runtime.getruntime.gc
>>
>> pls correct me if i m wrong
>>
>> On Sat, Jul 30, 2011 at 11:10 AM, vaibhav shukla > > wrote:
>>
>>> please give a glimps of how garbage collection is done in java.
>>> how *System.gc()*  works ?
>>>
>>> --
>>>   best wishes!!
>>> Vaibhav
>>>
>>>
>>> --
>>> 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.
>>
>
>
>
> --
>   best wishes!!
> Vaibhav
>   MCA
>
>
>  --
> 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,
Deepthi

-- 
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] FB intern

2011-07-31 Thread Kashyap Krishnakumar
I think the best way is to read the tutorials written by a guy working in
Facebook :P
http://www.topcoder.com/tc?module=Static&d1=tutorials&d2=primalityTesting
-- 
Kashyap.K,
III year, B.E. CSE,
College of Engineering Guindy,
Anna University,
Chennai.
--
If you've never failed, you've never lived!

-- 
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] binary search

2011-07-31 Thread aditi garg
How to optimise binary search so dat it makes only one comparison
instead of 2 dat it generally does??

-- 
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] aditi garg wants to chat

2011-07-31 Thread aditi garg
---

aditi garg wants to stay in better touch using some of Google's coolest new
products.

If you already have Gmail or Google Talk, visit:
http://mail.google.com/mail/b-f53ba5b4e1-93e223579e-7GNA2egu57Ro6sZcZcKk0mWTlbI
You'll need to click this link to be able to chat with aditi garg.

To get Gmail - a free email account from Google with over 2,800 megabytes of
storage - and chat with aditi garg, visit:
http://mail.google.com/mail/a-f53ba5b4e1-93e223579e-7GNA2egu57Ro6sZcZcKk0mWTlbI

Gmail offers:
- Instant messaging right inside Gmail
- Powerful spam protection
- Built-in search for finding your messages and a helpful way of organizing
  emails into "conversations"
- No pop-up ads or untargeted banners - just text ads and related information
  that are relevant to the content of your messages

All this, and its yours for free. But wait, there's more! By opening a Gmail
account, you also get access to Google Talk, Google's instant messaging
service:

http://www.google.com/talk/

Google Talk offers:
- Web-based chat that you can use anywhere, without a download
- A contact list that's synchronized with your Gmail account
- Free, high quality PC-to-PC voice calls when you download the Google Talk
  client

We're working hard to add new features and make improvements, so we might also
ask for your comments and suggestions periodically. We appreciate your help in
making our products even better!

Thanks,
The Google Team

To learn more about Gmail and Google Talk, visit:
http://mail.google.com/mail/help/about.html
http://www.google.com/talk/about.html

(If clicking the URLs in this message does not work, copy and paste them into
the address bar of your browser).

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

2011-07-31 Thread pandharinath gorde
int a[5]={1,2,3,4,5};
 printf 
("%d%d",&a+1,&(a+1));


in above example

i.&a+1 case  & having high precedence over + so (&a) is int ** to 5
elemnts so when + 1 it will point to last of array.

ii.&(a+1) a is of integere pointer so inceraed by one point to next int element

iii.&(*(a+1)) in this one a[1]= *(a+1) so &(*(a+1))=&(a[1))


On Sun, Jul 31, 2011 at 6:46 PM, aditi garg wrote:

> This is anothr prog that i ran...
> http://ideone.com/Kw9xl
>
>
> On Sun, Jul 31, 2011 at 6:43 PM, aditi garg wrote:
>
>> http://ideone.com/9Txzo
>> U cannot use %d when trying to print address \dey dont fall in range...and
>> iu have modified it...u can chk the output..
>> i think ull be able to interpret the results...lemme knw if u have any
>> doubt...
>>
>>
>> On Sun, Jul 31, 2011 at 3:18 PM, Shubham Maheshwari <
>> shubham@gmail.com> wrote:
>>
>>> http://ideone.com/IZKyN
>>>
>>> could you plzz explain this to me ...!!
>>> anyone ...
>>>
>>> On Sun, Jul 31, 2011 at 1:56 AM, Kamakshii Aggarwal <
>>> kamakshi...@gmail.com> wrote:
>>>
 @sanchit:no,not at all :)


 On Sun, Jul 31, 2011 at 1:55 AM, Sanchit Manchanda <
 sanchit...@gmail.com> wrote:

> @kamakshi- sorry if you felt i was rude. :-\
>
>
> On Sun, Jul 31, 2011 at 1:53 AM, aditi garg  > wrote:
>
>> some garbage value
>>
>>
>> On Sun, Jul 31, 2011 at 1:51 AM, gaurav gupta 
>> wrote:
>>
>>> then wat sud b the value of *(&a+1) since array is only defind for 5
>>> elements
>>>
>>>
>>> On Sun, Jul 31, 2011 at 1:48 AM, Sanchit Manchanda <
>>> sanchit...@gmail.com> wrote:
>>>
 yes it will print the next address in memory after the last element.


 On Sun, Jul 31, 2011 at 1:46 AM, gaurav gupta <
 grvgupta...@gmail.com> wrote:

> i understand much. thanx fr it. plz tell me if i hv to print &a+1
> then it sud print the next address after the last element
>
>
> On Sun, Jul 31, 2011 at 1:40 AM, Sanchit Manchanda <
> sanchit...@gmail.com> wrote:
>
>> @gaurav- &a takes you to the address 1st element of the array.
>> &a+1 takes you to the next address after the last element. this
>> mean if int is 4bits. then arrays of 5 int values is 20 bits. so
>> *+1 *in &a+1 covers 20 bits in memory. similarly &a+2 covers next
>> 20 bits. and so on.
>>
>> where as &(*(a+1)) points to 1st element,&(*(a+2)) points to 2nd
>> element and so on.
>>
>> i hope this helps
>>
>>
>> On Sun, Jul 31, 2011 at 1:35 AM, gaurav gupta <
>> grvgupta...@gmail.com> wrote:
>>
>>> so u mean der is difference between a and a[0]
>>>
>>>
>>> On Sun, Jul 31, 2011 at 1:30 AM, Kamakshii Aggarwal <
>>> kamakshi...@gmail.com> wrote:
>>>
 &a points to the array.so when u increment it by 1 it will get
 incremented by the size of array.


 On Sun, Jul 31, 2011 at 1:28 AM, gaurav gupta <
 grvgupta...@gmail.com> wrote:

> &a+1 takes to the last element of the array bt is the logic
> behind dis
>
>
> On Sun, Jul 31, 2011 at 1:25 AM, Kamakshii Aggarwal <
> kamakshi...@gmail.com> wrote:
>
>> &a+1 will point to the next array(i.e it will skip the whole
>> array)
>> where as &(a+1)will print address of element 2.
>>
>> On Sun, Jul 31, 2011 at 1:21 AM, Sanchit Manchanda <
>> sanchit...@gmail.com> wrote:
>>
>>> Sorry my bad. I was wrong.
>>>
>>> On Sun, Jul 31, 2011 at 1:15 AM, gaurav gupta <
>>> grvgupta...@gmail.com> wrote:
>>>
 main()
 {
 int a[5]={1,2,3,4,5};
 printf("%d%d",&a+1,&(a+1));
 }
 plz explain me the difference in ans.
 thanx..

 --
 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 Manchanda
>>> COE(3rd year) , NSIT
>>> http://iblogmythots.wordpress.com/
>>>
>>>  -

Re: [algogeeks] Re: Direct - i ques

2011-07-31 Thread Ravinder Kumar
It's not deletion of min it's deletion of oldest element inserted.

-- 
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] HOW GARBAGE COLLECTOR WORKS IN JAVA

2011-07-31 Thread vaibhav shukla
@mr coder : y do we need to call garbage collector explicitly when it works
automatically ?

On Sun, Jul 31, 2011 at 11:07 PM, coder dumca  wrote:

> generally jvm runs on following occasions
>
> 1: periodicaliy
> 2: when program is about to run out of memory the  JVM runs  and finallize
> the objects.
> 3: when we call using System.gc  or Runtime.getruntime.gc
>
> pls correct me if i m wrong
>
> On Sat, Jul 30, 2011 at 11:10 AM, vaibhav shukla 
> wrote:
>
>> please give a glimps of how garbage collection is done in java.
>> how *System.gc()*  works ?
>>
>> --
>>   best wishes!!
>> Vaibhav
>>
>>
>> --
>> 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.
>



-- 
  best wishes!!
Vaibhav
  MCA

-- 
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: Interview ques

2011-07-31 Thread Sandeep Jain
So, what you are saying is
Overriding <==> virtual functions

As per this logic:
Simply remove the virtual keyword from the function definition in base
class, which would mean they will not be overridden by the derived class.
And this answers the original question asked in this thread.



Regards,
Sandeep Jain
PS: I remember having interview questions such as, "What happens when you
override a virtual function?"


On Sun, Jul 31, 2011 at 11:51 PM, pandharinath gorde <
pandharinath.go...@gmail.com> wrote:

> and one more thing B is containg A's object inside which conatin noramlly
> vptr if any virtual fun in A otherwise data member of it So A::Func() and
> *B::func() * are diifent u require to access A's func() by A::func() in B.
> chk it by coding also and debugging
>
>
> On Sun, Jul 31, 2011 at 11:46 PM, pandharinath gorde <
> pandharinath.go...@gmail.com> wrote:
>
>> @sandeep
>> @sandeep
>>  class A
>> {
>> public:
>> void func(){ /* A'simplementation */}
>> };
>>
>> class B:public A
>> {
>> public:
>> void func(){/* B's implementation*/ }
>> };
>>
>>
>>
>> whatever is happening in this one is not overriding and not overloading
>> For overloading function should be is same scope but see below both func
>> are in different scope
>> void A::func();
>> void B::func();
>>
>> For fun overriding vptr table is used for entry in vptr table, for entry
>> in vptr table  function should be virtual.
>>
>>
>> On Sun, Jul 31, 2011 at 11:42 PM, Amol Sharma wrote:
>>
>>> ok...i agree with the explanation given by sandeep regarding
>>> overloading,overriding and virtual fns.
>>>
>>> but i am not able to think if there exist any method to do the required
>>> task !!
>>> --
>>>
>>>
>>> Amol Sharma
>>> Third Year Student
>>> Computer Science and Engineering
>>> MNNIT Allahabad
>>>
>>>
>>>
>>>
>>> On Sun, Jul 31, 2011 at 10:59 PM, coder dumca wrote:
>>>
 @ muthuraj
 see here display in derived is overriding display() in base  and also
 has purpose
 class A
 {
 int a;
public :
 void dispaly()
 {
   cout<>>> }
 };

 class B:public A
 {
  int b;
  public :
  void display()
 {
A::dispaly();
   cout<>>> }
 };

 On Sun, Jul 31, 2011 at 10:25 AM, muthu raj wrote:

> Function overriding gains significance only when functions are declared
> virtual. Otherwise Overriding does not serve any purpose. the main idea
> behind virtual functions and method overloading is to implement Dynamic
> Polymorphism i.e decide which version of function(base or derived)  to be
> invoked during runtime.
>
> *Muthuraj R
> IV th Year , ISE
> PESIT , Bangalore*
>
>
>
>   On Sun, Jul 31, 2011 at 10:22 AM, Sandeep Jain <
> sandeep6...@gmail.com> wrote:
>
>> @Pandharinath: Please consider the following e.g.
>> class A
>> {
>> public:
>> void func(){ /* A'simplementation */}
>>  };
>>
>> class B:public A
>> {
>> public:
>> void func(){/* B's implementation*/ }
>> };
>>
>> What is B's func() doing?
>>
>>
>>
>>
>> Regards,
>> Sandeep Jain
>>
>>
>>
>>
>> On Sun, Jul 31, 2011 at 10:36 PM, pandharinath gorde <
>> pandharinath.go...@gmail.com> wrote:
>>
>>>
>>> sandeep ur misguiding all things are,.
>>>
>>> for overriding virtual keyword is used that means virtual functions
>>> only overriden.
>>> In c++ u require to add virtual keyword.
>>> and in java every non static function is by default virtual.
>>>
>>>
>>>
>>> On Sun, Jul 31, 2011 at 10:23 PM, Sandeep Jain <
>>> sandeep6...@gmail.com> wrote:
>>>
 Overridden functions and virtual functions are two different
 concepts...
 1) Two functions in the same scope having same but different
 signatures = Over Loading
 2) Two functions having same signatures but one defined in parent
 class and the other defined in child class == Overriding
 3) Virtual functions, allow for run time polymorphism among
 overridden functions.(only when invoked using pointer)

 btw I'm still trying to think if preventing function over-riding is
 possible...


 Regards,
 Sandeep Jain




 On Sun, Jul 31, 2011 at 10:13 PM, Ankit Minglani <
 ankit.mingl...@gmail.com> wrote:

> @aditi : in C++ you define a function virtual to let the derived
> class give its own definition for the same. and in that case the 
> functions
> are overridden. unlike in JAVA where no virtual keyword is needed .. 
> so if
> you write the same code as above in java .. that may be referred to as
> Method overriding .. but not in cpp.
>
>
> On Sun, Jul 31, 2011 at 9:34 AM, aditi garg <
> aditi.

Re: [algogeeks] Re: Interview ques

2011-07-31 Thread pandharinath gorde
and one more thing B is containg A's object inside which conatin noramlly
vptr if any virtual fun in A otherwise data member of it So A::Func()
and *B::func()
* are diifent u require to access A's func() by A::func() in B.
chk it by coding also and debugging

On Sun, Jul 31, 2011 at 11:46 PM, pandharinath gorde <
pandharinath.go...@gmail.com> wrote:

> @sandeep
> @sandeep
> class A
> {
> public:
> void func(){ /* A'simplementation */}
> };
>
> class B:public A
> {
> public:
> void func(){/* B's implementation*/ }
> };
>
>
>
> whatever is happening in this one is not overriding and not overloading
> For overloading function should be is same scope but see below both func
> are in different scope
> void A::func();
> void B::func();
>
> For fun overriding vptr table is used for entry in vptr table, for entry in
> vptr table  function should be virtual.
>
>
> On Sun, Jul 31, 2011 at 11:42 PM, Amol Sharma wrote:
>
>> ok...i agree with the explanation given by sandeep regarding
>> overloading,overriding and virtual fns.
>>
>> but i am not able to think if there exist any method to do the required
>> task !!
>> --
>>
>>
>> Amol Sharma
>> Third Year Student
>> Computer Science and Engineering
>> MNNIT Allahabad
>>
>>
>>
>>
>> On Sun, Jul 31, 2011 at 10:59 PM, coder dumca wrote:
>>
>>> @ muthuraj
>>> see here display in derived is overriding display() in base  and also has
>>> purpose
>>> class A
>>> {
>>> int a;
>>>public :
>>> void dispaly()
>>> {
>>>   cout<>> }
>>> };
>>>
>>> class B:public A
>>> {
>>>  int b;
>>>  public :
>>>  void display()
>>> {
>>>A::dispaly();
>>>   cout<>> }
>>> };
>>>
>>> On Sun, Jul 31, 2011 at 10:25 AM, muthu raj wrote:
>>>
 Function overriding gains significance only when functions are declared
 virtual. Otherwise Overriding does not serve any purpose. the main idea
 behind virtual functions and method overloading is to implement Dynamic
 Polymorphism i.e decide which version of function(base or derived)  to be
 invoked during runtime.

 *Muthuraj R
 IV th Year , ISE
 PESIT , Bangalore*



   On Sun, Jul 31, 2011 at 10:22 AM, Sandeep Jain >>> > wrote:

> @Pandharinath: Please consider the following e.g.
> class A
> {
> public:
> void func(){ /* A'simplementation */}
>  };
>
> class B:public A
> {
> public:
> void func(){/* B's implementation*/ }
> };
>
> What is B's func() doing?
>
>
>
>
> Regards,
> Sandeep Jain
>
>
>
>
> On Sun, Jul 31, 2011 at 10:36 PM, pandharinath gorde <
> pandharinath.go...@gmail.com> wrote:
>
>>
>> sandeep ur misguiding all things are,.
>>
>> for overriding virtual keyword is used that means virtual functions
>> only overriden.
>> In c++ u require to add virtual keyword.
>> and in java every non static function is by default virtual.
>>
>>
>>
>> On Sun, Jul 31, 2011 at 10:23 PM, Sandeep Jain > > wrote:
>>
>>> Overridden functions and virtual functions are two different
>>> concepts...
>>> 1) Two functions in the same scope having same but different
>>> signatures = Over Loading
>>> 2) Two functions having same signatures but one defined in parent
>>> class and the other defined in child class == Overriding
>>> 3) Virtual functions, allow for run time polymorphism among
>>> overridden functions.(only when invoked using pointer)
>>>
>>> btw I'm still trying to think if preventing function over-riding is
>>> possible...
>>>
>>>
>>> Regards,
>>> Sandeep Jain
>>>
>>>
>>>
>>>
>>> On Sun, Jul 31, 2011 at 10:13 PM, Ankit Minglani <
>>> ankit.mingl...@gmail.com> wrote:
>>>
 @aditi : in C++ you define a function virtual to let the derived
 class give its own definition for the same. and in that case the 
 functions
 are overridden. unlike in JAVA where no virtual keyword is needed .. 
 so if
 you write the same code as above in java .. that may be referred to as
 Method overriding .. but not in cpp.


 On Sun, Jul 31, 2011 at 9:34 AM, aditi garg <
 aditi.garg.6...@gmail.com> wrote:

> @ Ankit: Wat is overriding actually thn?
>
>
> On Sun, Jul 31, 2011 at 9:58 PM, Anika Jain <
> anika.jai...@gmail.com> wrote:
>
>> ohkk.. m so sorry
>>
>>
>> On Sun, Jul 31, 2011 at 9:41 PM, Ankit Minglani <
>> ankit.mingl...@gmail.com> wrote:
>>
>>> @anika: This is not function overriding i think .. you cannot
>>> call the f() function of the base class from the derived class 
>>> object ..
>>> what you are doing is creating a object of the derived class and 
>>> calling the
>>> version of f() that belong to derived class B .. ie is the same 
>>>

Re: [algogeeks] Re: Interview ques

2011-07-31 Thread pandharinath gorde
@sandeep
@sandeep
class A
{
public:
void func(){ /* A'simplementation */}
};

class B:public A
{
public:
void func(){/* B's implementation*/ }
};



whatever is happening in this one is not overriding and not overloading
For overloading function should be is same scope but see below both func are
in different scope
void A::func();
void B::func();

For fun overriding vptr table is used for entry in vptr table, for entry in
vptr table  function should be virtual.


On Sun, Jul 31, 2011 at 11:42 PM, Amol Sharma wrote:

> ok...i agree with the explanation given by sandeep regarding
> overloading,overriding and virtual fns.
>
> but i am not able to think if there exist any method to do the required
> task !!
> --
>
>
> Amol Sharma
> Third Year Student
> Computer Science and Engineering
> MNNIT Allahabad
>
>
>
>
> On Sun, Jul 31, 2011 at 10:59 PM, coder dumca wrote:
>
>> @ muthuraj
>> see here display in derived is overriding display() in base  and also has
>> purpose
>> class A
>> {
>> int a;
>>public :
>> void dispaly()
>> {
>>   cout<> }
>> };
>>
>> class B:public A
>> {
>>  int b;
>>  public :
>>  void display()
>> {
>>A::dispaly();
>>   cout<> }
>> };
>>
>> On Sun, Jul 31, 2011 at 10:25 AM, muthu raj  wrote:
>>
>>> Function overriding gains significance only when functions are declared
>>> virtual. Otherwise Overriding does not serve any purpose. the main idea
>>> behind virtual functions and method overloading is to implement Dynamic
>>> Polymorphism i.e decide which version of function(base or derived)  to be
>>> invoked during runtime.
>>>
>>> *Muthuraj R
>>> IV th Year , ISE
>>> PESIT , Bangalore*
>>>
>>>
>>>
>>>   On Sun, Jul 31, 2011 at 10:22 AM, Sandeep Jain 
>>> wrote:
>>>
 @Pandharinath: Please consider the following e.g.
 class A
 {
 public:
 void func(){ /* A'simplementation */}
  };

 class B:public A
 {
 public:
 void func(){/* B's implementation*/ }
 };

 What is B's func() doing?




 Regards,
 Sandeep Jain




 On Sun, Jul 31, 2011 at 10:36 PM, pandharinath gorde <
 pandharinath.go...@gmail.com> wrote:

>
> sandeep ur misguiding all things are,.
>
> for overriding virtual keyword is used that means virtual functions
> only overriden.
> In c++ u require to add virtual keyword.
> and in java every non static function is by default virtual.
>
>
>
> On Sun, Jul 31, 2011 at 10:23 PM, Sandeep Jain 
> wrote:
>
>> Overridden functions and virtual functions are two different
>> concepts...
>> 1) Two functions in the same scope having same but different
>> signatures = Over Loading
>> 2) Two functions having same signatures but one defined in parent
>> class and the other defined in child class == Overriding
>> 3) Virtual functions, allow for run time polymorphism among overridden
>> functions.(only when invoked using pointer)
>>
>> btw I'm still trying to think if preventing function over-riding is
>> possible...
>>
>>
>> Regards,
>> Sandeep Jain
>>
>>
>>
>>
>> On Sun, Jul 31, 2011 at 10:13 PM, Ankit Minglani <
>> ankit.mingl...@gmail.com> wrote:
>>
>>> @aditi : in C++ you define a function virtual to let the derived
>>> class give its own definition for the same. and in that case the 
>>> functions
>>> are overridden. unlike in JAVA where no virtual keyword is needed .. so 
>>> if
>>> you write the same code as above in java .. that may be referred to as
>>> Method overriding .. but not in cpp.
>>>
>>>
>>> On Sun, Jul 31, 2011 at 9:34 AM, aditi garg <
>>> aditi.garg.6...@gmail.com> wrote:
>>>
 @ Ankit: Wat is overriding actually thn?


 On Sun, Jul 31, 2011 at 9:58 PM, Anika Jain >>> > wrote:

> ohkk.. m so sorry
>
>
> On Sun, Jul 31, 2011 at 9:41 PM, Ankit Minglani <
> ankit.mingl...@gmail.com> wrote:
>
>> @anika: This is not function overriding i think .. you cannot call
>> the f() function of the base class from the derived class object .. 
>> what you
>> are doing is creating a object of the derived class and calling the 
>> version
>> of f() that belong to derived class B .. ie is the same class object 
>> is
>> calling the same class function .
>>
>> correct me if i m wrong .
>>
>>
>> On Sun, Jul 31, 2011 at 8:42 AM, Anika Jain <
>> anika.jai...@gmail.com> wrote:
>>
>>> @ muthu : not declaring tht function as virtual wont save
>>> overriding
>>>
>>> class A
>>> {
>>> int a;
>>>
>>> public:
>>> void f()
>>> {}
>>> int f2(){}
>>> };
>>>
>>> class B:public A
>>

Re: [algogeeks] Re: Interview ques

2011-07-31 Thread pandharinath gorde
@sandeep

class A
{
public:
void func(){ /* A'simplementation */}
};

class B:public A
{
public:
void func(){/* B's implementation*/ }
};



whatever is happening in this one is not overriding and not overloading
For overloading function should be is same scope but see below both func are
in different scope
void A::func();
void B::func();

For fun overriding vptr table is used for entry in vptr table, for entry in
vptr table  function should be virtual.



On Sun, Jul 31, 2011 at 10:59 PM, coder dumca  wrote:

> @ muthuraj
> see here display in derived is overriding display() in base  and also has
> purpose
> class A
> {
> int a;
>public :
> void dispaly()
> {
>   cout< }
> };
>
> class B:public A
> {
>  int b;
>  public :
>  void display()
> {
>A::dispaly();
>   cout< }
> };
>
> On Sun, Jul 31, 2011 at 10:25 AM, muthu raj  wrote:
>
>> Function overriding gains significance only when functions are declared
>> virtual. Otherwise Overriding does not serve any purpose. the main idea
>> behind virtual functions and method overloading is to implement Dynamic
>> Polymorphism i.e decide which version of function(base or derived)  to be
>> invoked during runtime.
>>
>> *Muthuraj R
>> IV th Year , ISE
>> PESIT , Bangalore*
>>
>>
>>
>>   On Sun, Jul 31, 2011 at 10:22 AM, Sandeep Jain 
>> wrote:
>>
>>> @Pandharinath: Please consider the following e.g.
>>> class A
>>> {
>>> public:
>>> void func(){ /* A'simplementation */}
>>>  };
>>>
>>> class B:public A
>>> {
>>> public:
>>> void func(){/* B's implementation*/ }
>>> };
>>>
>>> What is B's func() doing?
>>>
>>>
>>>
>>>
>>> Regards,
>>> Sandeep Jain
>>>
>>>
>>>
>>>
>>> On Sun, Jul 31, 2011 at 10:36 PM, pandharinath gorde <
>>> pandharinath.go...@gmail.com> wrote:
>>>

 sandeep ur misguiding all things are,.

 for overriding virtual keyword is used that means virtual functions only
 overriden.
 In c++ u require to add virtual keyword.
 and in java every non static function is by default virtual.



 On Sun, Jul 31, 2011 at 10:23 PM, Sandeep Jain 
 wrote:

> Overridden functions and virtual functions are two different
> concepts...
> 1) Two functions in the same scope having same but different signatures
> = Over Loading
> 2) Two functions having same signatures but one defined in parent class
> and the other defined in child class == Overriding
> 3) Virtual functions, allow for run time polymorphism among overridden
> functions.(only when invoked using pointer)
>
> btw I'm still trying to think if preventing function over-riding is
> possible...
>
>
> Regards,
> Sandeep Jain
>
>
>
>
> On Sun, Jul 31, 2011 at 10:13 PM, Ankit Minglani <
> ankit.mingl...@gmail.com> wrote:
>
>> @aditi : in C++ you define a function virtual to let the derived class
>> give its own definition for the same. and in that case the functions are
>> overridden. unlike in JAVA where no virtual keyword is needed .. so if 
>> you
>> write the same code as above in java .. that may be referred to as Method
>> overriding .. but not in cpp.
>>
>>
>> On Sun, Jul 31, 2011 at 9:34 AM, aditi garg <
>> aditi.garg.6...@gmail.com> wrote:
>>
>>> @ Ankit: Wat is overriding actually thn?
>>>
>>>
>>> On Sun, Jul 31, 2011 at 9:58 PM, Anika Jain 
>>> wrote:
>>>
 ohkk.. m so sorry


 On Sun, Jul 31, 2011 at 9:41 PM, Ankit Minglani <
 ankit.mingl...@gmail.com> wrote:

> @anika: This is not function overriding i think .. you cannot call
> the f() function of the base class from the derived class object .. 
> what you
> are doing is creating a object of the derived class and calling the 
> version
> of f() that belong to derived class B .. ie is the same class object 
> is
> calling the same class function .
>
> correct me if i m wrong .
>
>
> On Sun, Jul 31, 2011 at 8:42 AM, Anika Jain <
> anika.jai...@gmail.com> wrote:
>
>> @ muthu : not declaring tht function as virtual wont save
>> overriding
>>
>> class A
>> {
>> int a;
>>
>> public:
>> void f()
>> {}
>> int f2(){}
>> };
>>
>> class B:public A
>> {
>> public:
>> void f()
>> {
>> cout<<"abc\n";
>> }
>> };
>>
>> int main()
>> {
>> B ob;
>> ob.f();
>> return 0;
>> }
>>
>> in this output is abc..
>> so overriding occured
>>
>>
>> On Sun, Jul 31, 2011 at 8:41 PM, muthu raj 
>> wrote:
>>
>>> Using friend functions we can only invoke already defined priv

Re: [algogeeks] Re: Interview ques

2011-07-31 Thread Amol Sharma
ok...i agree with the explanation given by sandeep regarding
overloading,overriding and virtual fns.

but i am not able to think if there exist any method to do the required task
!!
--


Amol Sharma
Third Year Student
Computer Science and Engineering
MNNIT Allahabad




On Sun, Jul 31, 2011 at 10:59 PM, coder dumca  wrote:

> @ muthuraj
> see here display in derived is overriding display() in base  and also has
> purpose
> class A
> {
> int a;
>public :
> void dispaly()
> {
>   cout< }
> };
>
> class B:public A
> {
>  int b;
>  public :
>  void display()
> {
>A::dispaly();
>   cout< }
> };
>
> On Sun, Jul 31, 2011 at 10:25 AM, muthu raj  wrote:
>
>> Function overriding gains significance only when functions are declared
>> virtual. Otherwise Overriding does not serve any purpose. the main idea
>> behind virtual functions and method overloading is to implement Dynamic
>> Polymorphism i.e decide which version of function(base or derived)  to be
>> invoked during runtime.
>>
>> *Muthuraj R
>> IV th Year , ISE
>> PESIT , Bangalore*
>>
>>
>>
>>   On Sun, Jul 31, 2011 at 10:22 AM, Sandeep Jain 
>> wrote:
>>
>>> @Pandharinath: Please consider the following e.g.
>>> class A
>>> {
>>> public:
>>> void func(){ /* A'simplementation */}
>>>  };
>>>
>>> class B:public A
>>> {
>>> public:
>>> void func(){/* B's implementation*/ }
>>> };
>>>
>>> What is B's func() doing?
>>>
>>>
>>>
>>>
>>> Regards,
>>> Sandeep Jain
>>>
>>>
>>>
>>>
>>> On Sun, Jul 31, 2011 at 10:36 PM, pandharinath gorde <
>>> pandharinath.go...@gmail.com> wrote:
>>>

 sandeep ur misguiding all things are,.

 for overriding virtual keyword is used that means virtual functions only
 overriden.
 In c++ u require to add virtual keyword.
 and in java every non static function is by default virtual.



 On Sun, Jul 31, 2011 at 10:23 PM, Sandeep Jain 
 wrote:

> Overridden functions and virtual functions are two different
> concepts...
> 1) Two functions in the same scope having same but different signatures
> = Over Loading
> 2) Two functions having same signatures but one defined in parent class
> and the other defined in child class == Overriding
> 3) Virtual functions, allow for run time polymorphism among overridden
> functions.(only when invoked using pointer)
>
> btw I'm still trying to think if preventing function over-riding is
> possible...
>
>
> Regards,
> Sandeep Jain
>
>
>
>
> On Sun, Jul 31, 2011 at 10:13 PM, Ankit Minglani <
> ankit.mingl...@gmail.com> wrote:
>
>> @aditi : in C++ you define a function virtual to let the derived class
>> give its own definition for the same. and in that case the functions are
>> overridden. unlike in JAVA where no virtual keyword is needed .. so if 
>> you
>> write the same code as above in java .. that may be referred to as Method
>> overriding .. but not in cpp.
>>
>>
>> On Sun, Jul 31, 2011 at 9:34 AM, aditi garg <
>> aditi.garg.6...@gmail.com> wrote:
>>
>>> @ Ankit: Wat is overriding actually thn?
>>>
>>>
>>> On Sun, Jul 31, 2011 at 9:58 PM, Anika Jain 
>>> wrote:
>>>
 ohkk.. m so sorry


 On Sun, Jul 31, 2011 at 9:41 PM, Ankit Minglani <
 ankit.mingl...@gmail.com> wrote:

> @anika: This is not function overriding i think .. you cannot call
> the f() function of the base class from the derived class object .. 
> what you
> are doing is creating a object of the derived class and calling the 
> version
> of f() that belong to derived class B .. ie is the same class object 
> is
> calling the same class function .
>
> correct me if i m wrong .
>
>
> On Sun, Jul 31, 2011 at 8:42 AM, Anika Jain <
> anika.jai...@gmail.com> wrote:
>
>> @ muthu : not declaring tht function as virtual wont save
>> overriding
>>
>> class A
>> {
>> int a;
>>
>> public:
>> void f()
>> {}
>> int f2(){}
>> };
>>
>> class B:public A
>> {
>> public:
>> void f()
>> {
>> cout<<"abc\n";
>> }
>> };
>>
>> int main()
>> {
>> B ob;
>> ob.f();
>> return 0;
>> }
>>
>> in this output is abc..
>> so overriding occured
>>
>>
>> On Sun, Jul 31, 2011 at 8:41 PM, muthu raj 
>> wrote:
>>
>>> Using friend functions we can only invoke already defined private
>>> functions. We cannot override or prevent overriding using friend 
>>> functions.
>>> The problem here is how to prevent base class function from being 
>>

Re: [algogeeks] C++ urgent friend func doubt

2011-07-31 Thread pandharinath gorde
actually problem is in class A it is not getting declaration of class B
becoz there u tried to tell one member of class when declaring friend.If
with forwrard declaration when specifying data member of class require its
defination.


class A;
class B//:public A
{
public:
int func(A ob);
};
class A
{
int a;
public:
int f2(){}
friend int B::func(A ob);
};


int B::func(A ob)
{
}

use above it will work fine . but if u uncomment the public A it will give
error becoz it want actual declaration not only forwrd declartion.


One more thing why are using friend in above case its not good thing use *
protected* the data member which u want to make accessibly in
dervied class instead of friend its not good sign.

On Sun, Jul 31, 2011 at 9:25 PM, Anika Jain  wrote:

> class B;
>
> class A
> {
> int a;
> public:
> int f2(){}
> friend int B::func(A ob);
> };
>
> class B:public A
> {
> public:
> int func(A ob)
> {
> }
> };
>
>
> why compilation error is coming over here for friend statement n forward
> protype declaration of class B ??
>
> --
> You received this message 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.
>



-- 
Pandharinath Gorde
+91-9620557641

-- 
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: Direct - i ques

2011-07-31 Thread Ankit Minglani
i think you can just enter elements in a sorted order ( ie applying
insertion sort as the elements are added ) like we do in Bucket sort ..
maintaining sorted buckets for a hash value ..

and maintaining the min element at the head always we can do deletion of min
and finding min in O(1) time because it is always the head.


On Sun, Jul 31, 2011 at 10:21 AM, pandharinath gorde <
pandharinath.go...@gmail.com> wrote:

> O(1) is possible in normal LL in below case:
>
> i.If u have head then insertion , deletion and accesss to first element at
> front .
> ii.if u have tail then insertion and access to  element  at last .
>
> if anything missing add anout normal LL
>
>
> On Sun, Jul 31, 2011 at 9:47 PM, siva viknesh wrote:
>
>> I think the exact question resembles as what ravinder kumar
>> saidAnd all these operations in O(1) time...ideas plz
>>
>> On Jul 31, 5:21 pm, Ravinder Kumar  wrote:
>> > Guys the real question is :
>> > Design a data structure which support following operation
>> > 1. insertion of an arbitrary element
>> > 2. removing the oldest element
>> > 3. Accessing min element
>> >
>> > --
>> > *With Regards :*
>> >
>> > Ravinder Kumar
>> > B.Tech Final Year
>> > Computer Science and Engineering
>> > 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.
>>
>>
>
>
> --
> Pandharinath Gorde
> +91-9620557641
>
>  --
> 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.
>



-- 
The more you sweat in the field, the less you bleed in war."

Ankit Minglani
NITK Surathkal

-- 
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: 100th Fibonacci number using LL

2011-07-31 Thread bharath
@Amit: Thanks for the solution but I have seen this approach. I was
wondering how this can be solved using linked lists without using
bignum libraries.

Bharath

On Jul 31, 12:38 pm, amit karmakar  wrote:
> Since long long cannot store the 100th Fibonacci number, you need to
> implement or use an existing library for bignum.
>
> You may use linked lists to solve this problem.
> Read about bignum 
> herehttp://en.wikipedia.org/wiki/Arbitrary-precision_arithmetic
>
> Here is my implementation for solving this problem,
> #include 
> #include 
> #include 
>
> using namespace std;
>
> #define REP(i, n) for(int i = 0; i < (n); i++)
> #define FILL(c, v) memset(c, v, sizeof(c))
>
> const int MX = 10;
> int prv1[MX], prv2[MX], cur[MX], l1, l2, lcur;
>
> int main() {
>     FILL(prv1, 0); FILL(prv2, 0); FILL(cur, 0);
>     int n;
>     scanf("%d", &n);
>
>     prv1[0] = 0; l1 = 1;
>     prv2[0] = 1; l2 = 1;
>     cur[0]  = 0; lcur = 1;
>     REP(i, n) {
>         int mx = max(l1, l2);
>         int carry = 0;
>         REP(j, mx) {
>             int imd = prv1[j]+prv2[j]+carry;
>             cur[j]  = imd%10;
>             carry   = imd/10;
>         }
>         if(carry) {
>             cur[mx++] = carry;
>         }
>         lcur = mx;
>
>         REP(j, l1)   prv2[j] = prv1[j]; l2=l1;
>         REP(j, lcur) prv1[j] = cur[j];  l1=lcur;
>     }
>     REP(i, lcur) printf("%d", cur[lcur-i-1]); printf("\n");
>
> }
>
> On Jul 31, 9:31 pm, bharath sriram  wrote:
>
>
>
>
>
>
>
> > Since both the "normal" recursive (stack overflow) and non-recursive (data
> > type overflow) versions fails, is there a  way one can use linked lists to
> > solve this problem?
>
> > Bharath.

-- 
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: 100th Fibonacci number using LL

2011-07-31 Thread amit karmakar
Since long long cannot store the 100th Fibonacci number, you need to
implement or use an existing library for bignum.

You may use linked lists to solve this problem.
Read about bignum here 
http://en.wikipedia.org/wiki/Arbitrary-precision_arithmetic

Here is my implementation for solving this problem,
#include 
#include 
#include 

using namespace std;

#define REP(i, n) for(int i = 0; i < (n); i++)
#define FILL(c, v) memset(c, v, sizeof(c))

const int MX = 10;
int prv1[MX], prv2[MX], cur[MX], l1, l2, lcur;

int main() {
FILL(prv1, 0); FILL(prv2, 0); FILL(cur, 0);
int n;
scanf("%d", &n);

prv1[0] = 0; l1 = 1;
prv2[0] = 1; l2 = 1;
cur[0]  = 0; lcur = 1;
REP(i, n) {
int mx = max(l1, l2);
int carry = 0;
REP(j, mx) {
int imd = prv1[j]+prv2[j]+carry;
cur[j]  = imd%10;
carry   = imd/10;
}
if(carry) {
cur[mx++] = carry;
}
lcur = mx;

REP(j, l1)   prv2[j] = prv1[j]; l2=l1;
REP(j, lcur) prv1[j] = cur[j];  l1=lcur;
}
REP(i, lcur) printf("%d", cur[lcur-i-1]); printf("\n");
}

On Jul 31, 9:31 pm, bharath sriram  wrote:
> Since both the "normal" recursive (stack overflow) and non-recursive (data
> type overflow) versions fails, is there a  way one can use linked lists to
> solve this problem?
>
> Bharath.

-- 
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] HOW GARBAGE COLLECTOR WORKS IN JAVA

2011-07-31 Thread coder dumca
generally jvm runs on following occasions

1: periodicaliy
2: when program is about to run out of memory the  JVM runs  and finallize
the objects.
3: when we call using System.gc  or Runtime.getruntime.gc

pls correct me if i m wrong

On Sat, Jul 30, 2011 at 11:10 AM, vaibhav shukla wrote:

> please give a glimps of how garbage collection is done in java.
> how *System.gc()*  works ?
>
> --
>   best wishes!!
> Vaibhav
>
>
> --
> 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] pointers

2011-07-31 Thread Puneet Gautam
Thanks..


On 7/31/11, aditi garg  wrote:
> http://ootips.org/yonat/4dev/smart-pointers.html
> Dis cud be helpful fr smart pointers
>
> On Sun, Jul 31, 2011 at 3:06 PM, Puneet Gautam
> wrote:
>
>> What are smart pointers and what is the concept of pointer to void..?
>>
>> --
>> 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.
>>
>>
>
>
> --
> Aditi Garg
> Undergraduate Student
> Electronics & Communication Divison
> NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
> Sector 3, Dwarka
> New 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] Bugs in a program

2011-07-31 Thread Puneet Gautam
Thanks...!

On 7/31/11, rajeev bharshetty  wrote:
> http://www.softwaretestinghelp.com/priority-and-severity/
>
>
> On Sun, Jul 31, 2011 at 3:02 PM, Puneet Gautam
> wrote:
>
>> What is meant by 'priority' and  'severity' of a bug..?
>>
>> --
>> 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
> Rajeev N B 
>
> "*Winners Don't do Different things , they do things Differently"*
>
> --
> 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] random generation

2011-07-31 Thread Puneet Gautam
Yes...yes...yes...Guys..i got it...!!!
Thanks Someshwar.. ur idea clicked it well...

Will post the code tomorrow...!!



On 7/31/11, Puneet Gautam  wrote:
> @rajeev: Well, i meant a code which generates a random no. between say
> 2 and 10 at every run of program...not the random code generator...!
>
> eg:
>
> if a=2 b=10
> on first run of program, it produces
> 3
> 2nd run:
> 5
> 3rd run:
> 4
> 4th run:
> 9
>
> all these values dont follow any sequence between program runs..
>
>
>
> On 7/31/11, rajeev bharshetty  wrote:
>> *#include*
>> *
>> *
>> *int main()*
>> *{*
>> *
>> *
>> *int x,a,b,i,n;*
>> *printf("\n Enter the value of n");*
>> *scanf("%d",&n);*
>> *printf("\n Enter Psoitive integer a");*
>> *scanf("%d",&a);*
>> *printf("\n Enter the positisve integer b");*
>> *scanf("%d",&b);*
>> *for(i=1;i<=15;i++)*
>> *{*
>> * n= (a*n + b);*
>> * printf("%d\n",n);*
>> *}*
>> *return 0;*
>> * *
>> * }*
>>
>> Random code generator ...
>> Correct me if i am wrong 
>> thanks
>>
>> On Sun, Jul 31, 2011 at 3:19 PM, Someshwar Chandrasekaran <
>> somseka...@gmail.com> wrote:
>>
>>> On Sun, Jul 31, 2011 at 3:09 PM, Puneet Gautam 
>>> wrote:
>>> > Can we write a code to generate random numbers without using rand
>>> function..?
>>> >
>>> > Pls help me on this!!
>>>
>>> How about operating on some garbage value?
>>>
>>> Regards,
>>> B.C.Someshwar
>>>
>>>
>>> --
>>> 'Talk sense to a fool and he calls you foolish.' - Euripides
>>>
>>> My Blog:  somsekaran.wordpress.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.
>>>
>>>
>>
>>
>> --
>> Regards
>> Rajeev N B 
>>
>> "*Winners Don't do Different things , they do things Differently"*
>>
>> --
>> 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: Interview ques

2011-07-31 Thread coder dumca
@ muthuraj
see here display in derived is overriding display() in base  and also has
purpose
class A
{
int a;
   public :
void dispaly()
{
  cout< wrote:

> Function overriding gains significance only when functions are declared
> virtual. Otherwise Overriding does not serve any purpose. the main idea
> behind virtual functions and method overloading is to implement Dynamic
> Polymorphism i.e decide which version of function(base or derived)  to be
> invoked during runtime.
>
> *Muthuraj R
> IV th Year , ISE
> PESIT , Bangalore*
>
>
>
>   On Sun, Jul 31, 2011 at 10:22 AM, Sandeep Jain wrote:
>
>> @Pandharinath: Please consider the following e.g.
>> class A
>> {
>> public:
>> void func(){ /* A'simplementation */}
>>  };
>>
>> class B:public A
>> {
>> public:
>> void func(){/* B's implementation*/ }
>> };
>>
>> What is B's func() doing?
>>
>>
>>
>>
>> Regards,
>> Sandeep Jain
>>
>>
>>
>>
>> On Sun, Jul 31, 2011 at 10:36 PM, pandharinath gorde <
>> pandharinath.go...@gmail.com> wrote:
>>
>>>
>>> sandeep ur misguiding all things are,.
>>>
>>> for overriding virtual keyword is used that means virtual functions only
>>> overriden.
>>> In c++ u require to add virtual keyword.
>>> and in java every non static function is by default virtual.
>>>
>>>
>>>
>>> On Sun, Jul 31, 2011 at 10:23 PM, Sandeep Jain wrote:
>>>
 Overridden functions and virtual functions are two different concepts...

 1) Two functions in the same scope having same but different signatures
 = Over Loading
 2) Two functions having same signatures but one defined in parent class
 and the other defined in child class == Overriding
 3) Virtual functions, allow for run time polymorphism among overridden
 functions.(only when invoked using pointer)

 btw I'm still trying to think if preventing function over-riding is
 possible...


 Regards,
 Sandeep Jain




 On Sun, Jul 31, 2011 at 10:13 PM, Ankit Minglani <
 ankit.mingl...@gmail.com> wrote:

> @aditi : in C++ you define a function virtual to let the derived class
> give its own definition for the same. and in that case the functions are
> overridden. unlike in JAVA where no virtual keyword is needed .. so if you
> write the same code as above in java .. that may be referred to as Method
> overriding .. but not in cpp.
>
>
> On Sun, Jul 31, 2011 at 9:34 AM, aditi garg  > wrote:
>
>> @ Ankit: Wat is overriding actually thn?
>>
>>
>> On Sun, Jul 31, 2011 at 9:58 PM, Anika Jain 
>> wrote:
>>
>>> ohkk.. m so sorry
>>>
>>>
>>> On Sun, Jul 31, 2011 at 9:41 PM, Ankit Minglani <
>>> ankit.mingl...@gmail.com> wrote:
>>>
 @anika: This is not function overriding i think .. you cannot call
 the f() function of the base class from the derived class object .. 
 what you
 are doing is creating a object of the derived class and calling the 
 version
 of f() that belong to derived class B .. ie is the same class object is
 calling the same class function .

 correct me if i m wrong .


 On Sun, Jul 31, 2011 at 8:42 AM, Anika Jain >>> > wrote:

> @ muthu : not declaring tht function as virtual wont save
> overriding
>
> class A
> {
> int a;
>
> public:
> void f()
> {}
> int f2(){}
> };
>
> class B:public A
> {
> public:
> void f()
> {
> cout<<"abc\n";
> }
> };
>
> int main()
> {
> B ob;
> ob.f();
> return 0;
> }
>
> in this output is abc..
> so overriding occured
>
>
> On Sun, Jul 31, 2011 at 8:41 PM, muthu raj 
> wrote:
>
>> Using friend functions we can only invoke already defined private
>> functions. We cannot override or prevent overriding using friend 
>> functions.
>> The problem here is how to prevent base class function from being 
>> overridden
>> in derived class.
>>
>> *Muthuraj R
>> IV th Year , ISE
>> PESIT , Bangalore*
>>
>>
>>
>>   On Sun, Jul 31, 2011 at 8:04 AM, Anika Jain <
>> anika.jai...@gmail.com> wrote:
>>
>>> what if we write that function as private of base class.. and
>>> make a function in derived class that is friend function of the 
>>> base class
>>> do that it can call tht private function of base.??
>>>
>>>
>>> On Sun, Jul 31, 2011 at 8:25 PM, muthu raj >> > wrote:
>>>
 Yeah but there is no equivalent of final keyword in c++.So
 to prevent member fun

Re: [algogeeks] Re: Interview ques

2011-07-31 Thread Sandeep Jain
Yup.. actually we never get to make proper usage of overridden functions
without making them virtual.


Regards,
Sandeep Jain



On Sun, Jul 31, 2011 at 10:55 PM, muthu raj  wrote:

> Function overriding gains significance only when functions are declared
> virtual. Otherwise Overriding does not serve any purpose. the main idea
> behind virtual functions and method overloading is to implement Dynamic
> Polymorphism i.e decide which version of function(base or derived)  to be
> invoked during runtime.
>
> *Muthuraj R
> IV th Year , ISE
> PESIT , Bangalore*
>
>
>
> On Sun, Jul 31, 2011 at 10:22 AM, Sandeep Jain wrote:
>
>> @Pandharinath: Please consider the following e.g.
>> class A
>> {
>> public:
>> void func(){ /* A'simplementation */}
>> };
>>
>> class B:public A
>> {
>> public:
>> void func(){/* B's implementation*/ }
>> };
>>
>> What is B's func() doing?
>>
>>
>>
>>
>> Regards,
>> Sandeep Jain
>>
>>
>>
>>
>> On Sun, Jul 31, 2011 at 10:36 PM, pandharinath gorde <
>> pandharinath.go...@gmail.com> wrote:
>>
>>>
>>> sandeep ur misguiding all things are,.
>>>
>>> for overriding virtual keyword is used that means virtual functions only
>>> overriden.
>>> In c++ u require to add virtual keyword.
>>> and in java every non static function is by default virtual.
>>>
>>>
>>>
>>> On Sun, Jul 31, 2011 at 10:23 PM, Sandeep Jain wrote:
>>>
 Overridden functions and virtual functions are two different concepts...
 1) Two functions in the same scope having same but different signatures
 = Over Loading
 2) Two functions having same signatures but one defined in parent class
 and the other defined in child class == Overriding
 3) Virtual functions, allow for run time polymorphism among overridden
 functions.(only when invoked using pointer)

 btw I'm still trying to think if preventing function over-riding is
 possible...


 Regards,
 Sandeep Jain




 On Sun, Jul 31, 2011 at 10:13 PM, Ankit Minglani <
 ankit.mingl...@gmail.com> wrote:

> @aditi : in C++ you define a function virtual to let the derived class
> give its own definition for the same. and in that case the functions are
> overridden. unlike in JAVA where no virtual keyword is needed .. so if you
> write the same code as above in java .. that may be referred to as Method
> overriding .. but not in cpp.
>
>
> On Sun, Jul 31, 2011 at 9:34 AM, aditi garg  > wrote:
>
>> @ Ankit: Wat is overriding actually thn?
>>
>>
>> On Sun, Jul 31, 2011 at 9:58 PM, Anika Jain 
>> wrote:
>>
>>> ohkk.. m so sorry
>>>
>>>
>>> On Sun, Jul 31, 2011 at 9:41 PM, Ankit Minglani <
>>> ankit.mingl...@gmail.com> wrote:
>>>
 @anika: This is not function overriding i think .. you cannot call
 the f() function of the base class from the derived class object .. 
 what you
 are doing is creating a object of the derived class and calling the 
 version
 of f() that belong to derived class B .. ie is the same class object is
 calling the same class function .

 correct me if i m wrong .


 On Sun, Jul 31, 2011 at 8:42 AM, Anika Jain >>> > wrote:

> @ muthu : not declaring tht function as virtual wont save
> overriding
>
> class A
> {
> int a;
>
> public:
> void f()
> {}
> int f2(){}
> };
>
> class B:public A
> {
> public:
> void f()
> {
> cout<<"abc\n";
> }
> };
>
> int main()
> {
> B ob;
> ob.f();
> return 0;
> }
>
> in this output is abc..
> so overriding occured
>
>
> On Sun, Jul 31, 2011 at 8:41 PM, muthu raj 
> wrote:
>
>> Using friend functions we can only invoke already defined private
>> functions. We cannot override or prevent overriding using friend 
>> functions.
>> The problem here is how to prevent base class function from being 
>> overridden
>> in derived class.
>>
>> *Muthuraj R
>> IV th Year , ISE
>> PESIT , Bangalore*
>>
>>
>>
>> On Sun, Jul 31, 2011 at 8:04 AM, Anika Jain <
>> anika.jai...@gmail.com> wrote:
>>
>>> what if we write that function as private of base class.. and
>>> make a function in derived class that is friend function of the 
>>> base class
>>> do that it can call tht private function of base.??
>>>
>>>
>>> On Sun, Jul 31, 2011 at 8:25 PM, muthu raj >> > wrote:
>>>
 Yeah but there is no equivalent of final keyword in c++.So
 to p

Re: [algogeeks] Termination

2011-07-31 Thread Puneet Gautam
@Shashank Nayar:
Thanks maan...! it worked..


On 7/31/11, Shashank Nayak  wrote:
> ctrl+z for win
>
> On Sun, Jul 31, 2011 at 3:18 PM, Abhishek Gupta
> wrote:
>
>> I am only using linux. google it. it must be some ctrl + any key sequence
>>
>>
>> On Sun, Jul 31, 2011 at 3:12 PM, Puneet Gautam
>> wrote:
>>
>>> ctrl+D doesnt work on dev , os windows 7...
>>>
>>> On 7/31/11, Puneet Gautam  wrote:
>>> > Is the eof different for different OS's..?
>>> >
>>> > On 7/31/11, Abhishek Gupta  wrote:
>>> >> compiler : gcc, OS : Fedora 15
>>> >>
>>> >> I use ctrl + d to put EOF in files.
>>> >>
>>> >> you can verify it through this code
>>> >>
>>> >> #include
>>> >> int main(int argc,char *argv[])
>>> >> {int c;
>>> >> while((c=getchar())!=EOF)
>>> >> {
>>> >>  putchar(c);
>>> >>  }
>>> >>  if(c==EOF)
>>> >>  printf("EOF Break");
>>> >>  return 0;
>>> >>  }
>>> >>
>>> >>
>>> >>
>>> >> On Sun, Jul 31, 2011 at 3:05 PM, Puneet Gautam
>>> >> wrote:
>>> >>
>>> >>> Is it possible to terminate this code(except break) while it is
>>> >>> executing..? For what eof will this terminate..?
>>> >>>
>>> >>>
>>> >>> #include
>>> >>> main(int argc,char *argv[])
>>> >>> {int c;
>>> >>> while((c=getchar())!=EOF)
>>> >>> {
>>> >>>  putchar(c);
>>> >>>  }
>>> >>>  }
>>> >>>
>>> >>> Reply fast...
>>> >>>
>>> >>> --
>>> >>> 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.
>>> >>>
>>> >>>
>>> >>
>>> >>
>>> >> --
>>> >> Abhishek Gupta
>>> >> MCA
>>> >> NIT Calicut
>>> >> Kerela
>>> >>
>>> >> --
>>> >> 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.
>>>
>>>
>>
>>
>> --
>> Abhishek Gupta
>> MCA
>> NIT Calicut
>> Kerela
>>
>>  --
>> 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,
> Shashank Nayak
>
> --
> 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] puzzle

2011-07-31 Thread Easee Breezee
On Sun, Jul 31, 2011 at 12:24 PM, prateek gupta  wrote:
> Can anyone plz tell me

H = Head
T = Tail
> 1. how to get a fair result from a unfair coin?

since the probability of HT is the same as TH in two tosses, these two
events are equiprobable. If you get a HH or TT, repeat the experiment
until TH or HT is gotten.

> 2. How to use a fair coin to get unfair result?

getting a tail on both tosses is significantly less probable than not
getting one. so, if we designate TT to be tail and any of the other
events to be head, we get an unfair result.

Hope this works.

>
> --
> Prateek Gupta
>
> --
> 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: Interview ques

2011-07-31 Thread coder dumca
yes Sandeep(sir)  is perfectly right , if we definig a base class function
in derived with exactly same function signature  , the function in derived
class said to override the function in base class,   does nt matter whether
it is virtual or not.

On Sun, Jul 31, 2011 at 10:22 AM, Sandeep Jain wrote:

> @Pandharinath: Please consider the following e.g.
> class A
> {
> public:
> void func(){ /* A'simplementation */}
>  };
>
> class B:public A
> {
> public:
> void func(){/* B's implementation*/ }
> };
>
> What is B's func() doing?
>
>
>
>
> Regards,
> Sandeep Jain
>
>
>
>
> On Sun, Jul 31, 2011 at 10:36 PM, pandharinath gorde <
> pandharinath.go...@gmail.com> wrote:
>
>>
>> sandeep ur misguiding all things are,.
>>
>> for overriding virtual keyword is used that means virtual functions only
>> overriden.
>> In c++ u require to add virtual keyword.
>> and in java every non static function is by default virtual.
>>
>>
>>
>> On Sun, Jul 31, 2011 at 10:23 PM, Sandeep Jain wrote:
>>
>>> Overridden functions and virtual functions are two different concepts...
>>> 1) Two functions in the same scope having same but different signatures =
>>> Over Loading
>>> 2) Two functions having same signatures but one defined in parent class
>>> and the other defined in child class == Overriding
>>> 3) Virtual functions, allow for run time polymorphism among overridden
>>> functions.(only when invoked using pointer)
>>>
>>> btw I'm still trying to think if preventing function over-riding is
>>> possible...
>>>
>>>
>>> Regards,
>>> Sandeep Jain
>>>
>>>
>>>
>>>
>>> On Sun, Jul 31, 2011 at 10:13 PM, Ankit Minglani <
>>> ankit.mingl...@gmail.com> wrote:
>>>
 @aditi : in C++ you define a function virtual to let the derived class
 give its own definition for the same. and in that case the functions are
 overridden. unlike in JAVA where no virtual keyword is needed .. so if you
 write the same code as above in java .. that may be referred to as Method
 overriding .. but not in cpp.


 On Sun, Jul 31, 2011 at 9:34 AM, aditi garg 
 wrote:

> @ Ankit: Wat is overriding actually thn?
>
>
> On Sun, Jul 31, 2011 at 9:58 PM, Anika Jain wrote:
>
>> ohkk.. m so sorry
>>
>>
>> On Sun, Jul 31, 2011 at 9:41 PM, Ankit Minglani <
>> ankit.mingl...@gmail.com> wrote:
>>
>>> @anika: This is not function overriding i think .. you cannot call
>>> the f() function of the base class from the derived class object .. 
>>> what you
>>> are doing is creating a object of the derived class and calling the 
>>> version
>>> of f() that belong to derived class B .. ie is the same class object is
>>> calling the same class function .
>>>
>>> correct me if i m wrong .
>>>
>>>
>>> On Sun, Jul 31, 2011 at 8:42 AM, Anika Jain 
>>> wrote:
>>>
 @ muthu : not declaring tht function as virtual wont save overriding

 class A
 {
 int a;

 public:
 void f()
 {}
 int f2(){}
 };

 class B:public A
 {
 public:
 void f()
 {
 cout<<"abc\n";
 }
 };

 int main()
 {
 B ob;
 ob.f();
 return 0;
 }

 in this output is abc..
 so overriding occured


 On Sun, Jul 31, 2011 at 8:41 PM, muthu raj wrote:

> Using friend functions we can only invoke already defined private
> functions. We cannot override or prevent overriding using friend 
> functions.
> The problem here is how to prevent base class function from being 
> overridden
> in derived class.
>
> *Muthuraj R
> IV th Year , ISE
> PESIT , Bangalore*
>
>
>
>   On Sun, Jul 31, 2011 at 8:04 AM, Anika Jain <
> anika.jai...@gmail.com> wrote:
>
>> what if we write that function as private of base class.. and make
>> a function in derived class that is friend function of the base 
>> class do
>> that it can call tht private function of base.??
>>
>>
>> On Sun, Jul 31, 2011 at 8:25 PM, muthu raj 
>> wrote:
>>
>>> Yeah but there is no equivalent of final keyword in c++.So to
>>> prevent member function from overriding in derived class in c++ 
>>> dont declare
>>> the member function as virtual. Then it cannot be overridden in 
>>> derived
>>> class. There is no other way of preventing a member function of 
>>> base class
>>> from being overridden.
>>>
>>> *Muthuraj R
>>> IV th Year , ISE
>>> PESIT , Bangalore*
>>>
>>>
>>>
>>>   On Sun, Jul 31, 2011 at 7:38 AM, hima

Re: [algogeeks] Re: Interview ques

2011-07-31 Thread muthu raj
Function overriding gains significance only when functions are declared
virtual. Otherwise Overriding does not serve any purpose. the main idea
behind virtual functions and method overloading is to implement Dynamic
Polymorphism i.e decide which version of function(base or derived)  to be
invoked during runtime.
*Muthuraj R
IV th Year , ISE
PESIT , Bangalore*



On Sun, Jul 31, 2011 at 10:22 AM, Sandeep Jain wrote:

> @Pandharinath: Please consider the following e.g.
> class A
> {
> public:
> void func(){ /* A'simplementation */}
> };
>
> class B:public A
> {
> public:
> void func(){/* B's implementation*/ }
> };
>
> What is B's func() doing?
>
>
>
>
> Regards,
> Sandeep Jain
>
>
>
>
> On Sun, Jul 31, 2011 at 10:36 PM, pandharinath gorde <
> pandharinath.go...@gmail.com> wrote:
>
>>
>> sandeep ur misguiding all things are,.
>>
>> for overriding virtual keyword is used that means virtual functions only
>> overriden.
>> In c++ u require to add virtual keyword.
>> and in java every non static function is by default virtual.
>>
>>
>>
>> On Sun, Jul 31, 2011 at 10:23 PM, Sandeep Jain wrote:
>>
>>> Overridden functions and virtual functions are two different concepts...
>>> 1) Two functions in the same scope having same but different signatures =
>>> Over Loading
>>> 2) Two functions having same signatures but one defined in parent class
>>> and the other defined in child class == Overriding
>>> 3) Virtual functions, allow for run time polymorphism among overridden
>>> functions.(only when invoked using pointer)
>>>
>>> btw I'm still trying to think if preventing function over-riding is
>>> possible...
>>>
>>>
>>> Regards,
>>> Sandeep Jain
>>>
>>>
>>>
>>>
>>> On Sun, Jul 31, 2011 at 10:13 PM, Ankit Minglani <
>>> ankit.mingl...@gmail.com> wrote:
>>>
 @aditi : in C++ you define a function virtual to let the derived class
 give its own definition for the same. and in that case the functions are
 overridden. unlike in JAVA where no virtual keyword is needed .. so if you
 write the same code as above in java .. that may be referred to as Method
 overriding .. but not in cpp.


 On Sun, Jul 31, 2011 at 9:34 AM, aditi garg 
 wrote:

> @ Ankit: Wat is overriding actually thn?
>
>
> On Sun, Jul 31, 2011 at 9:58 PM, Anika Jain wrote:
>
>> ohkk.. m so sorry
>>
>>
>> On Sun, Jul 31, 2011 at 9:41 PM, Ankit Minglani <
>> ankit.mingl...@gmail.com> wrote:
>>
>>> @anika: This is not function overriding i think .. you cannot call
>>> the f() function of the base class from the derived class object .. 
>>> what you
>>> are doing is creating a object of the derived class and calling the 
>>> version
>>> of f() that belong to derived class B .. ie is the same class object is
>>> calling the same class function .
>>>
>>> correct me if i m wrong .
>>>
>>>
>>> On Sun, Jul 31, 2011 at 8:42 AM, Anika Jain 
>>> wrote:
>>>
 @ muthu : not declaring tht function as virtual wont save overriding

 class A
 {
 int a;

 public:
 void f()
 {}
 int f2(){}
 };

 class B:public A
 {
 public:
 void f()
 {
 cout<<"abc\n";
 }
 };

 int main()
 {
 B ob;
 ob.f();
 return 0;
 }

 in this output is abc..
 so overriding occured


 On Sun, Jul 31, 2011 at 8:41 PM, muthu raj wrote:

> Using friend functions we can only invoke already defined private
> functions. We cannot override or prevent overriding using friend 
> functions.
> The problem here is how to prevent base class function from being 
> overridden
> in derived class.
>
> *Muthuraj R
> IV th Year , ISE
> PESIT , Bangalore*
>
>
>
> On Sun, Jul 31, 2011 at 8:04 AM, Anika Jain <
> anika.jai...@gmail.com> wrote:
>
>> what if we write that function as private of base class.. and make
>> a function in derived class that is friend function of the base 
>> class do
>> that it can call tht private function of base.??
>>
>>
>> On Sun, Jul 31, 2011 at 8:25 PM, muthu raj 
>> wrote:
>>
>>> Yeah but there is no equivalent of final keyword in c++.So to
>>> prevent member function from overriding in derived class in c++ 
>>> dont declare
>>> the member function as virtual. Then it cannot be overridden in 
>>> derived
>>> class. There is no other way of preventing a member function of 
>>> base class
>>> from being overridden.
>>>
>>> *Muthuraj R
>>> IV th Year , ISE
>

Re: [algogeeks] Re: Interview ques

2011-07-31 Thread Sandeep Jain
@Pandharinath: Please consider the following e.g.
class A
{
public:
void func(){ /* A'simplementation */}
};

class B:public A
{
public:
void func(){/* B's implementation*/ }
};

What is B's func() doing?




Regards,
Sandeep Jain



On Sun, Jul 31, 2011 at 10:36 PM, pandharinath gorde <
pandharinath.go...@gmail.com> wrote:

>
> sandeep ur misguiding all things are,.
>
> for overriding virtual keyword is used that means virtual functions only
> overriden.
> In c++ u require to add virtual keyword.
> and in java every non static function is by default virtual.
>
>
>
> On Sun, Jul 31, 2011 at 10:23 PM, Sandeep Jain wrote:
>
>> Overridden functions and virtual functions are two different concepts...
>> 1) Two functions in the same scope having same but different signatures =
>> Over Loading
>> 2) Two functions having same signatures but one defined in parent class
>> and the other defined in child class == Overriding
>> 3) Virtual functions, allow for run time polymorphism among overridden
>> functions.(only when invoked using pointer)
>>
>> btw I'm still trying to think if preventing function over-riding is
>> possible...
>>
>>
>> Regards,
>> Sandeep Jain
>>
>>
>>
>>
>> On Sun, Jul 31, 2011 at 10:13 PM, Ankit Minglani <
>> ankit.mingl...@gmail.com> wrote:
>>
>>> @aditi : in C++ you define a function virtual to let the derived class
>>> give its own definition for the same. and in that case the functions are
>>> overridden. unlike in JAVA where no virtual keyword is needed .. so if you
>>> write the same code as above in java .. that may be referred to as Method
>>> overriding .. but not in cpp.
>>>
>>>
>>> On Sun, Jul 31, 2011 at 9:34 AM, aditi garg 
>>> wrote:
>>>
 @ Ankit: Wat is overriding actually thn?


 On Sun, Jul 31, 2011 at 9:58 PM, Anika Jain wrote:

> ohkk.. m so sorry
>
>
> On Sun, Jul 31, 2011 at 9:41 PM, Ankit Minglani <
> ankit.mingl...@gmail.com> wrote:
>
>> @anika: This is not function overriding i think .. you cannot call the
>> f() function of the base class from the derived class object .. what you 
>> are
>> doing is creating a object of the derived class and calling the version 
>> of
>> f() that belong to derived class B .. ie is the same class object is 
>> calling
>> the same class function .
>>
>> correct me if i m wrong .
>>
>>
>> On Sun, Jul 31, 2011 at 8:42 AM, Anika Jain 
>> wrote:
>>
>>> @ muthu : not declaring tht function as virtual wont save overriding
>>>
>>> class A
>>> {
>>> int a;
>>>
>>> public:
>>> void f()
>>> {}
>>> int f2(){}
>>> };
>>>
>>> class B:public A
>>> {
>>> public:
>>> void f()
>>> {
>>> cout<<"abc\n";
>>> }
>>> };
>>>
>>> int main()
>>> {
>>> B ob;
>>> ob.f();
>>> return 0;
>>> }
>>>
>>> in this output is abc..
>>> so overriding occured
>>>
>>>
>>> On Sun, Jul 31, 2011 at 8:41 PM, muthu raj wrote:
>>>
 Using friend functions we can only invoke already defined private
 functions. We cannot override or prevent overriding using friend 
 functions.
 The problem here is how to prevent base class function from being 
 overridden
 in derived class.

 *Muthuraj R
 IV th Year , ISE
 PESIT , Bangalore*



 On Sun, Jul 31, 2011 at 8:04 AM, Anika Jain >>> > wrote:

> what if we write that function as private of base class.. and make
> a function in derived class that is friend function of the base class 
> do
> that it can call tht private function of base.??
>
>
> On Sun, Jul 31, 2011 at 8:25 PM, muthu raj 
> wrote:
>
>> Yeah but there is no equivalent of final keyword in c++.So to
>> prevent member function from overriding in derived class in c++ dont 
>> declare
>> the member function as virtual. Then it cannot be overridden in 
>> derived
>> class. There is no other way of preventing a member function of base 
>> class
>> from being overridden.
>>
>> *Muthuraj R
>> IV th Year , ISE
>> PESIT , Bangalore*
>>
>>
>>
>> On Sun, Jul 31, 2011 at 7:38 AM, himanshu kansal <
>> himanshukansal...@gmail.com> wrote:
>>
>>> i think there is no keyword known as final in c++.maybe u are
>>> talking with respect to java
>>>
>>>
>>> On Sun, Jul 31, 2011 at 8:03 PM, muthu raj >> > wrote:
>>>
 By  declaring the function a static final f().
 *Muthuraj R
 IV th Year , ISE
 PESIT , Bangalore*



 On S

Re: [algogeeks] Re: Direct - i ques

2011-07-31 Thread pandharinath gorde
O(1) is possible in normal LL in below case:

i.If u have head then insertion , deletion and accesss to first element at
front .
ii.if u have tail then insertion and access to  element  at last .

if anything missing add anout normal LL

On Sun, Jul 31, 2011 at 9:47 PM, siva viknesh wrote:

> I think the exact question resembles as what ravinder kumar
> saidAnd all these operations in O(1) time...ideas plz
>
> On Jul 31, 5:21 pm, Ravinder Kumar  wrote:
> > Guys the real question is :
> > Design a data structure which support following operation
> > 1. insertion of an arbitrary element
> > 2. removing the oldest element
> > 3. Accessing min element
> >
> > --
> > *With Regards :*
> >
> > Ravinder Kumar
> > B.Tech Final Year
> > Computer Science and Engineering
> > 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.
>
>


-- 
Pandharinath Gorde
+91-9620557641

-- 
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] random generation

2011-07-31 Thread Puneet Gautam
@rajeev: Well, i meant a code which generates a random no. between say
2 and 10 at every run of program...not the random code generator...!

eg:

if a=2 b=10
on first run of program, it produces
3
2nd run:
5
3rd run:
4
4th run:
9

all these values dont follow any sequence between program runs..



On 7/31/11, rajeev bharshetty  wrote:
> *#include*
> *
> *
> *int main()*
> *{*
> *
> *
> *int x,a,b,i,n;*
> *printf("\n Enter the value of n");*
> *scanf("%d",&n);*
> *printf("\n Enter Psoitive integer a");*
> *scanf("%d",&a);*
> *printf("\n Enter the positisve integer b");*
> *scanf("%d",&b);*
> *for(i=1;i<=15;i++)*
> *{*
> * n= (a*n + b);*
> * printf("%d\n",n);*
> *}*
> *return 0;*
> * *
> * }*
>
> Random code generator ...
> Correct me if i am wrong 
> thanks
>
> On Sun, Jul 31, 2011 at 3:19 PM, Someshwar Chandrasekaran <
> somseka...@gmail.com> wrote:
>
>> On Sun, Jul 31, 2011 at 3:09 PM, Puneet Gautam 
>> wrote:
>> > Can we write a code to generate random numbers without using rand
>> function..?
>> >
>> > Pls help me on this!!
>>
>> How about operating on some garbage value?
>>
>> Regards,
>> B.C.Someshwar
>>
>>
>> --
>> 'Talk sense to a fool and he calls you foolish.' - Euripides
>>
>> My Blog:  somsekaran.wordpress.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.
>>
>>
>
>
> --
> Regards
> Rajeev N B 
>
> "*Winners Don't do Different things , they do things Differently"*
>
> --
> 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: Interview ques

2011-07-31 Thread pandharinath gorde
sandeep ur misguiding all things are,.

for overriding virtual keyword is used that means virtual functions only
overriden.
In c++ u require to add virtual keyword.
and in java every non static function is by default virtual.



On Sun, Jul 31, 2011 at 10:23 PM, Sandeep Jain wrote:

> Overridden functions and virtual functions are two different concepts...
> 1) Two functions in the same scope having same but different signatures =
> Over Loading
> 2) Two functions having same signatures but one defined in parent class and
> the other defined in child class == Overriding
> 3) Virtual functions, allow for run time polymorphism among overridden
> functions.(only when invoked using pointer)
>
> btw I'm still trying to think if preventing function over-riding is
> possible...
>
>
> Regards,
> Sandeep Jain
>
>
>
>
> On Sun, Jul 31, 2011 at 10:13 PM, Ankit Minglani  > wrote:
>
>> @aditi : in C++ you define a function virtual to let the derived class
>> give its own definition for the same. and in that case the functions are
>> overridden. unlike in JAVA where no virtual keyword is needed .. so if you
>> write the same code as above in java .. that may be referred to as Method
>> overriding .. but not in cpp.
>>
>>
>> On Sun, Jul 31, 2011 at 9:34 AM, aditi garg wrote:
>>
>>> @ Ankit: Wat is overriding actually thn?
>>>
>>>
>>> On Sun, Jul 31, 2011 at 9:58 PM, Anika Jain wrote:
>>>
 ohkk.. m so sorry


 On Sun, Jul 31, 2011 at 9:41 PM, Ankit Minglani <
 ankit.mingl...@gmail.com> wrote:

> @anika: This is not function overriding i think .. you cannot call the
> f() function of the base class from the derived class object .. what you 
> are
> doing is creating a object of the derived class and calling the version of
> f() that belong to derived class B .. ie is the same class object is 
> calling
> the same class function .
>
> correct me if i m wrong .
>
>
> On Sun, Jul 31, 2011 at 8:42 AM, Anika Jain wrote:
>
>> @ muthu : not declaring tht function as virtual wont save overriding
>>
>> class A
>> {
>> int a;
>>
>> public:
>> void f()
>> {}
>> int f2(){}
>> };
>>
>> class B:public A
>> {
>> public:
>> void f()
>> {
>> cout<<"abc\n";
>> }
>> };
>>
>> int main()
>> {
>> B ob;
>> ob.f();
>> return 0;
>> }
>>
>> in this output is abc..
>> so overriding occured
>>
>>
>> On Sun, Jul 31, 2011 at 8:41 PM, muthu raj wrote:
>>
>>> Using friend functions we can only invoke already defined private
>>> functions. We cannot override or prevent overriding using friend 
>>> functions.
>>> The problem here is how to prevent base class function from being 
>>> overridden
>>> in derived class.
>>>
>>> *Muthuraj R
>>> IV th Year , ISE
>>> PESIT , Bangalore*
>>>
>>>
>>>
>>> On Sun, Jul 31, 2011 at 8:04 AM, Anika Jain 
>>> wrote:
>>>
 what if we write that function as private of base class.. and make a
 function in derived class that is friend function of the base class do 
 that
 it can call tht private function of base.??


 On Sun, Jul 31, 2011 at 8:25 PM, muthu raj wrote:

> Yeah but there is no equivalent of final keyword in c++.So to
> prevent member function from overriding in derived class in c++ dont 
> declare
> the member function as virtual. Then it cannot be overridden in 
> derived
> class. There is no other way of preventing a member function of base 
> class
> from being overridden.
>
> *Muthuraj R
> IV th Year , ISE
> PESIT , Bangalore*
>
>
>
> On Sun, Jul 31, 2011 at 7:38 AM, himanshu kansal <
> himanshukansal...@gmail.com> wrote:
>
>> i think there is no keyword known as final in c++.maybe u are
>> talking with respect to java
>>
>>
>> On Sun, Jul 31, 2011 at 8:03 PM, muthu raj 
>> wrote:
>>
>>> By  declaring the function a static final f().
>>> *Muthuraj R
>>> IV th Year , ISE
>>> PESIT , Bangalore*
>>>
>>>
>>>
>>> On Sun, Jul 31, 2011 at 7:28 AM, himanshu kansal <
>>> himanshukansal...@gmail.com> wrote:
>>>
 sry i thinki misspelled d ques
 d ques was


 how will you protect a derived class to override base class's
 member function in c++

 say if there is a function f() in base class then derived should
 not be able to
 override f() to provide its own definition.
 but The function must be acce

Re: [algogeeks] Re: Interview ques

2011-07-31 Thread Sandeep Jain
Overridden functions and virtual functions are two different concepts...
1) Two functions in the same scope having same but different signatures =
Over Loading
2) Two functions having same signatures but one defined in parent class and
the other defined in child class == Overriding
3) Virtual functions, allow for run time polymorphism among overridden
functions.(only when invoked using pointer)

btw I'm still trying to think if preventing function over-riding is
possible...


Regards,
Sandeep Jain



On Sun, Jul 31, 2011 at 10:13 PM, Ankit Minglani
wrote:

> @aditi : in C++ you define a function virtual to let the derived class give
> its own definition for the same. and in that case the functions are
> overridden. unlike in JAVA where no virtual keyword is needed .. so if you
> write the same code as above in java .. that may be referred to as Method
> overriding .. but not in cpp.
>
>
> On Sun, Jul 31, 2011 at 9:34 AM, aditi garg wrote:
>
>> @ Ankit: Wat is overriding actually thn?
>>
>>
>> On Sun, Jul 31, 2011 at 9:58 PM, Anika Jain wrote:
>>
>>> ohkk.. m so sorry
>>>
>>>
>>> On Sun, Jul 31, 2011 at 9:41 PM, Ankit Minglani <
>>> ankit.mingl...@gmail.com> wrote:
>>>
 @anika: This is not function overriding i think .. you cannot call the
 f() function of the base class from the derived class object .. what you 
 are
 doing is creating a object of the derived class and calling the version of
 f() that belong to derived class B .. ie is the same class object is 
 calling
 the same class function .

 correct me if i m wrong .


 On Sun, Jul 31, 2011 at 8:42 AM, Anika Jain wrote:

> @ muthu : not declaring tht function as virtual wont save overriding
>
> class A
> {
> int a;
>
> public:
> void f()
> {}
> int f2(){}
> };
>
> class B:public A
> {
> public:
> void f()
> {
> cout<<"abc\n";
> }
> };
>
> int main()
> {
> B ob;
> ob.f();
> return 0;
> }
>
> in this output is abc..
> so overriding occured
>
>
> On Sun, Jul 31, 2011 at 8:41 PM, muthu raj wrote:
>
>> Using friend functions we can only invoke already defined private
>> functions. We cannot override or prevent overriding using friend 
>> functions.
>> The problem here is how to prevent base class function from being 
>> overridden
>> in derived class.
>>
>> *Muthuraj R
>> IV th Year , ISE
>> PESIT , Bangalore*
>>
>>
>>
>> On Sun, Jul 31, 2011 at 8:04 AM, Anika Jain 
>> wrote:
>>
>>> what if we write that function as private of base class.. and make a
>>> function in derived class that is friend function of the base class do 
>>> that
>>> it can call tht private function of base.??
>>>
>>>
>>> On Sun, Jul 31, 2011 at 8:25 PM, muthu raj wrote:
>>>
 Yeah but there is no equivalent of final keyword in c++.So to
 prevent member function from overriding in derived class in c++ dont 
 declare
 the member function as virtual. Then it cannot be overridden in derived
 class. There is no other way of preventing a member function of base 
 class
 from being overridden.

 *Muthuraj R
 IV th Year , ISE
 PESIT , Bangalore*



 On Sun, Jul 31, 2011 at 7:38 AM, himanshu kansal <
 himanshukansal...@gmail.com> wrote:

> i think there is no keyword known as final in c++.maybe u are
> talking with respect to java
>
>
> On Sun, Jul 31, 2011 at 8:03 PM, muthu raj 
> wrote:
>
>> By  declaring the function a static final f().
>> *Muthuraj R
>> IV th Year , ISE
>> PESIT , Bangalore*
>>
>>
>>
>> On Sun, Jul 31, 2011 at 7:28 AM, himanshu kansal <
>> himanshukansal...@gmail.com> wrote:
>>
>>> sry i thinki misspelled d ques
>>> d ques was
>>>
>>>
>>> how will you protect a derived class to override base class's
>>> member function in c++
>>>
>>> say if there is a function f() in base class then derived should
>>> not be able to
>>> override f() to provide its own definition.
>>> but The function must be accessible in derived class.
>>>
>>>
>>> PS:dont try to make the function private in base class( it will
>>> be
>>> become inaccessible in derived class).
>>>
>>> On Sun, Jul 31, 2011 at 7:49 PM, himanshu kansal <
>>> himanshukansal...@gmail.com> wrote:
>>>
 how will you protect a base class to override its member
 function in
 derived class

>>

Re: [algogeeks] Any help on bits?

2011-07-31 Thread Ankit Minglani
@Kamakshi : any kind of operation can be used ..

Exactly XORing the bits should do the trick .. and we can then count the
number of 1s in the answer to know how many bits are different .

This is like the Hamming distance used in Hamming code in Networks .

On Sun, Jul 31, 2011 at 8:37 AM, Kamakshii Aggarwal
wrote:

> @what kind of operations can be applied to 'A'?
>
>
> On Sun, Jul 31, 2011 at 6:54 PM, Amol Sharma wrote:
>
>> yupxor would do the required task eaisly !!
>>
>> --
>>
>>
>> Amol Sharma
>> Third Year Student
>> Computer Science and Engineering
>> MNNIT Allahabad
>>
>>
>>
>>
>> On Sun, Jul 31, 2011 at 6:42 PM, Nikhil Gupta 
>> wrote:
>>
>>> @Surya, ^ operator mean XOR operation.
>>>
>>>
>>> On Sun, Jul 31, 2011 at 6:41 PM, Surya Prakash <
>>> suryaprakash...@gmail.com> wrote:
>>>
 we can just apply xor operation rightit's more easier!!

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

>>>
>>>
>>>
>>> --
>>> Nikhil Gupta
>>> Senior Co-ordinator, Publicity
>>> CSI, NSIT Students' Branch
>>> NSIT, New Delhi, India
>>>
>>>
>>>  --
>>> 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,
> Kamakshi
> kamakshi...@gmail.com
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
The more you sweat in the field, the less you bleed in war."

Ankit Minglani
NITK Surathkal

-- 
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: Interview ques

2011-07-31 Thread Ankit Minglani
@aditi : in C++ you define a function virtual to let the derived class give
its own definition for the same. and in that case the functions are
overridden. unlike in JAVA where no virtual keyword is needed .. so if you
write the same code as above in java .. that may be referred to as Method
overriding .. but not in cpp.

On Sun, Jul 31, 2011 at 9:34 AM, aditi garg wrote:

> @ Ankit: Wat is overriding actually thn?
>
>
> On Sun, Jul 31, 2011 at 9:58 PM, Anika Jain wrote:
>
>> ohkk.. m so sorry
>>
>>
>> On Sun, Jul 31, 2011 at 9:41 PM, Ankit Minglani > > wrote:
>>
>>> @anika: This is not function overriding i think .. you cannot call the
>>> f() function of the base class from the derived class object .. what you are
>>> doing is creating a object of the derived class and calling the version of
>>> f() that belong to derived class B .. ie is the same class object is calling
>>> the same class function .
>>>
>>> correct me if i m wrong .
>>>
>>>
>>> On Sun, Jul 31, 2011 at 8:42 AM, Anika Jain wrote:
>>>
 @ muthu : not declaring tht function as virtual wont save overriding

 class A
 {
 int a;

 public:
 void f()
 {}
 int f2(){}
 };

 class B:public A
 {
 public:
 void f()
 {
 cout<<"abc\n";
 }
 };

 int main()
 {
 B ob;
 ob.f();
 return 0;
 }

 in this output is abc..
 so overriding occured


 On Sun, Jul 31, 2011 at 8:41 PM, muthu raj wrote:

> Using friend functions we can only invoke already defined private
> functions. We cannot override or prevent overriding using friend 
> functions.
> The problem here is how to prevent base class function from being 
> overridden
> in derived class.
>
> *Muthuraj R
> IV th Year , ISE
> PESIT , Bangalore*
>
>
>
> On Sun, Jul 31, 2011 at 8:04 AM, Anika Jain wrote:
>
>> what if we write that function as private of base class.. and make a
>> function in derived class that is friend function of the base class do 
>> that
>> it can call tht private function of base.??
>>
>>
>> On Sun, Jul 31, 2011 at 8:25 PM, muthu raj wrote:
>>
>>> Yeah but there is no equivalent of final keyword in c++.So to
>>> prevent member function from overriding in derived class in c++ dont 
>>> declare
>>> the member function as virtual. Then it cannot be overridden in derived
>>> class. There is no other way of preventing a member function of base 
>>> class
>>> from being overridden.
>>>
>>> *Muthuraj R
>>> IV th Year , ISE
>>> PESIT , Bangalore*
>>>
>>>
>>>
>>> On Sun, Jul 31, 2011 at 7:38 AM, himanshu kansal <
>>> himanshukansal...@gmail.com> wrote:
>>>
 i think there is no keyword known as final in c++.maybe u are
 talking with respect to java


 On Sun, Jul 31, 2011 at 8:03 PM, muthu raj wrote:

> By  declaring the function a static final f().
> *Muthuraj R
> IV th Year , ISE
> PESIT , Bangalore*
>
>
>
> On Sun, Jul 31, 2011 at 7:28 AM, himanshu kansal <
> himanshukansal...@gmail.com> wrote:
>
>> sry i thinki misspelled d ques
>> d ques was
>>
>>
>> how will you protect a derived class to override base class's
>> member function in c++
>>
>> say if there is a function f() in base class then derived should
>> not be able to
>> override f() to provide its own definition.
>> but The function must be accessible in derived class.
>>
>>
>> PS:dont try to make the function private in base class( it will be
>> become inaccessible in derived class).
>>
>> On Sun, Jul 31, 2011 at 7:49 PM, himanshu kansal <
>> himanshukansal...@gmail.com> wrote:
>>
>>> how will you protect a base class to override its member function
>>> in
>>> derived class
>>>
>>> say if there is a function f() in base class then derived cannot
>>> override f() to provide its own definition.
>>> The function must be accessible in derived class.
>>>
>>> PS:dont try to make the function private in base class( it will
>>> be
>>> become inaccessible in derived class).
>>
>>
>>
>>
>> --
>>
>>   Regards
>> Himanshu Kansal
>>   Msc Comp. sc.
>> (University of 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 unsu

Re: [algogeeks] Re: Interview ques

2011-07-31 Thread Anika Jain
sorry overriding is redifining virtual function

On Sun, Jul 31, 2011 at 10:05 PM, Anika Jain  wrote:

> overriding redefining virtual function..
> Well then as per this definition not defining the func as virtual is nt the
> solution..
>
>
> On Sun, Jul 31, 2011 at 10:04 PM, aditi garg wrote:
>
>> @ Ankit: Wat is overriding actually thn?
>>
>>
>> On Sun, Jul 31, 2011 at 9:58 PM, Anika Jain wrote:
>>
>>> ohkk.. m so sorry
>>>
>>>
>>> On Sun, Jul 31, 2011 at 9:41 PM, Ankit Minglani <
>>> ankit.mingl...@gmail.com> wrote:
>>>
 @anika: This is not function overriding i think .. you cannot call the
 f() function of the base class from the derived class object .. what you 
 are
 doing is creating a object of the derived class and calling the version of
 f() that belong to derived class B .. ie is the same class object is 
 calling
 the same class function .

 correct me if i m wrong .


 On Sun, Jul 31, 2011 at 8:42 AM, Anika Jain wrote:

> @ muthu : not declaring tht function as virtual wont save overriding
>
> class A
> {
> int a;
>
> public:
> void f()
> {}
> int f2(){}
> };
>
> class B:public A
> {
> public:
> void f()
> {
> cout<<"abc\n";
> }
> };
>
> int main()
> {
> B ob;
> ob.f();
> return 0;
> }
>
> in this output is abc..
> so overriding occured
>
>
> On Sun, Jul 31, 2011 at 8:41 PM, muthu raj wrote:
>
>> Using friend functions we can only invoke already defined private
>> functions. We cannot override or prevent overriding using friend 
>> functions.
>> The problem here is how to prevent base class function from being 
>> overridden
>> in derived class.
>>
>> *Muthuraj R
>> IV th Year , ISE
>> PESIT , Bangalore*
>>
>>
>>
>> On Sun, Jul 31, 2011 at 8:04 AM, Anika Jain 
>> wrote:
>>
>>> what if we write that function as private of base class.. and make a
>>> function in derived class that is friend function of the base class do 
>>> that
>>> it can call tht private function of base.??
>>>
>>>
>>> On Sun, Jul 31, 2011 at 8:25 PM, muthu raj wrote:
>>>
 Yeah but there is no equivalent of final keyword in c++.So to
 prevent member function from overriding in derived class in c++ dont 
 declare
 the member function as virtual. Then it cannot be overridden in derived
 class. There is no other way of preventing a member function of base 
 class
 from being overridden.

 *Muthuraj R
 IV th Year , ISE
 PESIT , Bangalore*



 On Sun, Jul 31, 2011 at 7:38 AM, himanshu kansal <
 himanshukansal...@gmail.com> wrote:

> i think there is no keyword known as final in c++.maybe u are
> talking with respect to java
>
>
> On Sun, Jul 31, 2011 at 8:03 PM, muthu raj 
> wrote:
>
>> By  declaring the function a static final f().
>> *Muthuraj R
>> IV th Year , ISE
>> PESIT , Bangalore*
>>
>>
>>
>> On Sun, Jul 31, 2011 at 7:28 AM, himanshu kansal <
>> himanshukansal...@gmail.com> wrote:
>>
>>> sry i thinki misspelled d ques
>>> d ques was
>>>
>>>
>>> how will you protect a derived class to override base class's
>>> member function in c++
>>>
>>> say if there is a function f() in base class then derived should
>>> not be able to
>>> override f() to provide its own definition.
>>> but The function must be accessible in derived class.
>>>
>>>
>>> PS:dont try to make the function private in base class( it will
>>> be
>>> become inaccessible in derived class).
>>>
>>> On Sun, Jul 31, 2011 at 7:49 PM, himanshu kansal <
>>> himanshukansal...@gmail.com> wrote:
>>>
 how will you protect a base class to override its member
 function in
 derived class

 say if there is a function f() in base class then derived cannot
 override f() to provide its own definition.
 The function must be accessible in derived class.

 PS:dont try to make the function private in base class( it will
 be
 become inaccessible in derived class).
>>>
>>>
>>>
>>>
>>> --
>>>
>>>   Regards
>>> Himanshu Kansal
>>>   Msc Comp. sc.
>>> (University of Delhi)
>>>
>>>
>>>  --
>>> You received this message because you are subscribed to t

Re: [algogeeks] Re: Interview ques

2011-07-31 Thread Anika Jain
overriding redefining virtual function..
Well then as per this definition not defining the func as virtual is nt the
solution..

On Sun, Jul 31, 2011 at 10:04 PM, aditi garg wrote:

> @ Ankit: Wat is overriding actually thn?
>
>
> On Sun, Jul 31, 2011 at 9:58 PM, Anika Jain wrote:
>
>> ohkk.. m so sorry
>>
>>
>> On Sun, Jul 31, 2011 at 9:41 PM, Ankit Minglani > > wrote:
>>
>>> @anika: This is not function overriding i think .. you cannot call the
>>> f() function of the base class from the derived class object .. what you are
>>> doing is creating a object of the derived class and calling the version of
>>> f() that belong to derived class B .. ie is the same class object is calling
>>> the same class function .
>>>
>>> correct me if i m wrong .
>>>
>>>
>>> On Sun, Jul 31, 2011 at 8:42 AM, Anika Jain wrote:
>>>
 @ muthu : not declaring tht function as virtual wont save overriding

 class A
 {
 int a;

 public:
 void f()
 {}
 int f2(){}
 };

 class B:public A
 {
 public:
 void f()
 {
 cout<<"abc\n";
 }
 };

 int main()
 {
 B ob;
 ob.f();
 return 0;
 }

 in this output is abc..
 so overriding occured


 On Sun, Jul 31, 2011 at 8:41 PM, muthu raj wrote:

> Using friend functions we can only invoke already defined private
> functions. We cannot override or prevent overriding using friend 
> functions.
> The problem here is how to prevent base class function from being 
> overridden
> in derived class.
>
> *Muthuraj R
> IV th Year , ISE
> PESIT , Bangalore*
>
>
>
> On Sun, Jul 31, 2011 at 8:04 AM, Anika Jain wrote:
>
>> what if we write that function as private of base class.. and make a
>> function in derived class that is friend function of the base class do 
>> that
>> it can call tht private function of base.??
>>
>>
>> On Sun, Jul 31, 2011 at 8:25 PM, muthu raj wrote:
>>
>>> Yeah but there is no equivalent of final keyword in c++.So to
>>> prevent member function from overriding in derived class in c++ dont 
>>> declare
>>> the member function as virtual. Then it cannot be overridden in derived
>>> class. There is no other way of preventing a member function of base 
>>> class
>>> from being overridden.
>>>
>>> *Muthuraj R
>>> IV th Year , ISE
>>> PESIT , Bangalore*
>>>
>>>
>>>
>>> On Sun, Jul 31, 2011 at 7:38 AM, himanshu kansal <
>>> himanshukansal...@gmail.com> wrote:
>>>
 i think there is no keyword known as final in c++.maybe u are
 talking with respect to java


 On Sun, Jul 31, 2011 at 8:03 PM, muthu raj wrote:

> By  declaring the function a static final f().
> *Muthuraj R
> IV th Year , ISE
> PESIT , Bangalore*
>
>
>
> On Sun, Jul 31, 2011 at 7:28 AM, himanshu kansal <
> himanshukansal...@gmail.com> wrote:
>
>> sry i thinki misspelled d ques
>> d ques was
>>
>>
>> how will you protect a derived class to override base class's
>> member function in c++
>>
>> say if there is a function f() in base class then derived should
>> not be able to
>> override f() to provide its own definition.
>> but The function must be accessible in derived class.
>>
>>
>> PS:dont try to make the function private in base class( it will be
>> become inaccessible in derived class).
>>
>> On Sun, Jul 31, 2011 at 7:49 PM, himanshu kansal <
>> himanshukansal...@gmail.com> wrote:
>>
>>> how will you protect a base class to override its member function
>>> in
>>> derived class
>>>
>>> say if there is a function f() in base class then derived cannot
>>> override f() to provide its own definition.
>>> The function must be accessible in derived class.
>>>
>>> PS:dont try to make the function private in base class( it will
>>> be
>>> become inaccessible in derived class).
>>
>>
>>
>>
>> --
>>
>>   Regards
>> Himanshu Kansal
>>   Msc Comp. sc.
>> (University of 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=

Re: [algogeeks] Re: Interview ques

2011-07-31 Thread aditi garg
@ Ankit: Wat is overriding actually thn?

On Sun, Jul 31, 2011 at 9:58 PM, Anika Jain  wrote:

> ohkk.. m so sorry
>
>
> On Sun, Jul 31, 2011 at 9:41 PM, Ankit Minglani 
> wrote:
>
>> @anika: This is not function overriding i think .. you cannot call the f()
>> function of the base class from the derived class object .. what you are
>> doing is creating a object of the derived class and calling the version of
>> f() that belong to derived class B .. ie is the same class object is calling
>> the same class function .
>>
>> correct me if i m wrong .
>>
>>
>> On Sun, Jul 31, 2011 at 8:42 AM, Anika Jain wrote:
>>
>>> @ muthu : not declaring tht function as virtual wont save overriding
>>>
>>> class A
>>> {
>>> int a;
>>>
>>> public:
>>> void f()
>>> {}
>>> int f2(){}
>>> };
>>>
>>> class B:public A
>>> {
>>> public:
>>> void f()
>>> {
>>> cout<<"abc\n";
>>> }
>>> };
>>>
>>> int main()
>>> {
>>> B ob;
>>> ob.f();
>>> return 0;
>>> }
>>>
>>> in this output is abc..
>>> so overriding occured
>>>
>>>
>>> On Sun, Jul 31, 2011 at 8:41 PM, muthu raj  wrote:
>>>
 Using friend functions we can only invoke already defined private
 functions. We cannot override or prevent overriding using friend functions.
 The problem here is how to prevent base class function from being 
 overridden
 in derived class.

 *Muthuraj R
 IV th Year , ISE
 PESIT , Bangalore*



 On Sun, Jul 31, 2011 at 8:04 AM, Anika Jain wrote:

> what if we write that function as private of base class.. and make a
> function in derived class that is friend function of the base class do 
> that
> it can call tht private function of base.??
>
>
> On Sun, Jul 31, 2011 at 8:25 PM, muthu raj wrote:
>
>> Yeah but there is no equivalent of final keyword in c++.So to
>> prevent member function from overriding in derived class in c++ dont 
>> declare
>> the member function as virtual. Then it cannot be overridden in derived
>> class. There is no other way of preventing a member function of base 
>> class
>> from being overridden.
>>
>> *Muthuraj R
>> IV th Year , ISE
>> PESIT , Bangalore*
>>
>>
>>
>> On Sun, Jul 31, 2011 at 7:38 AM, himanshu kansal <
>> himanshukansal...@gmail.com> wrote:
>>
>>> i think there is no keyword known as final in c++.maybe u are
>>> talking with respect to java
>>>
>>>
>>> On Sun, Jul 31, 2011 at 8:03 PM, muthu raj wrote:
>>>
 By  declaring the function a static final f().
 *Muthuraj R
 IV th Year , ISE
 PESIT , Bangalore*



 On Sun, Jul 31, 2011 at 7:28 AM, himanshu kansal <
 himanshukansal...@gmail.com> wrote:

> sry i thinki misspelled d ques
> d ques was
>
>
> how will you protect a derived class to override base class's
> member function in c++
>
> say if there is a function f() in base class then derived should
> not be able to
> override f() to provide its own definition.
> but The function must be accessible in derived class.
>
>
> PS:dont try to make the function private in base class( it will be
> become inaccessible in derived class).
>
> On Sun, Jul 31, 2011 at 7:49 PM, himanshu kansal <
> himanshukansal...@gmail.com> wrote:
>
>> how will you protect a base class to override its member function
>> in
>> derived class
>>
>> say if there is a function f() in base class then derived cannot
>> override f() to provide its own definition.
>> The function must be accessible in derived class.
>>
>> PS:dont try to make the function private in base class( it will be
>> become inaccessible in derived class).
>
>
>
>
> --
>
>   Regards
> Himanshu Kansal
>   Msc Comp. sc.
> (University of 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, visi

Re: [algogeeks] plz explain

2011-07-31 Thread aditi garg
well lets say its ruppees...
mike has Rs20.50 and Todd Rs .50  condition 1 satisfied
for condition 2. mike has 2050 paise and mike 50 paise...(P.S its not in
fractions)
I know u must be thinking im stupid bt i have read dis in sm book and dis is
wat the ans dey had gvn...:)

On Sun, Jul 31, 2011 at 9:36 PM, shiv narayan wrote:

> Mike has $20 more than Todd. How much does each have given that
> combined they have $21 between them. You can't use fractions in the
> answer.
>
> --
> 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.
>
>


-- 
Aditi Garg
Undergraduate Student
Electronics & Communication Divison
NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
Sector 3, Dwarka
New 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] 100th Fibonacci number using LL

2011-07-31 Thread bharath sriram
Since both the "normal" recursive (stack overflow) and non-recursive (data
type overflow) versions fails, is there a  way one can use linked lists to
solve this problem?

Bharath.

-- 
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: Interview ques

2011-07-31 Thread Anika Jain
ohkk.. m so sorry

On Sun, Jul 31, 2011 at 9:41 PM, Ankit Minglani wrote:

> @anika: This is not function overriding i think .. you cannot call the f()
> function of the base class from the derived class object .. what you are
> doing is creating a object of the derived class and calling the version of
> f() that belong to derived class B .. ie is the same class object is calling
> the same class function .
>
> correct me if i m wrong .
>
>
> On Sun, Jul 31, 2011 at 8:42 AM, Anika Jain wrote:
>
>> @ muthu : not declaring tht function as virtual wont save overriding
>>
>> class A
>> {
>> int a;
>>
>> public:
>> void f()
>> {}
>> int f2(){}
>> };
>>
>> class B:public A
>> {
>> public:
>> void f()
>> {
>> cout<<"abc\n";
>> }
>> };
>>
>> int main()
>> {
>> B ob;
>> ob.f();
>> return 0;
>> }
>>
>> in this output is abc..
>> so overriding occured
>>
>>
>> On Sun, Jul 31, 2011 at 8:41 PM, muthu raj  wrote:
>>
>>> Using friend functions we can only invoke already defined private
>>> functions. We cannot override or prevent overriding using friend functions.
>>> The problem here is how to prevent base class function from being overridden
>>> in derived class.
>>>
>>> *Muthuraj R
>>> IV th Year , ISE
>>> PESIT , Bangalore*
>>>
>>>
>>>
>>> On Sun, Jul 31, 2011 at 8:04 AM, Anika Jain wrote:
>>>
 what if we write that function as private of base class.. and make a
 function in derived class that is friend function of the base class do that
 it can call tht private function of base.??


 On Sun, Jul 31, 2011 at 8:25 PM, muthu raj wrote:

> Yeah but there is no equivalent of final keyword in c++.So to
> prevent member function from overriding in derived class in c++ dont 
> declare
> the member function as virtual. Then it cannot be overridden in derived
> class. There is no other way of preventing a member function of base class
> from being overridden.
>
> *Muthuraj R
> IV th Year , ISE
> PESIT , Bangalore*
>
>
>
> On Sun, Jul 31, 2011 at 7:38 AM, himanshu kansal <
> himanshukansal...@gmail.com> wrote:
>
>> i think there is no keyword known as final in c++.maybe u are
>> talking with respect to java
>>
>>
>> On Sun, Jul 31, 2011 at 8:03 PM, muthu raj wrote:
>>
>>> By  declaring the function a static final f().
>>> *Muthuraj R
>>> IV th Year , ISE
>>> PESIT , Bangalore*
>>>
>>>
>>>
>>> On Sun, Jul 31, 2011 at 7:28 AM, himanshu kansal <
>>> himanshukansal...@gmail.com> wrote:
>>>
 sry i thinki misspelled d ques
 d ques was


 how will you protect a derived class to override base class's member
 function in c++

 say if there is a function f() in base class then derived should not
 be able to
 override f() to provide its own definition.
 but The function must be accessible in derived class.


 PS:dont try to make the function private in base class( it will be
 become inaccessible in derived class).

 On Sun, Jul 31, 2011 at 7:49 PM, himanshu kansal <
 himanshukansal...@gmail.com> wrote:

> how will you protect a base class to override its member function
> in
> derived class
>
> say if there is a function f() in base class then derived cannot
> override f() to provide its own definition.
> The function must be accessible in derived class.
>
> PS:dont try to make the function private in base class( it will be
> become inaccessible in derived class).




 --

   Regards
 Himanshu Kansal
   Msc Comp. sc.
 (University of 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.
>>>
>>
>>
>>
>> --
>>
>>   Regards
>> Himanshu Kansal
>>   Msc Comp. sc.
>> (University of Delhi)
>>
>>  --
>> You received this message because you are s

[algogeeks] puzzle

2011-07-31 Thread prateek gupta
Can anyone plz tell me
1. how to get a fair result from a unfair coin?
2. How to use a fair coin to get unfair result?

-- 
Prateek Gupta

-- 
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: Direct - i ques

2011-07-31 Thread siva viknesh
I think the exact question resembles as what ravinder kumar
saidAnd all these operations in O(1) time...ideas plz

On Jul 31, 5:21 pm, Ravinder Kumar  wrote:
> Guys the real question is :
> Design a data structure which support following operation
> 1. insertion of an arbitrary element
> 2. removing the oldest element
> 3. Accessing min element
>
> --
> *With Regards :*
>
> Ravinder Kumar
> B.Tech Final Year
> Computer Science and Engineering
> 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.



[algogeeks] Rajesh Kumar wants to chat

2011-07-31 Thread Rajesh Kumar
---

Rajesh Kumar wants to stay in better touch using some of Google's coolest new
products.

If you already have Gmail or Google Talk, visit:
http://mail.google.com/mail/b-35ff6532a6-5d4b375227-bNzxUmbwNA85_wpli7pdkf9R_4k
You'll need to click this link to be able to chat with Rajesh Kumar.

To get Gmail - a free email account from Google with over 2,800 megabytes of
storage - and chat with Rajesh Kumar, visit:
http://mail.google.com/mail/a-35ff6532a6-5d4b375227-bNzxUmbwNA85_wpli7pdkf9R_4k

Gmail offers:
- Instant messaging right inside Gmail
- Powerful spam protection
- Built-in search for finding your messages and a helpful way of organizing
  emails into "conversations"
- No pop-up ads or untargeted banners - just text ads and related information
  that are relevant to the content of your messages

All this, and its yours for free. But wait, there's more! By opening a Gmail
account, you also get access to Google Talk, Google's instant messaging
service:

http://www.google.com/talk/

Google Talk offers:
- Web-based chat that you can use anywhere, without a download
- A contact list that's synchronized with your Gmail account
- Free, high quality PC-to-PC voice calls when you download the Google Talk
  client

We're working hard to add new features and make improvements, so we might also
ask for your comments and suggestions periodically. We appreciate your help in
making our products even better!

Thanks,
The Google Team

To learn more about Gmail and Google Talk, visit:
http://mail.google.com/mail/help/about.html
http://www.google.com/talk/about.html

(If clicking the URLs in this message does not work, copy and paste them into
the address bar of your browser).

-- 
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: Interview ques

2011-07-31 Thread Ankit Minglani
@anika: This is not function overriding i think .. you cannot call the f()
function of the base class from the derived class object .. what you are
doing is creating a object of the derived class and calling the version of
f() that belong to derived class B .. ie is the same class object is calling
the same class function .

correct me if i m wrong .

On Sun, Jul 31, 2011 at 8:42 AM, Anika Jain  wrote:

> @ muthu : not declaring tht function as virtual wont save overriding
>
> class A
> {
> int a;
>
> public:
> void f()
> {}
> int f2(){}
> };
>
> class B:public A
> {
> public:
> void f()
> {
> cout<<"abc\n";
> }
> };
>
> int main()
> {
> B ob;
> ob.f();
> return 0;
> }
>
> in this output is abc..
> so overriding occured
>
>
> On Sun, Jul 31, 2011 at 8:41 PM, muthu raj  wrote:
>
>> Using friend functions we can only invoke already defined private
>> functions. We cannot override or prevent overriding using friend functions.
>> The problem here is how to prevent base class function from being overridden
>> in derived class.
>>
>> *Muthuraj R
>> IV th Year , ISE
>> PESIT , Bangalore*
>>
>>
>>
>> On Sun, Jul 31, 2011 at 8:04 AM, Anika Jain wrote:
>>
>>> what if we write that function as private of base class.. and make a
>>> function in derived class that is friend function of the base class do that
>>> it can call tht private function of base.??
>>>
>>>
>>> On Sun, Jul 31, 2011 at 8:25 PM, muthu raj  wrote:
>>>
 Yeah but there is no equivalent of final keyword in c++.So to
 prevent member function from overriding in derived class in c++ dont 
 declare
 the member function as virtual. Then it cannot be overridden in derived
 class. There is no other way of preventing a member function of base class
 from being overridden.

 *Muthuraj R
 IV th Year , ISE
 PESIT , Bangalore*



 On Sun, Jul 31, 2011 at 7:38 AM, himanshu kansal <
 himanshukansal...@gmail.com> wrote:

> i think there is no keyword known as final in c++.maybe u are
> talking with respect to java
>
>
> On Sun, Jul 31, 2011 at 8:03 PM, muthu raj wrote:
>
>> By  declaring the function a static final f().
>> *Muthuraj R
>> IV th Year , ISE
>> PESIT , Bangalore*
>>
>>
>>
>> On Sun, Jul 31, 2011 at 7:28 AM, himanshu kansal <
>> himanshukansal...@gmail.com> wrote:
>>
>>> sry i thinki misspelled d ques
>>> d ques was
>>>
>>>
>>> how will you protect a derived class to override base class's member
>>> function in c++
>>>
>>> say if there is a function f() in base class then derived should not
>>> be able to
>>> override f() to provide its own definition.
>>> but The function must be accessible in derived class.
>>>
>>>
>>> PS:dont try to make the function private in base class( it will be
>>> become inaccessible in derived class).
>>>
>>> On Sun, Jul 31, 2011 at 7:49 PM, himanshu kansal <
>>> himanshukansal...@gmail.com> wrote:
>>>
 how will you protect a base class to override its member function in
 derived class

 say if there is a function f() in base class then derived cannot
 override f() to provide its own definition.
 The function must be accessible in derived class.

 PS:dont try to make the function private in base class( it will be
 become inaccessible in derived class).
>>>
>>>
>>>
>>>
>>> --
>>>
>>>   Regards
>>> Himanshu Kansal
>>>   Msc Comp. sc.
>>> (University of 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.
>>
>
>
>
> --
>
>   Regards
> Himanshu Kansal
>   Msc Comp. sc.
> (University of 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, visi

[algogeeks] plz explain

2011-07-31 Thread shiv narayan
Mike has $20 more than Todd. How much does each have given that
combined they have $21 between them. You can't use fractions in the
answer.

-- 
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++ urgent friend func doubt

2011-07-31 Thread Anika Jain
class B;

class A
{
int a;
public:
int f2(){}
friend int B::func(A ob);
};

class B:public A
{
public:
int func(A ob)
{
}
};


why compilation error is coming over here for friend statement n forward
protype declaration of class B ??

-- 
You received this message 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: Interview ques

2011-07-31 Thread Anika Jain
@ muthu : not declaring tht function as virtual wont save overriding

class A
{
int a;

public:
void f()
{}
int f2(){}
};

class B:public A
{
public:
void f()
{
cout<<"abc\n";
}
};

int main()
{
B ob;
ob.f();
return 0;
}

in this output is abc..
so overriding occured

On Sun, Jul 31, 2011 at 8:41 PM, muthu raj  wrote:

> Using friend functions we can only invoke already defined private
> functions. We cannot override or prevent overriding using friend functions.
> The problem here is how to prevent base class function from being overridden
> in derived class.
>
> *Muthuraj R
> IV th Year , ISE
> PESIT , Bangalore*
>
>
>
> On Sun, Jul 31, 2011 at 8:04 AM, Anika Jain wrote:
>
>> what if we write that function as private of base class.. and make a
>> function in derived class that is friend function of the base class do that
>> it can call tht private function of base.??
>>
>>
>> On Sun, Jul 31, 2011 at 8:25 PM, muthu raj  wrote:
>>
>>> Yeah but there is no equivalent of final keyword in c++.So to prevent
>>> member function from overriding in derived class in c++ dont declare the
>>> member function as virtual. Then it cannot be overridden in derived class.
>>> There is no other way of preventing a member function of base class from
>>> being overridden.
>>>
>>> *Muthuraj R
>>> IV th Year , ISE
>>> PESIT , Bangalore*
>>>
>>>
>>>
>>> On Sun, Jul 31, 2011 at 7:38 AM, himanshu kansal <
>>> himanshukansal...@gmail.com> wrote:
>>>
 i think there is no keyword known as final in c++.maybe u are
 talking with respect to java


 On Sun, Jul 31, 2011 at 8:03 PM, muthu raj wrote:

> By  declaring the function a static final f().
> *Muthuraj R
> IV th Year , ISE
> PESIT , Bangalore*
>
>
>
> On Sun, Jul 31, 2011 at 7:28 AM, himanshu kansal <
> himanshukansal...@gmail.com> wrote:
>
>> sry i thinki misspelled d ques
>> d ques was
>>
>>
>> how will you protect a derived class to override base class's member
>> function in c++
>>
>> say if there is a function f() in base class then derived should not
>> be able to
>> override f() to provide its own definition.
>> but The function must be accessible in derived class.
>>
>>
>> PS:dont try to make the function private in base class( it will be
>> become inaccessible in derived class).
>>
>> On Sun, Jul 31, 2011 at 7:49 PM, himanshu kansal <
>> himanshukansal...@gmail.com> wrote:
>>
>>> how will you protect a base class to override its member function in
>>> derived class
>>>
>>> say if there is a function f() in base class then derived cannot
>>> override f() to provide its own definition.
>>> The function must be accessible in derived class.
>>>
>>> PS:dont try to make the function private in base class( it will be
>>> become inaccessible in derived class).
>>
>>
>>
>>
>> --
>>
>>   Regards
>> Himanshu Kansal
>>   Msc Comp. sc.
>> (University of 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.
>



 --

   Regards
 Himanshu Kansal
   Msc Comp. sc.
 (University of 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.
>>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send e

Re: [algogeeks] Any help on bits?

2011-07-31 Thread Kamakshii Aggarwal
@what kind of operations can be applied to 'A'?

On Sun, Jul 31, 2011 at 6:54 PM, Amol Sharma  wrote:

> yupxor would do the required task eaisly !!
>
> --
>
>
> Amol Sharma
> Third Year Student
> Computer Science and Engineering
> MNNIT Allahabad
>
>
>
>
> On Sun, Jul 31, 2011 at 6:42 PM, Nikhil Gupta 
> wrote:
>
>> @Surya, ^ operator mean XOR operation.
>>
>>
>> On Sun, Jul 31, 2011 at 6:41 PM, Surya Prakash > > wrote:
>>
>>> we can just apply xor operation rightit's more easier!!
>>>
>>> --
>>> 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.
>>>
>>
>>
>>
>> --
>> Nikhil Gupta
>> Senior Co-ordinator, Publicity
>> CSI, NSIT Students' Branch
>> NSIT, New Delhi, India
>>
>>
>>  --
>> 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,
Kamakshi
kamakshi...@gmail.com

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Odd one out

2011-07-31 Thread Anika Jain
@gopi: in 2nd of urs we after tree creation we will need to search each
element in array that will take o(nlogn) time.. is there any appraoch tht
reduces this?

On Sun, Jul 31, 2011 at 6:39 PM, *$*  wrote:

>
>
> Q1->Construct a binary tree , in such a way that if element occured for the
> first time , insert into tree , if occurs at second time , remove from the
> list.
> As all elements except the one need to find are even , at the end of the
> list , all the tree will contain only one element.
>
> Q2-> Construct a binary tree. similar to the above.
> Now again start from first element and check which element is missing in
> the tree. That is the required one.
>
>
> Thx,
> --Gopi
>
>
> On Sun, Jul 31, 2011 at 2:07 PM, Abhishek Gupta wrote:
>
>> Q1-> A large size array is given. All except one element are repeated even
>> no. of times and one element is repeated odd no. of times. Find that
>> element. Don't use X-OR
>>
>> Ans -> Is there any efficient way of finding it without using sorting or
>> removing duplicates or using hash tables??
>>
>>
>>
>> Q2-> Same qn is like all except one are repeated off no. of times and one
>> element repeated even no. of times. find that element. (no specification for
>> X-OR use given)
>>
>> Ans-> Again, I tried it using hash table.
>>
>>
>> --
>> Abhishek Gupta
>> MCA
>> NIT Calicut
>> Kerela
>>
>>  --
>> 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.
>>
>
>
>
> --
> Thx,
> --Gopi
>
>  --
> 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] problem of structur

2011-07-31 Thread rajeev bharshetty
*#include*
*
*
*
*
*struct emp*
*{*
*char name[20];*
*int age;*
*};*
*f(struct emp ee)*
*{*
*printf("%s ...%d\n",ee.name,ee.age);*
*}*
*main()*
*{*
*struct emp e={"qwe",12};*
*f(e);*
*}*

This above code works fine on gcc 4.3.2
output  : qwe ...12

On Sun, Jul 31, 2011 at 8:38 PM, Anika Jain  wrote:

> In C default return type is int and as you havent given return type for f
> function compiler assumes it as int but u r not returning any integer from
> that function
>
> On Sun, Jul 31, 2011 at 8:33 PM, Rajesh Kumar wrote:
>
>> What is Error in This program??plzrply
>> #include
>> f(struct epm);
>> struct emp
>> {
>> char name[20];
>> int age;
>> };
>> main()
>> {
>> struct emp e={"qwe",12};
>> f(e);
>> }
>> f(struct emp ee)
>> {
>> printf("%s ...%d\n",ee.name,ee.age);
>> }
>>
>>
>> --
>> 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.
>>
>
>  --
> 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
Rajeev N B 

"*Winners Don't do Different things , they do things Differently"*

-- 
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: Interview ques

2011-07-31 Thread muthu raj
Using friend functions we can only invoke already defined private functions.
We cannot override or prevent overriding using friend functions. The problem
here is how to prevent base class function from being overridden in derived
class.
*Muthuraj R
IV th Year , ISE
PESIT , Bangalore*



On Sun, Jul 31, 2011 at 8:04 AM, Anika Jain  wrote:

> what if we write that function as private of base class.. and make a
> function in derived class that is friend function of the base class do that
> it can call tht private function of base.??
>
>
> On Sun, Jul 31, 2011 at 8:25 PM, muthu raj  wrote:
>
>> Yeah but there is no equivalent of final keyword in c++.So to prevent
>> member function from overriding in derived class in c++ dont declare the
>> member function as virtual. Then it cannot be overridden in derived class.
>> There is no other way of preventing a member function of base class from
>> being overridden.
>>
>> *Muthuraj R
>> IV th Year , ISE
>> PESIT , Bangalore*
>>
>>
>>
>> On Sun, Jul 31, 2011 at 7:38 AM, himanshu kansal <
>> himanshukansal...@gmail.com> wrote:
>>
>>> i think there is no keyword known as final in c++.maybe u are talking
>>> with respect to java
>>>
>>>
>>> On Sun, Jul 31, 2011 at 8:03 PM, muthu raj  wrote:
>>>
 By  declaring the function a static final f().
 *Muthuraj R
 IV th Year , ISE
 PESIT , Bangalore*



 On Sun, Jul 31, 2011 at 7:28 AM, himanshu kansal <
 himanshukansal...@gmail.com> wrote:

> sry i thinki misspelled d ques
> d ques was
>
>
> how will you protect a derived class to override base class's member
> function in c++
>
> say if there is a function f() in base class then derived should not be
> able to
> override f() to provide its own definition.
> but The function must be accessible in derived class.
>
>
> PS:dont try to make the function private in base class( it will be
> become inaccessible in derived class).
>
> On Sun, Jul 31, 2011 at 7:49 PM, himanshu kansal <
> himanshukansal...@gmail.com> wrote:
>
>> how will you protect a base class to override its member function in
>> derived class
>>
>> say if there is a function f() in base class then derived cannot
>> override f() to provide its own definition.
>> The function must be accessible in derived class.
>>
>> PS:dont try to make the function private in base class( it will be
>> become inaccessible in derived class).
>
>
>
>
> --
>
>   Regards
> Himanshu Kansal
>   Msc Comp. sc.
> (University of 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.

>>>
>>>
>>>
>>> --
>>>
>>>   Regards
>>> Himanshu Kansal
>>>   Msc Comp. sc.
>>> (University of 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.
>>
>
>  --
> 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://gro

[algogeeks] problem of structur

2011-07-31 Thread Rajesh Kumar
What is Error in This program??plzrply
#include
f(struct epm);
struct emp
{
char name[20];
int age;
};
main()
{
struct emp e={"qwe",12};
f(e);
}
f(struct emp ee)
{
printf("%s ...%d\n",ee.name,ee.age);
}


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



Re: [algogeeks] problem of structur

2011-07-31 Thread Pratz mary
i think its because when ur declaring func f ur passing a struct which hasnt
been declared yet...put the structure declaraion before the func declaration

On 31 July 2011 20:33, Rajesh Kumar  wrote:

> What is Error in This program??plzrply
> #include
> f(struct epm);
> struct emp
> {
> char name[20];
> int age;
> };
> main()
> {
> struct emp e={"qwe",12};
> f(e);
> }
> f(struct emp ee)
> {
> printf("%s ...%d\n",ee.name,ee.age);
> }
>
>
> --
> 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.
>



-- 
regards Pratima :)

-- 
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] problem of structur

2011-07-31 Thread Anika Jain
In C default return type is int and as you havent given return type for f
function compiler assumes it as int but u r not returning any integer from
that function

On Sun, Jul 31, 2011 at 8:33 PM, Rajesh Kumar wrote:

> What is Error in This program??plzrply
> #include
> f(struct epm);
> struct emp
> {
> char name[20];
> int age;
> };
> main()
> {
> struct emp e={"qwe",12};
> f(e);
> }
> f(struct emp ee)
> {
> printf("%s ...%d\n",ee.name,ee.age);
> }
>
>
> --
> 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.
>

-- 
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: Interview ques

2011-07-31 Thread Anika Jain
what if we write that function as private of base class.. and make a
function in derived class that is friend function of the base class do that
it can call tht private function of base.??

On Sun, Jul 31, 2011 at 8:25 PM, muthu raj  wrote:

> Yeah but there is no equivalent of final keyword in c++.So to prevent
> member function from overriding in derived class in c++ dont declare the
> member function as virtual. Then it cannot be overridden in derived class.
> There is no other way of preventing a member function of base class from
> being overridden.
>
> *Muthuraj R
> IV th Year , ISE
> PESIT , Bangalore*
>
>
>
> On Sun, Jul 31, 2011 at 7:38 AM, himanshu kansal <
> himanshukansal...@gmail.com> wrote:
>
>> i think there is no keyword known as final in c++.maybe u are talking
>> with respect to java
>>
>>
>> On Sun, Jul 31, 2011 at 8:03 PM, muthu raj  wrote:
>>
>>> By  declaring the function a static final f().
>>> *Muthuraj R
>>> IV th Year , ISE
>>> PESIT , Bangalore*
>>>
>>>
>>>
>>> On Sun, Jul 31, 2011 at 7:28 AM, himanshu kansal <
>>> himanshukansal...@gmail.com> wrote:
>>>
 sry i thinki misspelled d ques
 d ques was


 how will you protect a derived class to override base class's member
 function in c++

 say if there is a function f() in base class then derived should not be
 able to
 override f() to provide its own definition.
 but The function must be accessible in derived class.


 PS:dont try to make the function private in base class( it will be
 become inaccessible in derived class).

 On Sun, Jul 31, 2011 at 7:49 PM, himanshu kansal <
 himanshukansal...@gmail.com> wrote:

> how will you protect a base class to override its member function in
> derived class
>
> say if there is a function f() in base class then derived cannot
> override f() to provide its own definition.
> The function must be accessible in derived class.
>
> PS:dont try to make the function private in base class( it will be
> become inaccessible in derived class).




 --

   Regards
 Himanshu Kansal
   Msc Comp. sc.
 (University of 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.
>>>
>>
>>
>>
>> --
>>
>>   Regards
>> Himanshu Kansal
>>   Msc Comp. sc.
>> (University of 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.
>

-- 
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: Interview ques

2011-07-31 Thread muthu raj
Yeah but there is no equivalent of final keyword in c++.So to prevent
member function from overriding in derived class in c++ dont declare the
member function as virtual. Then it cannot be overridden in derived class.
There is no other way of preventing a member function of base class from
being overridden.
*Muthuraj R
IV th Year , ISE
PESIT , Bangalore*



On Sun, Jul 31, 2011 at 7:38 AM, himanshu kansal <
himanshukansal...@gmail.com> wrote:

> i think there is no keyword known as final in c++.maybe u are talking
> with respect to java
>
>
> On Sun, Jul 31, 2011 at 8:03 PM, muthu raj  wrote:
>
>> By  declaring the function a static final f().
>> *Muthuraj R
>> IV th Year , ISE
>> PESIT , Bangalore*
>>
>>
>>
>> On Sun, Jul 31, 2011 at 7:28 AM, himanshu kansal <
>> himanshukansal...@gmail.com> wrote:
>>
>>> sry i thinki misspelled d ques
>>> d ques was
>>>
>>>
>>> how will you protect a derived class to override base class's member
>>> function in c++
>>>
>>> say if there is a function f() in base class then derived should not be
>>> able to
>>> override f() to provide its own definition.
>>> but The function must be accessible in derived class.
>>>
>>>
>>> PS:dont try to make the function private in base class( it will be
>>> become inaccessible in derived class).
>>>
>>> On Sun, Jul 31, 2011 at 7:49 PM, himanshu kansal <
>>> himanshukansal...@gmail.com> wrote:
>>>
 how will you protect a base class to override its member function in
 derived class

 say if there is a function f() in base class then derived cannot
 override f() to provide its own definition.
 The function must be accessible in derived class.

 PS:dont try to make the function private in base class( it will be
 become inaccessible in derived class).
>>>
>>>
>>>
>>>
>>> --
>>>
>>>   Regards
>>> Himanshu Kansal
>>>   Msc Comp. sc.
>>> (University of 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.
>>
>
>
>
> --
>
>   Regards
> Himanshu Kansal
>   Msc Comp. sc.
> (University of 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.



[algogeeks] Urgent : Info Required

2011-07-31 Thread Ravinder Kumar
NIT warangal guys plz tell the type of questions asked by the oracle
Apps . Reply ASAP bcz having interview in the morning.

-- 
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: Interview ques

2011-07-31 Thread himanshu kansal
i think there is no keyword known as final in c++.maybe u are talking
with respect to java

On Sun, Jul 31, 2011 at 8:03 PM, muthu raj  wrote:

> By  declaring the function a static final f().
> *Muthuraj R
> IV th Year , ISE
> PESIT , Bangalore*
>
>
>
> On Sun, Jul 31, 2011 at 7:28 AM, himanshu kansal <
> himanshukansal...@gmail.com> wrote:
>
>> sry i thinki misspelled d ques
>> d ques was
>>
>>
>> how will you protect a derived class to override base class's member
>> function in c++
>>
>> say if there is a function f() in base class then derived should not be
>> able to
>> override f() to provide its own definition.
>> but The function must be accessible in derived class.
>>
>>
>> PS:dont try to make the function private in base class( it will be
>> become inaccessible in derived class).
>>
>> On Sun, Jul 31, 2011 at 7:49 PM, himanshu kansal <
>> himanshukansal...@gmail.com> wrote:
>>
>>> how will you protect a base class to override its member function in
>>> derived class
>>>
>>> say if there is a function f() in base class then derived cannot
>>> override f() to provide its own definition.
>>> The function must be accessible in derived class.
>>>
>>> PS:dont try to make the function private in base class( it will be
>>> become inaccessible in derived class).
>>
>>
>>
>>
>> --
>>
>>   Regards
>> Himanshu Kansal
>>   Msc Comp. sc.
>> (University of 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.
>



-- 

  Regards
Himanshu Kansal
  Msc Comp. sc.
(University of 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.



Re: [algogeeks] Re: Interview ques

2011-07-31 Thread muthu raj
By  declaring the function a static final f().
*Muthuraj R
IV th Year , ISE
PESIT , Bangalore*



On Sun, Jul 31, 2011 at 7:28 AM, himanshu kansal <
himanshukansal...@gmail.com> wrote:

> sry i thinki misspelled d ques
> d ques was
>
>
> how will you protect a derived class to override base class's member
> function in c++
>
> say if there is a function f() in base class then derived should not be
> able to
> override f() to provide its own definition.
> but The function must be accessible in derived class.
>
>
> PS:dont try to make the function private in base class( it will be
> become inaccessible in derived class).
>
> On Sun, Jul 31, 2011 at 7:49 PM, himanshu kansal <
> himanshukansal...@gmail.com> wrote:
>
>> how will you protect a base class to override its member function in
>> derived class
>>
>> say if there is a function f() in base class then derived cannot
>> override f() to provide its own definition.
>> The function must be accessible in derived class.
>>
>> PS:dont try to make the function private in base class( it will be
>> become inaccessible in derived class).
>
>
>
>
> --
>
>   Regards
> Himanshu Kansal
>   Msc Comp. sc.
> (University of 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.



[algogeeks] Re: Interview ques

2011-07-31 Thread himanshu kansal
sry i thinki misspelled d ques
d ques was


how will you protect a derived class to override base class's member
function in c++

say if there is a function f() in base class then derived should not be able
to
override f() to provide its own definition.
but The function must be accessible in derived class.

PS:dont try to make the function private in base class( it will be
become inaccessible in derived class).

On Sun, Jul 31, 2011 at 7:49 PM, himanshu kansal <
himanshukansal...@gmail.com> wrote:

> how will you protect a base class to override its member function in
> derived class
>
> say if there is a function f() in base class then derived cannot
> override f() to provide its own definition.
> The function must be accessible in derived class.
>
> PS:dont try to make the function private in base class( it will be
> become inaccessible in derived class).




-- 

  Regards
Himanshu Kansal
  Msc Comp. sc.
(University of 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] Interview ques

2011-07-31 Thread himanshu kansal
how will you protect a base class to override its member function in
derived class

say if there is a function f() in base class then derived cannot
override f() to provide its own definition.
The function must be accessible in derived class.

PS:dont try to make the function private in base class( it will be
become inaccessible in derived class).

-- 
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] Pointer

2011-07-31 Thread rajeev bharshetty
@Nikhil : What do you want to convey ??

On Sun, Jul 31, 2011 at 7:32 PM, Nikhil Gupta wrote:

> http://ideone.com/YHxVe
>
> @Rajeev, check this.
>
>
> On Sun, Jul 31, 2011 at 7:28 PM, Nikhil Gupta 
> wrote:
>
>> Whats the logic behind
>> **a^=*b;*
>> **b^=*a;*
>> **a^=*b;*
>> ??
>>
>> On Sun, Jul 31, 2011 at 7:19 PM, rajeev bharshetty 
>> wrote:
>>
>>> *#include*
>>> *int main()*
>>> *{*
>>> *int i=10;*
>>> *int j=20;*
>>> *int *a,*b;*
>>> *a =&i;*
>>> *b=&j;*
>>> *printf("before""%d%d\n",*a,*b);*
>>> **a^=*b;*
>>> **b^=*a;*
>>> **a^=*b;*
>>> *printf("after""%d%d",*a,*b);*
>>> *return 0;*
>>> *}*
>>> *
>>> *
>>> *This swaps pointers  *
>>>
>>>  On Sun, Jul 31, 2011 at 7:15 PM, Nikhil Gupta <
>>> nikhilgupta2...@gmail.com> wrote:
>>>
  How to swap two pointers without using a temporary pointer ?

 --
 Nikhil Gupta
 Senior Co-ordinator, Publicity
 CSI, NSIT Students' Branch
 NSIT, New Delhi, India

  --
 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
>>> Rajeev N B 
>>>
>>> "*Winners Don't do Different things , they do things Differently"*
>>>
>>>  --
>>> 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.
>>>
>>
>>
>>
>> --
>> Nikhil Gupta
>> Senior Co-ordinator, Publicity
>> CSI, NSIT Students' Branch
>> NSIT, New Delhi, India
>>
>>
>
>
> --
> Nikhil Gupta
> Senior Co-ordinator, Publicity
> CSI, NSIT Students' Branch
> NSIT, New Delhi, India
>
>  --
> 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
Rajeev N B 

"*Winners Don't do Different things , they do things Differently"*

-- 
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] Convert number to negative base

2011-07-31 Thread saurabh singh
The c code as amol had suggested.

http://www.ideone.com/GP7O8

On Sun, Jul 31, 2011 at 6:55 PM, saurabh modi
wrote:

> you can read up the 
> http://en.wikipedia.org/wiki/Negative_base#Calculationpart on the wiki page
> http://en.wikipedia.org/wiki/Negative_base
>
> its explained quite effectively.
>
>  --
> 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] Pointer

2011-07-31 Thread Surya Prakash
suppose if we want to swap 3 and 5

*a=3
*b=5
then,
1st xoring  *a and *b and copying back to *a   *a=011
   *b=101


*a=110

2nd--> *b^=^a  ---> *b=101
*a=110
---
 *b=011 (i.e *a) .if we implement next step
both are swapped!

hope its clear!

-- 
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] Pointer

2011-07-31 Thread Nikhil Gupta
http://ideone.com/YHxVe

@Rajeev, check this.

On Sun, Jul 31, 2011 at 7:28 PM, Nikhil Gupta wrote:

> Whats the logic behind
> **a^=*b;*
> **b^=*a;*
> **a^=*b;*
> ??
>
> On Sun, Jul 31, 2011 at 7:19 PM, rajeev bharshetty 
> wrote:
>
>> *#include*
>> *int main()*
>> *{*
>> *int i=10;*
>> *int j=20;*
>> *int *a,*b;*
>> *a =&i;*
>> *b=&j;*
>> *printf("before""%d%d\n",*a,*b);*
>> **a^=*b;*
>> **b^=*a;*
>> **a^=*b;*
>> *printf("after""%d%d",*a,*b);*
>> *return 0;*
>> *}*
>> *
>> *
>> *This swaps pointers  *
>>
>>  On Sun, Jul 31, 2011 at 7:15 PM, Nikhil Gupta > > wrote:
>>
>>>  How to swap two pointers without using a temporary pointer ?
>>>
>>> --
>>> Nikhil Gupta
>>> Senior Co-ordinator, Publicity
>>> CSI, NSIT Students' Branch
>>> NSIT, New Delhi, India
>>>
>>>  --
>>> 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
>> Rajeev N B 
>>
>> "*Winners Don't do Different things , they do things Differently"*
>>
>>  --
>> 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.
>>
>
>
>
> --
> Nikhil Gupta
> Senior Co-ordinator, Publicity
> CSI, NSIT Students' Branch
> NSIT, New Delhi, India
>
>


-- 
Nikhil Gupta
Senior Co-ordinator, Publicity
CSI, NSIT Students' Branch
NSIT, New Delhi, India

-- 
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] Fwd: how 2 solve.........

2011-07-31 Thread prabhu J
-- Forwarded message --
From: Harish Ravichandran 
Date: Sun, Jul 31, 2011 at 4:23 PM
Subject: how 2 solve.
To: mitcse08i...@googlegroups.com, mit_cod...@googlegroups.com,
algogeeksforge...@googlegroups.com


In a chessboard the initial and final positions of Knight are given. Write a
program to find
the shortest number of knight moves required to reach the final position
from the given initial
position.

-- 
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] Pointer

2011-07-31 Thread Nikhil Gupta
Whats the logic behind
**a^=*b;*
**b^=*a;*
**a^=*b;*
??

On Sun, Jul 31, 2011 at 7:19 PM, rajeev bharshetty wrote:

> *#include*
> *int main()*
> *{*
> *int i=10;*
> *int j=20;*
> *int *a,*b;*
> *a =&i;*
> *b=&j;*
> *printf("before""%d%d\n",*a,*b);*
> **a^=*b;*
> **b^=*a;*
> **a^=*b;*
> *printf("after""%d%d",*a,*b);*
> *return 0;*
> *}*
> *
> *
> *This swaps pointers  *
>
>  On Sun, Jul 31, 2011 at 7:15 PM, Nikhil Gupta 
> wrote:
>
>>  How to swap two pointers without using a temporary pointer ?
>>
>> --
>> Nikhil Gupta
>> Senior Co-ordinator, Publicity
>> CSI, NSIT Students' Branch
>> NSIT, New Delhi, India
>>
>>  --
>> 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
> Rajeev N B 
>
> "*Winners Don't do Different things , they do things Differently"*
>
>  --
> 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.
>



-- 
Nikhil Gupta
Senior Co-ordinator, Publicity
CSI, NSIT Students' Branch
NSIT, New Delhi, India

-- 
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] Pointer

2011-07-31 Thread rajeev bharshetty
*#include*
*int main()*
*{*
*int i=10;*
*int j=20;*
*int *a,*b;*
*a =&i;*
*b=&j;*
*printf("before""%d%d\n",*a,*b);*
**a^=*b;*
**b^=*a;*
**a^=*b;*
*printf("after""%d%d",*a,*b);*
*return 0;*
*}*
*
*
*This swaps pointers  *

On Sun, Jul 31, 2011 at 7:15 PM, Nikhil Gupta wrote:

> How to swap two pointers without using a temporary pointer ?
>
> --
> Nikhil Gupta
> Senior Co-ordinator, Publicity
> CSI, NSIT Students' Branch
> NSIT, New Delhi, India
>
>  --
> 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
Rajeev N B 

"*Winners Don't do Different things , they do things Differently"*

-- 
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: Novell - Puzzle

2011-07-31 Thread vijay goswami
the answer is 144 she-calves..the qn asks for calves, not cows and
calves..in all there are 233 cows n calves where there are 144 calves n 89
cows

On Sun, Jul 31, 2011 at 2:02 PM, Shubham Maheshwari
wrote:

> for the cows ques ... you all are forgetting to add the orginal starting
> cow ...
> thus the answer should be *233*
>
> On Sun, Jul 31, 2011 at 1:30 PM, Nikhil Gupta 
> wrote:
>
>> Oops. My bad. Rabbits produce every month too.
>> I overlooked that.
>>
>> On Sun, Jul 31, 2011 at 1:24 PM, Tushar Bindal wrote:
>>
>>> Suppose that our rabbits never die and that the female always
>>> produces one new pair (one male, one female) *every month from the
>>> second month on
>>> *
>>> @Priyanka
>>> You have answer 288
>>> I added 178 to it because I got the answer that 89 females would have
>>> given birth in the last month.
>>> Pls clarify.
>>> Are you taking one month less or am I taking 1 more?
>>>
>>> --
>>> 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.
>>>
>>
>>
>>
>> --
>> Nikhil Gupta
>> Senior Co-ordinator, Publicity
>> CSI, NSIT Students' Branch
>> NSIT, New Delhi, India
>>
>>  --
>> 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] Pointer

2011-07-31 Thread pandharinath gorde
use xor ing for the same

On Sun, Jul 31, 2011 at 7:15 PM, Nikhil Gupta wrote:

> How to swap two pointers without using a temporary pointer ?
>
> --
> Nikhil Gupta
> Senior Co-ordinator, Publicity
> CSI, NSIT Students' Branch
> NSIT, New Delhi, India
>
>  --
> 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.
>



-- 
Pandharinath Gorde
+91-9620557641

-- 
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] Pointer

2011-07-31 Thread Nikhil Gupta
How to swap two pointers without using a temporary pointer ?

-- 
Nikhil Gupta
Senior Co-ordinator, Publicity
CSI, NSIT Students' Branch
NSIT, New Delhi, India

-- 
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 written round que

2011-07-31 Thread Ankit Minglani
yeah if it was a divisibility test then the question would have been too
trivial ..
the last digit after doing itoa will be the remainder .

On Sat, Jul 30, 2011 at 11:52 AM, nivedita arora <
vivaciousnived...@gmail.com> wrote:

> i think solution of ankit is right !
> sorry even i forgot tht que ws not divisibility test ..but to get
> quotient :-|
>
> On Jul 30, 10:03 pm, Ankur Khurana  wrote:
> > @roopam : i got the question all wrong. . .
> >
> > On Sat, Jul 30, 2011 at 10:01 PM, Roopam Poddar  >wrote:
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > > The objective is to divide the number by 3 and not just check for it's
> > > divisibility.
> > > Adding the digits using itoa() and then repeated subtraction will check
> for
> > > it's divisibility by 3 and not give us the quotient.
> > > To get that you will have to carry out repeated subtraction on the
> number
> > > anyway.
> > > So whats the point?
> >
> > > --
> > > 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/-/BWTzYtcBhIgJ.
> >
> > > To post to this group, send email to algogeeks@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > algogeeks+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/algogeeks?hl=en.
> >
> > --
> > Ankur Khurana
> > Computer Science
> > Netaji Subhas Institute Of Technology
> > 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.
>
>


-- 
The more you sweat in the field, the less you bleed in war."

Ankit Minglani
NITK Surathkal

-- 
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] Convert number to negative base

2011-07-31 Thread saurabh modi
you can read up the
http://en.wikipedia.org/wiki/Negative_base#Calculationpart on the wiki
page
http://en.wikipedia.org/wiki/Negative_base

its explained quite effectively.

-- 
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 help on bits?

2011-07-31 Thread Amol Sharma
yupxor would do the required task eaisly !!
--


Amol Sharma
Third Year Student
Computer Science and Engineering
MNNIT Allahabad




On Sun, Jul 31, 2011 at 6:42 PM, Nikhil Gupta wrote:

> @Surya, ^ operator mean XOR operation.
>
>
> On Sun, Jul 31, 2011 at 6:41 PM, Surya Prakash 
> wrote:
>
>> we can just apply xor operation rightit's more easier!!
>>
>> --
>> 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.
>>
>
>
>
> --
> Nikhil Gupta
> Senior Co-ordinator, Publicity
> CSI, NSIT Students' Branch
> NSIT, New Delhi, India
>
>
>  --
> 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] Odd one out

2011-07-31 Thread *$*
Q1->Construct a binary tree , in such a way that if element occured for the
first time , insert into tree , if occurs at second time , remove from the
list.
As all elements except the one need to find are even , at the end of the
list , all the tree will contain only one element.

Q2-> Construct a binary tree. similar to the above.
Now again start from first element and check which element is missing in the
tree. That is the required one.


Thx,
--Gopi

On Sun, Jul 31, 2011 at 2:07 PM, Abhishek Gupta wrote:

> Q1-> A large size array is given. All except one element are repeated even
> no. of times and one element is repeated odd no. of times. Find that
> element. Don't use X-OR
>
> Ans -> Is there any efficient way of finding it without using sorting or
> removing duplicates or using hash tables??
>
>
>
> Q2-> Same qn is like all except one are repeated off no. of times and one
> element repeated even no. of times. find that element. (no specification for
> X-OR use given)
>
> Ans-> Again, I tried it using hash table.
>
>
> --
> Abhishek Gupta
> MCA
> NIT Calicut
> Kerela
>
>  --
> 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.
>



-- 
Thx,
--Gopi

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

2011-07-31 Thread aditi garg
This is anothr prog that i ran...
http://ideone.com/Kw9xl

On Sun, Jul 31, 2011 at 6:43 PM, aditi garg wrote:

> http://ideone.com/9Txzo
> U cannot use %d when trying to print address \dey dont fall in range...and
> iu have modified it...u can chk the output..
> i think ull be able to interpret the results...lemme knw if u have any
> doubt...
>
>
> On Sun, Jul 31, 2011 at 3:18 PM, Shubham Maheshwari  > wrote:
>
>> http://ideone.com/IZKyN
>>
>> could you plzz explain this to me ...!!
>> anyone ...
>>
>> On Sun, Jul 31, 2011 at 1:56 AM, Kamakshii Aggarwal <
>> kamakshi...@gmail.com> wrote:
>>
>>> @sanchit:no,not at all :)
>>>
>>>
>>> On Sun, Jul 31, 2011 at 1:55 AM, Sanchit Manchanda >> > wrote:
>>>
 @kamakshi- sorry if you felt i was rude. :-\


 On Sun, Jul 31, 2011 at 1:53 AM, aditi garg 
 wrote:

> some garbage value
>
>
> On Sun, Jul 31, 2011 at 1:51 AM, gaurav gupta 
> wrote:
>
>> then wat sud b the value of *(&a+1) since array is only defind for 5
>> elements
>>
>>
>> On Sun, Jul 31, 2011 at 1:48 AM, Sanchit Manchanda <
>> sanchit...@gmail.com> wrote:
>>
>>> yes it will print the next address in memory after the last element.
>>>
>>>
>>> On Sun, Jul 31, 2011 at 1:46 AM, gaurav gupta >> > wrote:
>>>
 i understand much. thanx fr it. plz tell me if i hv to print &a+1
 then it sud print the next address after the last element


 On Sun, Jul 31, 2011 at 1:40 AM, Sanchit Manchanda <
 sanchit...@gmail.com> wrote:

> @gaurav- &a takes you to the address 1st element of the array.
> &a+1 takes you to the next address after the last element. this
> mean if int is 4bits. then arrays of 5 int values is 20 bits. so *+1
> *in &a+1 covers 20 bits in memory. similarly &a+2 covers next 20
> bits. and so on.
>
> where as &(*(a+1)) points to 1st element,&(*(a+2)) points to 2nd
> element and so on.
>
> i hope this helps
>
>
> On Sun, Jul 31, 2011 at 1:35 AM, gaurav gupta <
> grvgupta...@gmail.com> wrote:
>
>> so u mean der is difference between a and a[0]
>>
>>
>> On Sun, Jul 31, 2011 at 1:30 AM, Kamakshii Aggarwal <
>> kamakshi...@gmail.com> wrote:
>>
>>> &a points to the array.so when u increment it by 1 it will get
>>> incremented by the size of array.
>>>
>>>
>>> On Sun, Jul 31, 2011 at 1:28 AM, gaurav gupta <
>>> grvgupta...@gmail.com> wrote:
>>>
 &a+1 takes to the last element of the array bt is the logic
 behind dis


 On Sun, Jul 31, 2011 at 1:25 AM, Kamakshii Aggarwal <
 kamakshi...@gmail.com> wrote:

> &a+1 will point to the next array(i.e it will skip the whole
> array)
> where as &(a+1)will print address of element 2.
>
> On Sun, Jul 31, 2011 at 1:21 AM, Sanchit Manchanda <
> sanchit...@gmail.com> wrote:
>
>> Sorry my bad. I was wrong.
>>
>> On Sun, Jul 31, 2011 at 1:15 AM, gaurav gupta <
>> grvgupta...@gmail.com> wrote:
>>
>>> main()
>>> {
>>> int a[5]={1,2,3,4,5};
>>> printf("%d%d",&a+1,&(a+1));
>>> }
>>> plz explain me the difference in ans.
>>> thanx..
>>>
>>> --
>>> 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 Manchanda
>> COE(3rd year) , NSIT
>> http://iblogmythots.wordpress.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.
>>
>
>
>
> --
> Regards,
> Kamakshi
> kamakshi...@gmail.com
>
>  --
> You recei

Re: [algogeeks] Any help on bits?

2011-07-31 Thread Nikhil Gupta
@Surya, ^ operator mean XOR operation.

On Sun, Jul 31, 2011 at 6:41 PM, Surya Prakash wrote:

> we can just apply xor operation rightit's more easier!!
>
> --
> 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.
>



-- 
Nikhil Gupta
Senior Co-ordinator, Publicity
CSI, NSIT Students' Branch
NSIT, New Delhi, India

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

2011-07-31 Thread aditi garg
http://ideone.com/9Txzo
U cannot use %d when trying to print address \dey dont fall in range...and
iu have modified it...u can chk the output..
i think ull be able to interpret the results...lemme knw if u have any
doubt...

On Sun, Jul 31, 2011 at 3:18 PM, Shubham Maheshwari
wrote:

> http://ideone.com/IZKyN
>
> could you plzz explain this to me ...!!
> anyone ...
>
> On Sun, Jul 31, 2011 at 1:56 AM, Kamakshii Aggarwal  > wrote:
>
>> @sanchit:no,not at all :)
>>
>>
>> On Sun, Jul 31, 2011 at 1:55 AM, Sanchit Manchanda 
>> wrote:
>>
>>> @kamakshi- sorry if you felt i was rude. :-\
>>>
>>>
>>> On Sun, Jul 31, 2011 at 1:53 AM, aditi garg 
>>> wrote:
>>>
 some garbage value


 On Sun, Jul 31, 2011 at 1:51 AM, gaurav gupta wrote:

> then wat sud b the value of *(&a+1) since array is only defind for 5
> elements
>
>
> On Sun, Jul 31, 2011 at 1:48 AM, Sanchit Manchanda <
> sanchit...@gmail.com> wrote:
>
>> yes it will print the next address in memory after the last element.
>>
>>
>> On Sun, Jul 31, 2011 at 1:46 AM, gaurav gupta 
>> wrote:
>>
>>> i understand much. thanx fr it. plz tell me if i hv to print &a+1
>>> then it sud print the next address after the last element
>>>
>>>
>>> On Sun, Jul 31, 2011 at 1:40 AM, Sanchit Manchanda <
>>> sanchit...@gmail.com> wrote:
>>>
 @gaurav- &a takes you to the address 1st element of the array.
 &a+1 takes you to the next address after the last element. this mean
 if int is 4bits. then arrays of 5 int values is 20 bits. so *+1 *in
 &a+1 covers 20 bits in memory. similarly &a+2 covers next 20 bits. and 
 so
 on.

 where as &(*(a+1)) points to 1st element,&(*(a+2)) points to 2nd
 element and so on.

 i hope this helps


 On Sun, Jul 31, 2011 at 1:35 AM, gaurav gupta <
 grvgupta...@gmail.com> wrote:

> so u mean der is difference between a and a[0]
>
>
> On Sun, Jul 31, 2011 at 1:30 AM, Kamakshii Aggarwal <
> kamakshi...@gmail.com> wrote:
>
>> &a points to the array.so when u increment it by 1 it will get
>> incremented by the size of array.
>>
>>
>> On Sun, Jul 31, 2011 at 1:28 AM, gaurav gupta <
>> grvgupta...@gmail.com> wrote:
>>
>>> &a+1 takes to the last element of the array bt is the logic
>>> behind dis
>>>
>>>
>>> On Sun, Jul 31, 2011 at 1:25 AM, Kamakshii Aggarwal <
>>> kamakshi...@gmail.com> wrote:
>>>
 &a+1 will point to the next array(i.e it will skip the whole
 array)
 where as &(a+1)will print address of element 2.

 On Sun, Jul 31, 2011 at 1:21 AM, Sanchit Manchanda <
 sanchit...@gmail.com> wrote:

> Sorry my bad. I was wrong.
>
> On Sun, Jul 31, 2011 at 1:15 AM, gaurav gupta <
> grvgupta...@gmail.com> wrote:
>
>> main()
>> {
>> int a[5]={1,2,3,4,5};
>> printf("%d%d",&a+1,&(a+1));
>> }
>> plz explain me the difference in ans.
>> thanx..
>>
>> --
>> 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 Manchanda
> COE(3rd year) , NSIT
> http://iblogmythots.wordpress.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.
>



 --
 Regards,
 Kamakshi
 kamakshi...@gmail.com

  --
 You received this message because you are subscribed to the
 Google Groups "Algorithm Geeks" group.
 To post to this group, send email to algogeeks@googlegroups.com
 .
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@

Re: [algogeeks] Any help on bits?

2011-07-31 Thread Surya Prakash
we can just apply xor operation rightit's more easier!!

-- 
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] Convert number to negative base

2011-07-31 Thread saurabh singh
I had put comments for the  same...The code coming as soon as I reaches
my laptop.
Do the same as u will do for converting for binary...except divide by -2
each time and donr let the remainder become -ve at any time take the higher
integer,

On Sun, Jul 31, 2011 at 6:13 PM, Amol Sharma  wrote:

> @saurabhsingh ---  i don't understand python at the moment..can u code
> the same in c/c++
> it would be very kind of you if you do it. or at least explain how are
> you proceeding...
> --
>
>
> Amol Sharma
> Third Year Student
> Computer Science and Engineering
> MNNIT Allahabad
>
>
>
>
> On Sun, Jul 31, 2011 at 3:20 PM, saurabh modi  > wrote:
>
>> yeah,only some compilers support it.
>>
>>  --
>> 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.
>



-- 
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] Any help on bits?

2011-07-31 Thread Amol Sharma
compare bits of the number one by one and and count how many are different
print the count..
correct if i am wrong !!
--


Amol Sharma
Third Year Student
Computer Science and Engineering
MNNIT Allahabad




On Sun, Jul 31, 2011 at 6:29 PM, Surya Prakash wrote:

> can any one please explain me the question clearly with an examplei'm
> not geting it!
>  thanx 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] Any help on bits?

2011-07-31 Thread Surya Prakash
can any one please explain me the question clearly with an examplei'm
not geting it!
 thanx 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] pointers

2011-07-31 Thread aditi garg
http://ootips.org/yonat/4dev/smart-pointers.html
Dis cud be helpful fr smart pointers

On Sun, Jul 31, 2011 at 3:06 PM, Puneet Gautam wrote:

> What are smart pointers and what is the concept of pointer to void..?
>
> --
> 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.
>
>


-- 
Aditi Garg
Undergraduate Student
Electronics & Communication Divison
NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
Sector 3, Dwarka
New 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.



Re: [algogeeks] Bugs in a program

2011-07-31 Thread rajeev bharshetty
http://www.softwaretestinghelp.com/priority-and-severity/


On Sun, Jul 31, 2011 at 3:02 PM, Puneet Gautam wrote:

> What is meant by 'priority' and  'severity' of a bug..?
>
> --
> 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
Rajeev N B 

"*Winners Don't do Different things , they do things Differently"*

-- 
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 help on bits?

2011-07-31 Thread Abhishek Gupta
int BitSwap(int A,int B)
{
   int num=A^B;
   int count=0;
   while(num!=0)
   {
num=num&(num-1);
count++;
}
return count;
}


this will run in O(m) where m is no. of ON bits (1's).
is there any other optimal solution for finding no. of 1's in a number?


On Sun, Jul 31, 2011 at 5:57 PM, prateek gupta wrote:

> C= A^B then count number of bits set in C.
>
>
> On Sun, Jul 31, 2011 at 5:52 PM, Nikhil Gupta 
> wrote:
>
>> Given two integers A & B. Determine how many bits required to convert A to
>> B. Write a function int BitSwapReqd(int A, int B);
>>
>> --
>> Nikhil Gupta
>>
>> --
>> 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.
>>
>
>
>
> --
> Prateek Gupta
> 7th sem, Information Technology,
> Netaji Subhas Institute Of Technology
> 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.
>



-- 
Abhishek Gupta
MCA
NIT Calicut
Kerela

-- 
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   >