Radix uses the count sort..that is why its running time O(n).
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to
If it isn't passed by reference it goes to an infinite recursion.
On Wed, Jul 21, 2010 at 12:08 AM, mallesh mallesh...@gmail.com wrote:
In C++ Why is it that copy constructor uses only reference as
parameter and not the actual class?
I was given a hint that it has got something to do with
1) Can a constructor call another constructor to initialize the same
object?
2) Can a struct variable be assigned to another if the structure
contains an array as a field?
3) Can we pass a private member by reference to a non member function?
4) Can the destructor be called explicitly?
5) Can copy
@ritesh..you dnt have to output v.. you have to output the minimum number of
flips so that your tree evaluates to v(v is either 0 or 1)
and if it alreday evaluates to v then return 0(no flips required)
if not possible return -1
On Wed, Aug 4, 2010 at 12:11 AM, RITESH SRIVASTAV
(3*4096+15*256+3*16+3). How many 1's are there in the binary
representation of the result.
Is there a quick way to count the number of set bits in this number
manually???
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group,
either count it with a for loop or if you are using C, use
__builtin_popcount(int x)
or
x is given
int count = 0;
for(int i=0; i32;i++) count += (x (1i)) != 0;
On Tue, Aug 3, 2010 at 12:04 PM, amit amitjaspal...@gmail.com wrote:
(3*4096+15*256+3*16+3). How many 1's are there in the binary
The straightforward way is simply to write the number out in binary
and count the one-bits. It works for any number.
In this specific case, since the multiplications are by powers of 2,
resulting in shifts, and the resulting binary numbers don't overlap,
the number of bits is
bitcount(3*4096) +
See http://en.wikipedia.org/wiki/Binary_search_tree#Insertion
Dave
On Aug 4, 9:56 am, UMESH KUMAR kumar.umesh...@gmail.com wrote:
On Tue, Aug 3, 2010 at 11:22 PM, Anand anandut2...@gmail.com wrote:
While creating BST we follow the rule that element on the left hand side of
the root should
1) A constructor can call another constructor but not for the same
object if we are talking just the precise meaning
of object and not considering the raw storage as Objects.
4) Destructor can be called explicitly .This is generally used when u
have used your own new operator so that
Can a struct variable be assigned to another if the structure
contains an array as a field? You can. But it will be like a shallow copy.
if the structure has a pointer variables those memory need to be assigned
explicitly.
3) Can we pass a private member by reference to a non member function?
No
As per the problem it seems to be that there is one root node (CEO) and all
employees are child node. B'cos iin the question it is mentioned that each
employee is led by only 1 person except for the CEO (who has no boss).
Correct me if I am wrong.
On Wed, Aug 4, 2010 at 4:32 PM, Gene
it is
3*2^12 + 15*2^8 + 3*2^4 + 3
so it becomes
312 + 158 + 34 +3.. let this equal to n
take a int count=0;
while(n){
n=n(n-1);
count++;
}
return count;
2010/8/4 Seçkin Can Şahin seckincansa...@gmail.com
either count it with a for loop or if you are using C, use
Both are unary operators and hence the associativity is from right to left.
On Wed, Aug 4, 2010 at 8:31 AM, UMESH KUMAR kumar.umesh...@gmail.comwrote:
How to decide associativity of the operation on operand
so a simple Ex:-
*ptr++ and ++*ptr
how to work both ?
--
it is
3*2^12 + 15*2^8 + 3*2^4 + 3
so it becomes
312 + 158 + 34 +3.. let this equal to n
take
while(n){
2010/8/4 Seçkin Can Şahin seckincansa...@gmail.com
either count it with a for loop or if you are using C, use
__builtin_popcount(int x)
or
x is given
int count = 0;
for(int i=0;
Hi Amit,
If you are answer this question orally then the format you have given is
just a hexadecimal number. Its value would be 0x3f33. So the number of
1's would be simply 2+4+2+2 = 10.
Programatically whatever solution Sahin has given seems to be good enough.
2010/8/4 Seçkin Can Şahin
Can someone tell me why the order of initialization in the
initialization list of constructor, the order of declaration of data
members in C++ ?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
1) Yes ofcourse
2) yes you can
3) yes ofcourse
4) yes
5) i dont think . May we our default constructor def not matching ;)
On Aug 3, 8:42 pm, Raj N rajn...@gmail.com wrote:
1) Can a constructor call another constructor to initialize the same
object?
2) Can a struct variable be assigned to
void dyckWords(int index, int open, int close)
{
static int dyck=0;
if (index == 2 *n)
{
printf(%s\n, out);
return ;
}
out[index] = '('; //or A
if ((open + 1) = n open = close)
{
dyckWords(index + 1, open + 1, close);
}
out[level] = ')';//or B
if ((close + 1) = n
void dyckWords(int index, int open, int close)
{
static int dyck=0;
if (index == 2 *n)
{
printf(%s\n, out);
return ;
}
out[index] = '('; //or A
if ((open + 1) = n open = close)
{
dyckWords(index + 1, open + 1, close);
}
out[index] = ')';//or B
19 matches
Mail list logo