Re: [algogeeks] Re: virtual functions output

2011-08-02 Thread Deepthi Srinivasan
not sure about cpp, but in Java it is so... Every derived class constructor's first line automatically has a call to super()... Aug 2, 2011 at 2:05 PM, siva viknesh sivavikne...@gmail.com wrote: how it ll simply call the base class constructor ??? As far as i know . if we give

Re: [algogeeks] HOW GARBAGE COLLECTOR WORKS IN JAVA

2011-07-31 Thread Deepthi Srinivasan
Garbage collection is totally JVM dependent... Some JVMs may use a mark and sweep algorithm. The first thing u should understand abt Java's garbage collection is totally unpredicatble. You cant really predict when garbage collection is done. If and when the JVM decides that garbage coll should be

Re: [algogeeks] MS ques

2011-07-20 Thread Deepthi Srinivasan
@Vicky Piyush's algo is based on a little trick to determine divisibility by 3. Number of bits set in odd position - Number of bits set in even position 'll be divisible by 3 For example, take 9. 1001. No. of bits set in odd position - number of bits set in even position is 0. Hence divisible by

Re: [algogeeks] Re: c++ smart pointers

2011-07-19 Thread Deepthi Srinivasan
Implementation of smart pointer: template class T class *auto_ptr* { T* ptr;public: explicit *auto_ptr*(T* p = 0) : ptr(p) {} *~auto_ptr*() {delete ptr;} T *operator**() {return *ptr;} T* *operator-*() {return ptr;} // ...}; Its