wht is the space occupied by a class in c++ whn it contains a virtual
fn.
How are the virtual fn implemented internally by c++...
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
*there is vtable known as virtual table which contains addresses of virtual
functions .
And there is vptr a pointer that points to vtable of that class space
occupied by class having virtual function wil be equal to space occupied by
a pointer * number of virtual functions ..
I think this if there
its lee.
BTW no offense intended but what has this to do with algorithms ?
On Thu, Mar 17, 2011 at 1:58 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote:
*Problem Solution*
*
*Lee's parents have five children, the names of the first four are La, Le,
Li, and Lo.
What's the name of the fifth
For big number mathematics, the multiplication time complexity is not
O(1).
And the programming complexity is to be considered as well.
On Mar 24, 3:36 pm, radha krishnan radhakrishnance...@gmail.com
wrote:
You can do it in (log n) assuming multiplication is O(1)
suppose u are going to
reducing more complexity of the tree is not binary, it will be like below
instead of node containning the name
it will have a (character,count , is_last_char_of_string)
the complexity for searching the word is present or not is length_of_word
now we can create tree like this words (
I think I find the max and then print max + 1 is not a correct strategy
because overflow can occur or find the min and print min-1 underflow can
occur.
If you use a bitset, you can store all the values that appear in 10Mb. I
believe that these integers are in the file are integers that are
Hi,
almost after 1 year, i am sending mail to algogeeks. [?]
this mail is to make code in mail just readable.
instead of putting simple code
#includeiostream
using namespace std;
int main(){
printf(hello world);
}
you can use http://tohtml.com/ or many other tools are there. to higlight
please check this also
Selection_algorithm http://en.wikipedia.org/wiki/Selection_algorithm
On Tue, Mar 22, 2011 at 10:13 AM, Rajeev Kumar rajeevprasa...@gmail.comwrote:
http://flexaired.blogspot.com/2011/03/big-file-containing-billions-of-numbers.html
On Mon, Mar 21, 2011 at 4:05 AM,
re.findall(r'a([^a]*)a','000aaaaa')
On Mar 24, 3:40 pm, DD dutta.dipanka...@gmail.com wrote:
re.findall(r'a(.*)a','000aaaaa') return
['aaa']
what is the regular expression such that it should return
['','','','']
?
--
You
++
On Tue, Mar 22, 2011 at 9:39 PM, Saravanan T mail2sarava...@gmail.comwrote:
++
On Tue, Mar 22, 2011 at 9:51 PM, Anurag atri anu.anurag@gmail.comwrote:
and me too :)
On Tue, Mar 22, 2011 at 9:28 PM, Nikhil Mishra mishra00...@gmail.comwrote:
count me too
On Tue, Mar 22, 2011
i think it is 10^7, may be more
once i submitted the program array having size 10^7 , to calculate the
primes between 1-10^8
On 15-10-2010 22:03, nishaanth wrote:
10^5
On Wed, Oct 13, 2010 at 4:47 AM, ANUJ KUMAR kumar.anuj...@gmail.com
mailto:kumar.anuj...@gmail.com wrote:
what is
I don't think soft copy is available.If anyone has please share it.
On Tue, Mar 22, 2011 at 10:09 PM, Saravanan T mail2sarava...@gmail.comwrote:
++
On Tue, Mar 22, 2011 at 9:51 PM, Anurag atri anu.anurag@gmail.comwrote:
and me too :)
On Tue, Mar 22, 2011 at 9:28 PM, Nikhil Mishra
maintain a min heap of k size
On Wed, Mar 16, 2011 at 10:31 AM, Ankit Sinha akki12...@gmail.com wrote:
Asked in Amazon interview..
Find the first K smallest element from 1 million sized array . Assume
your ram memory is so small that it cannot accommodate all 1 Million
element at once.
The function returns the id Celebrity Celebrity
Celebrities int (S group of people) {
If | S | = 1 then {
Let x in S
return x
else{
Choose x, y in S
If x follows y then {S = S - {s} x = x}
Else if x follows y then{ S = S - {y}, s = y;}
Else ERROR (no
2) Design a DS that would do Push(),Pop(), and GetMax() elements at
complexity O(1)
Are you sure you remember this correctly? This would give you a way of
sorting in O(1).
Thanks..
On Thu, Mar 24, 2011 at 12:09 AM, balaji a peshwa.bal...@gmail.com wrote:
The main thing they are testing is
Why is unlock O(log(n)) - Shouldn't it be just O(1) ?
templateint N
struct Node
{
bool isLocked_;
Node *parent_;
Node *children_[N];
};
bool isLocked(NodeN *node)
{
return
@Manikanta: What compiler do you use?
$ gcc test.c
test.c:2: error: initializer element is not constant
$ g++ test.c
$ ./a.out
Hello
$ gcc --version
gcc (GCC) 4.1.1
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the
#include stdio.h
#include string.h
//1Gb = 4294967296 bytes available
char number[132];
int main(){
unsigned int x,i;
memset(number,0, sizeof(number));
while( scanf(%ud,x) 0){
number[x]=1;
}
for(i=0;;i++)
if(number[i]==0) break;
printf(%d\n,i);
}
You have to create a graph in most efficient way from relationship of
nodes read from txt file.
text file contains information like:
node_id weight node_id
node_id weight node_id
…..
// which means two nodes are connected with some weight. (undirected)
There are around 600K such information for
In this problem, sum can be as large as 5*10^9.
Try breaking the whole interval into several stages (no more than 2*N),
each with a fixed amount of tasks.
Then in each stage, the schedule is a simple loop: A B C D E A B C D E A
B ...
Process each stage in O(1) time, then the total time
Actually, you probably mean that GetMax() does not remove it from the DS?
Sorry for the hasty conclusion.
On Thu, Mar 24, 2011 at 12:11 AM, MK stardust...@gmail.com wrote:
2) Design a DS that would do Push(),Pop(), and GetMax() elements at
complexity O(1)
Are you sure you remember this
4 * 4 - 7 = 9
Start both sandglasses at the same time. When the 4-minute sandglass is
over, flip it to restart timing. Repeat this 3 times.
From the moment when the 7-minute sandglass is over, to the moment when
the 4-minute sandglass is over for the 4th time, is an interval of 9
minutes.
On
Try precomputing the results for all possible a using mathematical
method, which should be O(N) (N=10^6) in total.
Then answer each query in O(1) (there can be 10 queries).
On Mar 26, 12:20 pm, saurabh singh saurab...@gmail.com wrote:
I am very sorry but i dont think i got your point.You
you can use mean heap like this
you can take all the first element of array construct mean heap
now delete the root element(let A) add it in sorted element
take the next element from the array which A was belonging to add it in
the heap heappify it again
repeat the process till you find
@ligerdave:whai if m*kn.
in this case some questions have to be repeated.
On Thu, Mar 24, 2011 at 7:10 PM, ligerdave david.c...@gmail.com wrote:
let's make this clear.
you have a total of N questions for K students, and each student gets
M questions, where M1+ M2 + M3 ++ Mn = N; Mx union
Dear Shashank,
What you are trying to do is called Goldbach's conjecture . Google for
it. There is a million dollar prize to prove it.
Ashim
On Thu, Mar 24, 2011 at 8:03 PM, ligerdave david.c...@gmail.com wrote:
I have to say: to prove the correctness of this hypotheses is a
wrong question
Perl does magic! :)
Cheers,
venki http://twitter.com/#!/venki_gbvr
VENKATARAMAN GB http://www.facebook.com/venki.gbvr
If Its Upto Be, It Is Upto Me
On Wed, Mar 16, 2011 at 10:18 AM, pacific pacific pacific4...@gmail.comwrote:
I vote for python.
On Wed, Mar 16, 2011
If you have a 1Gb = 4294967296 bytes of available memory, you can use an
array to mark if a number is on file or not.
Wladimir Araujo Tavares
*Federal University of Ceará
*
On Wed, Mar 16, 2011 at 6:18 PM, bittu shashank7andr...@gmail.com wrote:
Given an input file with four billion
http://en.wikipedia.org/wiki/Goldbach%27s_conjecture
mathematical proof on this wiki
!
On 3/24/11, bittu shashank7andr...@gmail.com wrote:
yesterday one of the my friends asked this Q to me prove with
correctness that
Every even integer greater than 2 can be expressed as the sum of two
yeah it wont remove the element...GetMax() only returns the maximum element
added so far..
On Thu, Mar 24, 2011 at 9:42 AM, MK stardust...@gmail.com wrote:
Actually, you probably mean that GetMax() does not remove it from the DS?
Sorry for the hasty conclusion.
On Thu, Mar 24, 2011 at
maintain a pointer to the max element so far in every element of the
stack..
while push - if the new element is greater than the stack-top-max then add
the new element at the top and hence make the max pointer of the new element
point to itself, otherwise the new element is less than the max till
Yes...Kunal is right !!!
It doesn't matter whether getMax() removes element or not, because MAX value
is maintained in each node of stack which is pointing to the maximum of the
value present below or up to that element...
So if stack is
5 3 2 8 6
Then nodes would have following structure
5
xxx, yyy are considered as cases?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more
yeah the solution looks good :-)
On Sat, Mar 26, 2011 at 4:06 PM, kunal srivastav kunal.shrivas...@gmail.com
wrote:
maintain a pointer to the max element so far in every element of the
stack..
while push - if the new element is greater than the stack-top-max then
add the new element at the
None of the statements except those inside the 'case' executesaccording
to the input, the default case gets executed which is the inner switch which
prints nine..
On Wed, Mar 23, 2011 at 8:46 PM, cegprakash cegprak...@gmail.com wrote:
i=9;
switch(i){
xxx:
Hey,
All constraints have been added or replied in comments by the admin.
On Sat, Mar 26, 2011 at 2:24 PM, utkarsh lath utkarsh.l...@gmail.comwrote:
You guys do not provide limits for the problems ?
Is it that you just want a correct algorithm, however bad it runs in
practice ?
On Sat, Mar
Hey,
You need to login first on the site to see the problems
This is the main link of the contest page
http://algorithmguru.com/content/index.php?viewpage=./contentfiles/challenge.php
If still you are not able to find the problem, just email me i ll ask the
admin of the contest to check or mail
Bharath can u tell me how u came with the combine function ??? I can't
understand the logic behind it ... do reply
On Wed, Mar 16, 2011 at 10:24 PM, Bharath 2009503507 CSE
bharathgo...@gmail.com wrote:
i am new to segment trees..i tried this problem in spoj..
@Patidarachat: Please explain how to use the selection algorithm in
the presence of the restriction that you can't hold all of the data in
memory at once.
Dave
On Mar 22, 3:55 am, patidarc...@gmail.com patidarc...@gmail.com
wrote:
please check this also
Selection_algorithm
Hi
Puzzle Digest Of The Week 21-25th March
*http://dailybrainteaser.blogspot.com/2011/03/25march.html?lavesh*
*
*
*http://dailybrainteaser.blogspot.com/2011/03/24march.html?lavesh*
*
*
*http://dailybrainteaser.blogspot.com/2011/03/23march.html?lavesh*
*
*
is there any use with labels xxx, yyy.. ?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
int n;
scanf(%d,n);
int a[n];
in turbo c it this code will give an error but gcc will not.why???
--
Rupendra Bakoliya
III year.
Computer Engineering Department
MNIT,jaipur.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this
Hi,
Is there a way to check that if a language is Turing complete?
Thanks.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
Hi,
We would like to invite you all to participate in ITRIX OPC 11(An
Individual Contest ), a 2-hour acm-icpc style online programming
competition, which is organized as a part of ITRIX 2011 , the
Technical fest of DIST ,College Of Engineering Guindy India.
Start time : Sunday ,27th March 2011,8
If it can simulate a universal turing machine then it is turing complete
On 26 March 2011 22:34, Karthik Jayaprakash howtechstuffwo...@gmail.comwrote:
Hi,
Is there a way to check that if a language is Turing complete?
Thanks.
--
You received this message because you are subscribed to
i already mentioned the link where i got this approach..
//from spoj forum
I have tried this problem with the following approach:-
1. any expression can be expressed as ))...)+a_correct_expression+((...(
2.at each node i am storing 1.no_of ')' at start and 2.no_of '(' at end of
expression that
The array allocation in c should be done at compile time.since its defined
in c gcc rightly gives an error.
I am not sure why turbo c does not gives an error but you need not worry
about it,its how it might be implemented.Compilers are free to implement the
language in the way they want.
--
When you want to use the *infinitely abusable goto statement then you need
those labels*
On Sat, Mar 26, 2011 at 8:57 PM, Prakash D IT @ CEG cegprak...@gmail.comwrote:
is there any use with labels xxx, yyy.. ?
--
You received this message because you are subscribed to the Google Groups
*@ Saurabh Singh gcc doesn't give it as error but turbo gives it as error
...
As per ANSI C there is no error becoz n is already known before use...
*
On Sun, Mar 27, 2011 at 8:44 AM, saurabh singh saurab...@gmail.com wrote:
The array allocation in c should be done at compile time.since its
Thanks for correcting.Dont know what i was thinking.:(
On Sun, Mar 27, 2011 at 8:53 AM, D.N.Vishwakarma@IITR deok...@gmail.comwrote:
*@ Saurabh Singh gcc doesn't give it as error but turbo gives it as error
...
As per ANSI C there is no error becoz n is already known before use...
*
On
50 matches
Mail list logo