@atul: No,it's not the correct answer. Let's take an example of star like
DAG:-
A--
B--C
|
V
D
This DAG contains only one cut vertex(B) but we need to add two edges to
make it strongly connected.
On Sat, Oct
Bcoz u r trying to access an argument which doesnt even exist...
for exmple ./a.out -- argc=1
(argv[0]=./a.out,argv[1]=NULL(not exist))
./a.out 1st_arg -- argc=2
(argv[0]=./a.out,argv[1]=1st_arg,argv[2]=NULL(not exist));
resulting '0' as %d specifier is used the print
will it not give an erroneous result since, argc = number of elements in
argv starting from 0?
On Sun, Oct 7, 2012 at 6:33 PM, rahul sharma rahul23111...@gmail.comwrote:
#includestdio.h
int main(int argc,char *argv[])
{
printf(%d\n,argv[argc]);
getchar();
return 0;
}
*@Dave while( arr[--size] != elem );*
*Exception will come when it will encounter a[-1]*
*i dont know if this loop will ever end... very poor solution i will say
*
On Sat, Oct 6, 2012 at 10:00 PM, Umer Farooq the.um...@gmail.com wrote:
Well actually, I've just gone through Dave's code
count the no. of nodes having 0 in-degree.
On Mon, Oct 8, 2012 at 12:44 AM, atul anand atul.87fri...@gmail.com wrote:
yeah i read it wrongly .. i thought ques was asking to find total
strongly connected component in the graph
On 10/7/12, bharat b bagana.bharatku...@gmail.com wrote:
@Dave: Nice solution. Can you clarify why you need to store the first
element in a temp variable and put 'elem' in the first position? If elem
was already first in array then it makes no difference. If elem was not
first but somewhere in between, the loop will break there when coming from
behind
@ Mangal : well if see the soln carefully then before loop starts elem is
assigned to arr[0] and copy of arr[0] is saved to temp. This will make sure
that the elem exists in the arr[] ,so it will never reach arr[-1] . when
size become =0 then it will come out of the loop bcoz of the assignment
@jaspreet: take an ex:
B-A
B-C
B-D
Here the no.of zero-indegree is one . But its not the correct ans.
On Mon, Oct 8, 2012 at 1:19 AM, Jaspreet Singh jassajjassaj...@gmail.comwrote:
count the no. of nodes having 0 in-degree.
On Mon, Oct 8, 2012 at 12:44 AM, atul anand
If its NULL then y does it give segmentation fault as for NULL it should
print an empty stringplz xomment
On Sun, Oct 7, 2012 at 6:56 PM, DHARMENDRA KUMAR VERMA
dharmendrakumarverm...@gmail.com wrote:
Bcoz u r trying to access an argument which doesnt even exist...
for exmple
@dharmendradoes every uninitialized memory has NULL or there can be
some garbage value also...plz comment???
On Mon, Oct 8, 2012 at 9:02 PM, rahul sharma rahul23111...@gmail.comwrote:
If its NULL then y does it give segmentation fault as for NULL it should
print an empty stringplz
@rahul According to C specification, half filled array will be filled with
value 0. In your example you are setting str[0] as 'g' and str[1] as 'k'.
So the compiler sets str[29] as 0. So you string str becomes
{'g', 'k', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0'}
Confusion is arising
@atul if the largest matrix is [a1 b1 c1 d1 ] i mean if it is the
first row or if it is [c2 d2.i think then then ur code wont be giving the
right answer.
c3 d3]
correct me if i'm wrong
On Monday, January
@empo I believe you missed the point where Dave is setting arr[0] as elem.
So this while condition will break at size = 0.
Thanks
Sachin
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
yeah you are correct bharat .. so i think it should be no. of nodes having
0 (in-degree + out-degree). what say ?
On Mon, Oct 8, 2012 at 8:20 PM, bharat b bagana.bharatku...@gmail.comwrote:
@jaspreet: take an ex:
B-A
B-C
B-D
Here the no.of zero-indegree is one . But its not the correct
@ Mengal.
That's what I thought actually
But, he had set the value of arr[0] = elem
So, it will stop at zeroth element and won't go to -1th element.
On Mon, Oct 8, 2012 at 12:01 AM, Mangal Dev Gupta dev.it...@gmail.comwrote:
*@Dave while( arr[--size] != elem );*
*Exception will come when it
You'd need: max(#vertices-with-0in-degree, #vertices-with-0out-degree)
edges at least.
On 8 October 2012 20:20, bharat b bagana.bharatku...@gmail.com wrote:
@jaspreet: take an ex:
B-A
B-C
B-D
Here the no.of zero-indegree is one . But its not the correct ans.
On Mon, Oct 8, 2012 at 1:19
ok the algo will go like this :
count no of nodes having only indegree 0 , only outdegree 0 and both 0. say
in_count,out_count and both_count are the corresponding counts.
now decrease the counts accordingly if u found a matching like u can
decrease in_count by both_count if both_countin_count ie.
@sachin..thnx for explanation..got it..plz tell
#includestdio.h
int main()
{
char str[]={'a','b','c'};
char str1[]={abc};
printf(%d,sizeof(str));
printf(%d,sizeof(str1));
getchar();
}
why str has size 3 and str1 has 4...NUll should also come after c of
str???then y
using name space std
Please explain about this
thnx
--
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
if u have seen the iostream file then it begins like this:-
#include bits/c++config.h
#include ostream
#include istream
*
*
*namespace std *
{
/**
* @name Standard Stream Objects
*
* The lt;iostreamgt; header declares the eight emstandard stream
* objects/em. For other
@Priya : if first row is the max one , then it is actually boundary case
which you can be handled easily,once you are done which above algo.
please note that only first row need to checked if it max not every row ,
above algo is handling this . you can also modify given algo which will
handle this
21 matches
Mail list logo