Is Non-hamiltonian cycle problem not in NP ?
Since to verify it, we need to go through all possible paths which make it
exponential in nature.
Please support your claim with credible links. I found over web that at lot
of places it is written The Non-hamiltonian cycle problem is not known to
be
1. public static void main(String[] args) {
2. HashMapString,String hashTable =new HashMapString,String();
3. hashTable.put(one,one);
4. hashTable.put(two,one);
5. }
I put break points on line 3 and 4. When i launch my above code in
debugging mode
@prankur
can we do in this manner, first find the middle of the array and make it as
a root, and call recursively from 0 to mid-1 for left subtree and mid+1 to
len-1 for right subtree..?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post
Ques - *
struct node
{
int parentValue;
int childValue;
}str[10];
how to construct a BT,given an array of structure containing parent and
child value.
*
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
Hi,
You can view this problem as
parentValue - actual value of parent
childValue - number of childs associated with it(which can be zero or 1)
so, (8,2) (4,1) (10,2) (2,0) (9,0) (12,0) is the BST.
Thanks.
On Wed, Oct 31, 2012 at 10:01 AM, Arun Kindra
reserve4placem...@gmail.comwrote:
Ques -
Hi,
I need some suggestion in solving one problem.
*Statement:* There is a input stream of characters. This will flow for
infinite time. Now, the task is to store most recent K mb data in a text
file at any time T.
*Constraint*: you can not use buffer of size K mb directly because of
memory
Find the number of fractions a/b such that-
1. *gcd(a, b) = 1*
2. *0 a/b 1*
3. *a * b = (n!) ^ (n!)*
Where *n!* denotes the factorial of n and ^ denotes power, *i.e. (2!) ^
(2!) = 4*.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post
yups...it is compiler dependent...but a logic is necessary to get 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
Hai i tried the same in TC compiler. i got the output as 17. I guess the
output should be 17 as explained by Prateek Jain
On 30 May 2012 02:26, rahul ranjan rahul.ranjan...@gmail.com wrote:
it first calculates from right to left and then performs addition
so after a++ its still 4(with
okk
--
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
Hey answer will be 18 as follows. First ++a(5)+ ++a(6) + a++(6)=17 + one
post increment= 18.
On Thu, May 31, 2012 at 3:13 AM, Prateek Jain prateek10011...@gmail.comwrote:
okk
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to
#includestdio.h
int main()
{
int a=4;
printf(%d\n,++a + ++a + a++);
return 0;
}
according to me output should be 17, but it is coming out to be 18.
plz explain it??
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
At first the value of a is calculated for the statement, that is 6, and
then statement is evaluated with a=6
so it is 6 + 6 + 6 = 18
and as you know after that the value of a becomes 7 for the rest of the
program.
On Mon, May 28, 2012 at 10:02 AM, ashish pant asheesh...@gmail.com wrote:
how is it 6?
++a(5) + ++a(6) + a++(6) it shud be 17
--
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
I implemented ++ for a simple class and got 17.
class A
{
public :
int val;
A(int v):val(v){}
int operator++()
{
cout empty arg called\n;
return ++val;
}
int operator++(int x)
{
cout x:arged arg called\n;
return val++;
}
};
--
A b(4);
cout ++a + ++a +a++endl;
17
but
it first calculates from right to left and then performs addition
so after a++ its still 4(with a promise to increment in next
statement). then ++a makes it 5. then further ++a makes it 6
now the addition phase comes into play value of a is 6 now so total
18 if it
@all : no need to argue on this ...output is compiler dependent ... it
violates sequence point rule :) :).
On Wed, May 30, 2012 at 2:26 AM, rahul ranjan rahul.ranjan...@gmail.comwrote:
it first calculates from right to left and then performs addition
so after a++ its still 4(with a
because the process which is executed from prompt has exited and the
children are still alive and printing.
On Thu, May 24, 2012 at 8:26 AM, Rajesh Kumar testalgori...@gmail.comwrote:
#includestdio.h
main()
{
fork();
fork();
fork();
printf(Hello Word\n);
}
output ---
its not about compilers ... its that new kernels kills all the child
processes, if parent gets killed before.. so that is the reason you
are gettin diff reasons
On 5/24/12, himanshu kansal himanshukansal...@gmail.com wrote:
i know that the program sholud have printed hello word 8 timesbt whn
main process have completed till the time all processes processes
prints Hello World,
to prevent it, use wait/wait4 family of fucntions.
~r
On Thu, May 24, 2012 at 8:26 AM, Rajesh Kumar testalgori...@gmail.com wrote:
#includestdio.h
main()
{
fork();
fork();
fork();
printf(Hello Word\n);
i know that the program sholud have printed hello word 8 timesbt whn
i run it, i get diffrnt reslts everytime and on diffrnt compilers...
please tell the reason
On Thu, May 24, 2012 at 11:11 AM, rajesh singarapu rajesh0...@gmail.comwrote:
main process have completed till the time
can nyone plz explain me how to count inversion pair in an array using
BIT??
--
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
Q: Select the K elements in an array of size N which are having the
minimum difference among them?
For Example : If you have an array like arr[]={9,5,2,6,3,11} and value
of K is 3. Then ans would be {2,3,5}.
--
You received this message because you are subscribed to the Google Groups
Algorithm
If I'm right you want a subset which has k elements and the difference of
the smallest and the largest element is minimum.
You can do it in O( Nlog(N) ).
*Sort input* in ascending order, then iterate through the array and keep
the difference of the last k elements.
O( nlogn + n ) belongs to
i want to calculate values like (100 C 1) %17,what would be
better algorithm for it,i think lucas theorem cant be used in this
case.want some efficent algorithm,actually i want to calculate
mC1,mC2mC1000 %17,such that may is about 10^6
--
You received this message
Given a set of values..in which there are some dependencies..
Eg.. x y z a b
Dependencies: x,y
a,z
Note that dependency is not transitive..Is it possible to separate
these elements into sets such that no two elements in the same set are
dependant and we should end up with the least number of
Represent the dependencies as a graph. Store all the values in a list. For
each vertex in the graph find all values for which there is no edge from
the vertex. If these values are there in the list, remove them from the
list and create a set of the vertex and the removed values.
If the values are
+1 abhishek
On Mon, Oct 31, 2011 at 6:26 PM, abhishek kumar abhi5...@gmail.com wrote:
Represent the dependencies as a graph. Store all the values in a list. For
each vertex in the graph find all values for which there is no edge from
the vertex. If these values are there in the list, remove
This is like the TOPOLOGY SORT .
Repeat the steps until all the elements of orginal set is visited:-
Do
First need to add all those elements in a set whose inorder is Zero .
Then create another set whose inorder is 1 , after making set 1 ,
then decrease the inorder by 1 for those elements who
Two numbers are given as input check if their sum will be overflow or not ??
Give a successfull running code for 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
@dave i was saying if user enter a+b in which aintmax .. A goes
negative(if a sligtly intmax) a+b =no overflow which we know
shouldnt be an answer..
On 8/28/11, Dave dave_and_da...@juno.com wrote:
@Kunal: You are very kind.
Dave
On Aug 27, 12:58 pm, Kunal Patil kp101...@gmail.com wrote:
@ankit: does that mean that after the compiler is informed that the void
pointer will point to integer witht he typecast statement and then we point
it to some other type , it will be an error?
i mean after that typecast statement, if i do
char a;
k=a;is it wrng?
On Tue, Aug 9, 2011 at 2:06
why j and k point different location?
#includestdio.h
main()
{
int a=10,*j;
void *k;
j=k=a;
k=(int *)k;
k++;
j++;
printf(%u %u\n,j,k);
}
--
Regards
Rajesh Kumar
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send
its because void pointer is incremented by 1, when we do k++
whereas integer pointer is incremented by 4, when we do j++
--
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
thanx Ankit
On Tue, Aug 9, 2011 at 5:27 PM, ankit sambyal ankitsamb...@gmail.comwrote:
its because void pointer is incremented by 1, when we do k++
whereas integer pointer is incremented by 4, when we do j++
--
You received this message because you are subscribed to the Google Groups
The typecasting tells the compiler that the void pointer is now pointing to
an integer and when we use this pointer to access the integer it takes value
from 4 bytes. But when we try to increment that pointer, it will point to
the next byte. Try taking k as pointer to double instead of void, u
typecast only temporarily changes the pointer type of LHS but cannot change
that of RHS or even LHS permanently
On Tue, Aug 9, 2011 at 5:36 PM, ankit sambyal ankitsamb...@gmail.comwrote:
The typecasting tells the compiler that the void pointer is now pointing to
an integer and when we use this
I read somewhere that arithmetic operations can't be performed to void
pointers?? How does v++ does'nt giv error??
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
Also take[] cannot be an array... It should be a pointer since function
cannot return more than one value.
On 3 August 2011 11:41, Thavasi Subramanian sktthav...@gmail.com wrote:
Here take is a pointer local to fn main() and array3[10] is local to fn
modify. So array3's entire locations are
here u have taken array *take*[] as constant...change its declaration to
int* yake;
then it will not give u error
On Wed, Aug 3, 2011 at 11:41 AM, Thavasi Subramanian
sktthav...@gmail.comwrote:
Here take is a pointer local to fn main() and array3[10] is local to fn
modify. So array3's entire
@Subramanian, I made the changes what you have told, it is running fine,not
giving any warning or error but output is not desirable
On Wed, Aug 3, 2011 at 11:41 AM, Thavasi Subramanian
sktthav...@gmail.comwrote:
Here take is a pointer local to fn main() and array3[10] is local to fn
modify.
@Alam: Can u mail tat revised code
On 3 August 2011 11:54, Arshad Alam alam3...@gmail.com wrote:
@Subramanian, I made the changes what you have told, it is running fine,not
giving any warning or error but output is not desirable
On Wed, Aug 3, 2011 at 11:41 AM, Thavasi Subramanian
@Alam, Try this revised code
#includestdio.h
#includeconio.h
int array3[10];
main()
{
clrscr();
int *take,i;
int array1[10]={1,2,3,4,5,6,7,8,9,10};
int* modify(int*);
take=modify(array1);
for(i=0;i10;i++)
printf(%d ,*(take+i));
getch();
}
int* modify(int*
@Subramanian-- great man, thanx alot. actually what I does is I had define
array3 inside the main function instead of globally, you had told me to
define array3 globally but by mistake I defined it inside the main function
which was my fault... thanx alot brother.
On Wed, Aug 3, 2011 at 1:36 PM,
WHY THERE IS ERROR AT THE BOLD LINE THAT IS L-VALUE REQUIRED
/*
Write a program which performs the following tasks:
- initialize an integer array of 10 elements in main( )
- pass the entire array to a function modify( )
- in modify( ) multiply each element of array by 3
- return the control to
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 testalgori...@gmail.comwrote:
What is Error in This program??plzrply
#includestdio.h
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 testalgori...@gmail.com wrote:
What is Error in This program??plzrply
#includestdio.h
f(struct epm);
What is Error in This program??plzrply
#includestdio.h
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
*#includestdio.h*
*
*
*
*
*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
what's the problem with line number 12?
1#includestdio.h
2#includeconio.h
3void main()
4 {
5clrscr();
6int n[3][3]= {
7 2,4,3,
8 6,8,5,
9 3,5,1
10 };
11 int
#includestdio.h
void main()
{
int n[3][3]= {
2,4,3,
6,8,5,
3,5,1
};
int i,*ptr;
ptr= n;
for(i=0;i=8;i++)
printf(\n%d,*(ptr+i));
}
In gcc 4.3.2 no error ,it
try this
#includestdio.h
void main()
{
int n[3][3]= {
2,4,3,
6,8,5,
3,5,1
};
int i,*ptr;
ptr= (int *) n;
for(i=0;i=8;i++)
printf(\n%d,*(ptr+i));
}
On Fri,
wow great... but why it is so yaar?
ptr=n and ptr=n[0] is same na?
On Fri, Jul 29, 2011 at 11:27 PM, rajeev bharshetty rajeevr...@gmail.comwrote:
#includestdio.h
void main()
{
int n[3][3]= {
2,4,3,
6,8,5,
no ,
n[0] is *(n+0)
so actually n is being dereferenced here .Check the basci diff
p is a pointer , but n is a pointer to a pointer.
On Fri, Jul 29, 2011 at 11:34 PM, Arshad Alam alam3...@gmail.com wrote:
wow great... but why it is so yaar?
ptr=n and ptr=n[0] is same na?
On Fri, Jul 29,
@rajeev: your code gives compilation error.
On Fri, Jul 29, 2011 at 11:39 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote:
no ,
n[0] is *(n+0)
so actually n is being dereferenced here .Check the basci diff
p is a pointer , but n is a pointer to a pointer.
On Fri, Jul 29, 2011 at 11:34
@ankur :which compiler are u using??
On Fri, Jul 29, 2011 at 11:39 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote:
@rajeev: your code gives compilation error.
On Fri, Jul 29, 2011 at 11:39 PM, Ankur Khurana
ankur.kkhur...@gmail.comwrote:
no ,
n[0] is *(n+0)
so actually n is being
http://ideone.com/OaCDR
On Fri, Jul 29, 2011 at 11:45 PM, rajeev bharshetty rajeevr...@gmail.comwrote:
@ankur :which compiler are u using??
On Fri, Jul 29, 2011 at 11:39 PM, Ankur Khurana
ankur.kkhur...@gmail.comwrote:
@rajeev: your code gives compilation error.
On Fri, Jul 29, 2011
@ankur: But the same above code wont show any error on my gcc 4.3.2 running
on Open Suse 11.4
On Fri, Jul 29, 2011 at 11:48 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote:
http://ideone.com/OaCDR
On Fri, Jul 29, 2011 at 11:45 PM, rajeev bharshetty
rajeevr...@gmail.comwrote:
@ankur
@ankur : Dude I think you compiled in ideone as C++ language but it is C :)
http://ideone.com/HZhHu
On Fri, Jul 29, 2011 at 11:51 PM, rajeev bharshetty rajeevr...@gmail.comwrote:
@ankur: But the same above code wont show any error on my gcc 4.3.2 running
on Open Suse 11.4
On Fri, Jul
Thanks for pointing that out, my apologies . . .
On Fri, Jul 29, 2011 at 11:53 PM, rajeev bharshetty rajeevr...@gmail.comwrote:
@ankur : Dude I think you compiled in ideone as C++ language but it is C :)
http://ideone.com/HZhHu
On Fri, Jul 29, 2011 at 11:51 PM, rajeev bharshetty
AFAIK , it is adaptation of gcc standards, which is the problem with mingw
as well . So i use ideone to check my answer as it uses spoj engine which is
considered more standard. I guess that is the reason, i cant think of
other
On Fri, Jul 29, 2011 at 11:51 PM, rajeev bharshetty
Hi,
I want to implement an algorithm to determine the shortest path from the top to
down.
like:
int py_path_shoretest(int size, int **map); // return the shortest path value.
size is the height.
int main(void)
{
int map = {
{1},
{2, 3},
It dont look like a tree
its more like a triangle
and if the values are stored in the matrix can be simply done using a
Dynamic Programming bottom up approach
On Tue, Jul 26, 2011 at 2:27 PM, Charlotte Swazki
charlotteswa...@yahoo.frwrote:
Hi,
I want to implement an algorithm to determine
Do inorder traversal and maintain a bit vector equal to height of tree also
keep an current shortest path bit vector
in last print path using shortest path bit vector.
keep updating shortest path bit vector when path shorter than current
shortest path is found.
On Tue, Jul 26, 2011 at 9:57 AM,
for(i=sz-2;i=0;i--)
for(j=0;j=i;j++)
ar[i][j]+=min(ar[i+1][j],ar[i+1][j+1]);
coutar[0][0];
is this fine.?
--
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
Hi,
Can anyone help me in understanding the following code
http://www.algorithmist.com/index.php/Longest_Increasing_Subsequence.cpp
I am not able to understand what is the exact purpose of vector p in the
above mentioned code.
A little detail explanation will be helpful.
~Neeraj
--
You
How can we calculate the number of divisors a number have in minimum time or
having minimum Time Complexity.
--
Harshit Gangal
Fourth Year Undergraduate Student
Dept. of Computer Science
JIIT, Noida , India
--
You received this message because you are subscribed to the Google Groups
Algorithm
isnt this a DP problem ?
I think its there in CLRS.
Let me know.
Cheers
Supraja J
On Wed, May 11, 2011 at 7:55 AM, Harshit Gangal harshit.gan...@gmail.comwrote:
How can we calculate the number of divisors a number have in minimum time
or having minimum Time Complexity.
--
Harshit Gangal
type on terminal sudo apt-get install gcc
you will get latest gcc automatically
--
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
i am using ubuntu 8.04 nd currently installed gcc 4.2
do anyone knws the steps of installing gcc of version greater thn 4.4
on ubuntu 8.04.
i hv searched a lot on net bt couldnt find 1...
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks
On 29/04/2011 19:31, himanshu kansal wrote:
i am using ubuntu 8.04 nd currently installed gcc 4.2
do anyone knws the steps of installing gcc of version greater thn 4.4
on ubuntu 8.04.
i hv searched a lot on net bt couldnt find 1...
This is *not* the correct mailing list to ask such
yeah i knw dt well...bt i jus asked if sum1 cd help me
On Sat, Apr 30, 2011 at 12:20 AM, Charles Turner chtu...@gmail.com wrote:
On 29/04/2011 19:31, himanshu kansal wrote:
i am using ubuntu 8.04 nd currently installed gcc 4.2
do anyone knws the steps of installing gcc of version
On 29/04/2011 19:52, himanshu kansal wrote:
yeah i knw dt well...bt i jus asked if sum1 cd help me
I really don't think people who have subscribed to read algorithm
related discussions want to read about your problems installing a
compiler. When you find the appropriate list (see hints in
I second Charles thought . The quality of the list is detoriating day by
day, due to such off topic questions.
On 30-Apr-2011 12:27 AM, Charles Turner chtu...@gmail.com wrote:
On 29/04/2011 19:52, himanshu kansal wrote:
yeah i knw dt well...bt i jus asked if sum1 cd help me
I really don't
I was trying to install mysql 5.5. in Windows XP.After installation
during configuration phase when there was to apply security settings I
m always getting an error
Error No 1045
Access Denied for user 'root'@localhost(using password: NO).
I have tried all possibilities in Firewall but it dint
try this http://www.fixya.com/support/t840251-mysql_error_messeage
On Fri, Apr 29, 2011 at 12:34 AM, Aniket aniket...@gmail.com wrote:
I was trying to install mysql 5.5. in Windows XP.After installation
during configuration phase when there was to apply security settings I
m always getting
http://forums.mysql.com/read.php?11,278745,278745
this works for me will work for you too
http://forums.mysql.com/read.php?11,278745,278745
On Fri, Apr 29, 2011 at 8:34 AM, shashi kant shashiski...@gmail.com wrote:
try this http://www.fixya.com/support/t840251-mysql_error_messeage
On Fri,
Problem; print the largest subset of negative number in array of integers
i have code it in following way which is give solution in O(n) and and
required memory in O(n)
any tell me other method better then this O(n) .
pls tell me is it any bug in the code
#includestdio.h
int
I think O(n) is the best time complexity. Try to think about one sequence
with all negative numbers or positive numbers. we can't get the full
information without one time iteration, or we can just say the data reading
time will cost O(n).
2011/4/21 hary rathor harry.rat...@gmail.com
Problem;
Well this was asked by codechef on it's intern contest...!! Make a recursive
algorithm using divide and conquer paradigm
On Thu, Mar 10, 2011 at 11:20 AM, Akash Mukherjee akash...@gmail.comwrote:
hi,
can anybody plzz look at this problem. i tried a recursive greedy approach
but it was too
dc nt givin tle??
On Mon, Mar 28, 2011 at 11:42 AM, sukhmeet singh sukhmeet2...@gmail.comwrote:
Well this was asked by codechef on it's intern contest...!! Make a
recursive algorithm using divide and conquer paradigm
On Thu, Mar 10, 2011 at 11:20 AM, Akash Mukherjee akash...@gmail.comwrote:
hi,
can anybody plzz look at this problem. i tried a recursive greedy approach
but it was too slow i guess
You have a truck that you need to completely fill up with merchandise. You
have an infinite supply of merchandise of dimension 1x1x1, 2x2x2, 4x4x4,
8x8x8, 16x16x16, ..., 2k x 2k x 2k for
Hello Akash,
I think the approach is simple. You just need to figure out a way to
count all the numbers where 3 follows 1, and those numbers should be
less than N.
And the number of configurations will be N - (count of numbers where 3
follows 1) - 1.
The last subtraction with 1 in the end is for
Hi,
I need some help. I am still a nube so if this is too easy, plz don't flame.
I cannot understand how to approach the problem. Would appreciate any help.
At CodeChef, The Chef can make 10 types of dishes numbered 0 through 9. He
can however only make dishes one after another. Suppose The Chef
I have solved the last one :)
how can i solve this one:
http://acmicpc-live-archive.uva.es/nuevoportal/data/problem.php?p=4805
using LCA, I used this algorithm:
http://www.topcoder.com/tc?module=Staticd1=tutorialsd2=lowestCommonAncestor
but i dont know how to count the weights of the edges.
I
Hi, I need some help solving this problem from ICPC regionals, 2010,
South America.
http://acmicpc-live-archive.uva.es/nuevoportal/region.php?r=sayear=2010
Problem K - Kid's Wishes
Each kid may wish to sit down next to at most two other kids, because
each kid has just two neighbors in the circle.
I have the following code structure
in my file myPlugin.h , i have defined this
virtual int speed();
and gave a dummy implementation in myPlugin.cpp
In another file otherPlugin.h I have included this line:
#include myPlugin.h
private:
int m_speed;
also class otherPlugin
M-speed is private and you cannot call it from outside myPlugin. (though i
did not understand what u wanted to say)
Can you write ur prob explicitly?
--
Rohit Saraf
Second Year Undergraduate,
Dept. of Computer Science and Engineering
IIT Bombay
Hi
On 13 June 2010 12:26, Rohit Saraf rohit.kumar.sa...@gmail.com wrote:
M-speed is private and you cannot call it from outside myPlugin. (though i
did not understand what u wanted to say)
Can you write ur prob explicitly?
I want to use speed() and direction() defined in myPlugin.h in
Make those functions public
And even if M_speed is public of another class, it is still it another
class, you cannot just address it like m_speed in other classes.
Does it help?
--
Rohit Saraf
Second Year Undergraduate,
Dept. of Computer Science and
I meant this:
let me explain it like this.
I have *virtual int speed()* in class A.(in file A.h)
I inherited class in class B(in file B.h) as class B:public A
class B have a private member m_speed.
Now I have to return m_speed from speed() from class B as I would
instantiate an object of class B
yes.. it should... make sure your virtual function is either public or
protected but not private.
and if it doesn't can u tell me the error?
--
Rohit Saraf
Second Year Undergraduate,
Dept. of Computer Science and Engineering
IIT Bombay
It gives this error:
error: prototype for ‘int B::speed()’ does not match any in class ‘B’.
Should I include this in class B(in B.h)
class B:public A
{
public:
virtual int speed(); //wouldn't this override the speed() from A ?
private:
int m_speed();
}
class A (in A.h)is defined as this
class A
Put the function speed or its declaration inside the class b. Did u forget that?
--
--
Rohit Saraf
Second Year Undergraduate,
Dept. of Computer Science and Engineering
IIT Bombay
http://www.cse.iitb.ac.in/~rohitfeb14
--
You received this message
In the first post the problem was that m_speed is not public also u should
access m_speed using Scope resolution operator as m_speed is not a member of
B.
class A
{
public:
virtual int speed()=0;
int m_speed;
};
class B:public A
{
public:
int speed()
{
return A::m_speed;
}
};
For ur second
Find out why this program is not working which converts list representation
of graph in adjacency matrix
#includeiostream
using namespace std;
struct node
{
node* point;
node* next;
int info;
};
node * getnode(int i);
void adja(int count,node **p);
int main()
{
int
Hi everybody i am trying to solve problem
http://acm.uva.es/p/v105/10512.html.
my solution is
(x+y)y=P(1)
(x-y)x=Q (2)
(1+(y/x))xy=P (1)//taking x outside
(1-(y/x))x^2=Q (2)
dividing 1 and 2 and let (y/x)=k
(1+k)k/(1-k)=P/Q;
solving for k
k=-(P+Q) +-sqrt((P+Q)^2+4PQ)/2Q;
since
hi friends i am try to solving this question
http://online-judge.uva.es/p/v1/116.html
for this problem i use left to right dynamic programming so i m getting the
total minimum cost but i m not getting how to find out lexicographically
shortest path .here is my code .if u can change it fine
Hi, please help me solve this problem. It's something like that: given
an array A[1...n] filled with different integers in range [1...n],
find a missing number. The only operation which you can use is
get_ith_bit_from_pos_n(i, n) = i'th bit of A[n]. This can be solved in
O(n) time. But how?
Known array: a[max]; divide a[] into four sections: a[0] - a[x], a[x+1]
- a[y], a[y+1] - a[z], a[z+1] - a[max-1].
And 0xyzmax-1;
a[] is an integer greater than 0;
Solve integers x, y and z, to meet the following requirements:
Sum = (a[0 ]+ ... +a[x] )* x
+ (a[x+1]+ ... +a[y] )*
100 matches
Mail list logo