for the 1st:
Divide the base into 5 segments and join the 4 points on the base to
the vertex opposite to the base.
The 5 triangles formed have equal area because area=1/2 * base * altitude
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To
The above solution I posted was for question 2
--
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
FOR question1
it returns no of set bits of N.
On 7/19/11, oppilas . jatka.oppimi...@gmail.com wrote:
For 3rd, if we only want winner,
Then 1110 players must lose. So total 1110 games.
On Tue, Jul 19, 2011 at 10:37 AM, sagar pareek sagarpar...@gmail.comwrote:
1. Let's say
S=D=N
repeat
FOR question1
it returns no of set bits of N.
On 7/19/11, SAMM somnath.nit...@gmail.com wrote:
FOR question1
it returns no of set bits of N.
On 7/19/11, oppilas . jatka.oppimi...@gmail.com wrote:
For 3rd, if we only want winner,
Then 1110 players must lose. So total 1110 games.
On Tue,
I think equal is referred as congruent.
--
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
hey frnds :)
isn't the first one is zero knapsack problem?
On Tue, Jul 19, 2011 at 11:42 AM, SkRiPt KiDdIe anuragmsi...@gmail.comwrote:
I think equal is referred as congruent.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to
ok
On Tue, Jul 19, 2011 at 11:05 AM, Neeraj Gupta neeraj.gupta...@gmail.comwrote:
Sagar, when we shift a variable beyond it's width,then output becomes
dependent on the compiler,so it is undefined behavior.
In Dev Cpp, I was getting 4 as an output.but there was a warning that left
shift is
hey
check my algo...i mentioned all the possible cases :)
On Tue, Jul 19, 2011 at 11:31 AM, oppilas . jatka.oppimi...@gmail.comwrote:
Yes we can avoid integer comparison.
But for jumping we will need to check whether the next node is null or
not.
So, depending upon the jump size, the
Some please give the TC for exponential + logarithmic search method
pointed out by Swathi.
On Jul 19, 11:51 am, Ankur Khurana ankur.kkhur...@gmail.com wrote:
@sagar: you might have proposed a solution but it ever occured to you that
(ptr-next)-next means that you have gone through two diferent
What is the answer to the first one?
On Jul 19, 10:07 am, sagar pareek sagarpar...@gmail.com wrote:
1. Let's say
S=D=N
repeat
D=(floor)D/2;
S=S-D;
till D=0
From the above logic, figure out which algorithm is followed by 'S'
2. How can you divide a triangle, to 5 equal triangles?
Ans. *German*
--
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
@Surender: sorry, i had missed a case. We need a 3 way comparison.
heres the correct version
btree* max_tree(btree *root)
{
if(root == NULL)
return root;
btree * current = root;
while(current-right != NULL)
{
current = current-right;
yaa..
On Tue, Jul 19, 2011 at 1:35 PM, alagammai narayanan
alagamma...@gmail.comwrote:
Yep.. Its German.. Were you guys able to come up with the 5 * 5 matrix...
As in who lives in which house?What does he drink,smoke etc..
On Tue, Jul 19, 2011 at 1:31 PM, archita monga
The algo gives the number of set bits in the number as pointed out by SAMMM
above.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
https://groups.google.com/d/msg/algogeeks/-/lyzigAph1iYJ.
To post to
HI,
Is there a method to calculate something like 23!/(7!*10!) i.e.
permutations with repeated elements in such a way that we need not
calculate all the factorials involved? The problem in calculating all
the factorials is in storing them. As 23! will make even long long in
C++ to overflow, but
Ok then
What about ques 2 ?
On Tue, Jul 19, 2011 at 1:40 PM, Nitish Garg nitishgarg1...@gmail.comwrote:
The algo gives the number of set bits in the number as pointed out by SAMMM
above.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
doing xor of all elements in array[][] should work. you start from a[0]
[0] to a[0][n] then a[1][0] .. when the xor value bcomz 0 then the
corresponding value in arr[i][j] is the first repeated element in the
array. though this code will have two loops and seem as O(n2) it will
terminate once it
For this you can use pascal triangle . It will give the permutation
value of the the series .
1
1 2 1
1 33 1
1 4 6 4 1
1 5 10 10 5 1
1 6 15 20 151
This can easily prepreocessed using dynamic method way .
a[0][i]=1 1=i=n
a[i][0]=1
#includestdio.h
int * fun(int a1,int b)
{
int a[2];
a[0]=a1;
a[1]=b;
//int c=5;
printf(%x\n,a[0]);
return a;
}
int main()
{
int *r=fun(3,5);
printf(%d\n,r[0]);
printf(%d\n,r[0]);
}
--
You received this message because you are subscribed to the Google
Print the symbol ∞ (INFINITY) through code . Unicode ..
--
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
char a[] or any array refers to a block of memory (not a single memory
location or variable). Analogy to this can be seen in the following fact :-
The memory addresses of an array can't be changed, whereas the content of
the pointer variables, such as the base memory address of the array it
refers
*printf(%c\n,236);*
On Tue, Jul 19, 2011 at 2:45 PM, SAMMM somnath.nit...@gmail.com wrote:
Print the symbol ∞ (INFINITY) through code . Unicode ..
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
In Dev C it does
On Tue, Jul 19, 2011 at 3:08 PM, SAMMM somnath.nit...@gmail.com wrote:
It doesn't display the infinity symbol.
On Jul 19, 2:24 pm, Piyush Sinha ecstasy.piy...@gmail.com wrote:
*printf(%c\n,236);*
On Tue, Jul 19, 2011 at 2:45 PM, SAMMM somnath.nit...@gmail.com wrote:
http://chexed.com/ComputerTips/asciicodes.php
On Tue, Jul 19, 2011 at 3:10 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote:
In Dev C it does
On Tue, Jul 19, 2011 at 3:08 PM, SAMMM somnath.nit...@gmail.com wrote:
It doesn't display the infinity symbol.
On Jul 19, 2:24 pm, Piyush Sinha
O(n) is possible . Will it serve the purpose or need less than that ???
--
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
give your algo.
On Tue, Jul 19, 2011 at 3:26 PM, SAMMM somnath.nit...@gmail.com wrote:
O(n) is possible . Will it serve the purpose or need less than that ???
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send
Take 2 node pointers.Move one at the speed of twice the
other(first:node-next,second:node-next-next) when the first pointer
reaches the end of the list,the second will give you the middle node.
On Tue, Jul 19, 2011 at 3:27 PM, shilpa gupta shilpagupta...@gmail.comwrote:
give your algo.
@Venkat. That algorithm doesnt work actually.Try for 9,8,1. At 1 , it
becomes 0.
--
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
exactly archita.
On Tue, Jul 19, 2011 at 3:33 PM, archita monga kool.arc...@gmail.comwrote:
Take 2 node pointers.Move one at the speed of twice the
other(first:node-next,second:node-next-next) when the first pointer
reaches the end of the list,the second will give you the middle node.
On
*node *middle(node *head)
{
node *mid;
mid = head;
for(int i = 2;head!=NULL;head=head-next,i++)
{
(i%2==1) mid = mid-next;
}
return mid;
}*
To find 1/3rd of a list, change (i%2==1) to (i%3==1)i.e. nth node can be
found (i%n==1) (make sure n=no. of
Ignore my previous post for find the 3/4th...its actually traversing the
list thriceso it better you traverse the list once and find the number
of nodes in it...then then traverse 3/4th times the number of nodes...
But the algo given by me is efficient if we are required to compute 1/nth of
a
Yaa this will work , you need to handle the case for odd number of
nodes .
For even number of node it will serve the purpose .
Yaa for the second part also you can use the ratio concept
fast pointer : slow pointer = 4:3
slow = ptr-next-next-next
fast = ptr-next-next-next-next
Here also we
I hope it can be solved using DP...check my algo below and give any counter
case if you get it...
1. Make an array S equal to the length of the given array where
S[0] = a[0] and S[1] = max(a[0],a[1])
2. for i:2 to n-1
S[i] = max(S[i-2]+a[i], S[i-1])
3. return S[n-1]
Hope
take two ptrs ptr1 and ptr2 pointing to head
move ptr1 until 1/4th of size of list.
move ptr1 and ptr2 until ptr1=null
ptr2 is pointing at 3/4th
surender
On Tue, Jul 19, 2011 at 3:42 PM, SAMMM somnath.nit...@gmail.com wrote:
Yaa this will work , you need to handle the case for odd number of
yeah in my ubuntu too its not printing :)
On Tue, Jul 19, 2011 at 3:20 PM, SAMMM somnath.nit...@gmail.com wrote:
But if we use gcc or g++ . In that case it doesn't print it .. Wht abt
tht ...
On Jul 19, 2:40 pm, Piyush Sinha ecstasy.piy...@gmail.com wrote:
In Dev C it does
On
Yaa guys it hav something to do with UNICODE ... I know that
On Jul 19, 3:32 pm, sagar pareek sagarpar...@gmail.com wrote:
yeah in my ubuntu too its not printing :)
On Tue, Jul 19, 2011 at 3:20 PM, SAMMM somnath.nit...@gmail.com wrote:
But if we use gcc or g++ . In that case
would u please code it for me :)
On Tue, Jul 19, 2011 at 3:49 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote:
I hope it can be solved using DP...check my algo below and give any counter
case if you get it...
1. Make an array S equal to the length of the given array where
S[0] =
Part 1:
Take 2 pointers moving at different speed...
1st with head-next
2nd with head-next-next
when 2nd will reach the end 1st will be pointing middle... so one result is
obtained
Part 2:
when 1st result is obtained then start with the node pointed by 1st as it
will be on 1/2th part of the
Take two pointers ptr1 and ptr2,
ptr1 should move 4 nodes at a time
ptr2 should move 3 nodes at a time,
thats it when the ptr1 reaches the end the ptr2 will be pointing to 3/4th,
same way for m/n th node. But this works best for even number of nodes in
list.
For odd numbers we need to compromise
Piyush
sorry dude but this will not work
say original array be
6 8 4 1 2 3
then ur new array be
6 8 10 10 12 13 //but original answer is 12
On Tue, Jul 19, 2011 at 3:49 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote:
I hope it can be solved using DP...check my algo below and give any
ok guys.. i got it thanks to all.
On Tue, Jul 19, 2011 at 4:23 PM, Manikanta Babu
manikantabab...@gmail.comwrote:
Take two pointers ptr1 and ptr2,
ptr1 should move 4 nodes at a time
ptr2 should move 3 nodes at a time,
thats it when the ptr1 reaches the end the ptr2 will be pointing
@Manikanta :
assume we have to find 5/60th part of node then
we will take a pointer moving with 5 nodes at a time and 2nd with 60 nodes
at a time...
for pointer with 60 nodes at a time we have to check(head-next!=null) then
(head-next-next!=null) upto 60 nodes...
Don't you think coding
The answer to the test case you mentioned is 13 only, 6+4+3 = 13.
Piyush's solution will do it.
On Tue, Jul 19, 2011 at 4:30 PM, sagar pareek sagarpar...@gmail.com wrote:
Piyush
sorry dude but this will not work
say original array be
6 8 4 1 2 3
then ur new array be
6 8 10 10 12 13
Well the creator of programming languages were smart enuf to give loops for
that.:)
On Tue, Jul 19, 2011 at 4:31 PM, Yogesh Yadav medu...@gmail.com wrote:
@Manikanta :
assume we have to find 5/60th part of node then
we will take a pointer moving with 5 nodes at a time and 2nd with 60 nodes
I think 6+4+3 6+4+2
On Tue, Jul 19, 2011 at 4:30 PM, sagar pareek sagarpar...@gmail.com wrote:
Piyush
sorry dude but this will not work
say original array be
6 8 4 1 2 3
then ur new array be
6 8 10 10 12 13 //but original answer is 12
On Tue, Jul 19, 2011 at 3:49 PM, Piyush
oh yeah my misunderstanding sorry
On Tue, Jul 19, 2011 at 4:33 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote:
I think 6+4+3 6+4+2
On Tue, Jul 19, 2011 at 4:30 PM, sagar pareek sagarpar...@gmail.comwrote:
Piyush
sorry dude but this will not work
say original array be
6 8 4 1 2 3
well thanks for the solution
On Tue, Jul 19, 2011 at 4:34 PM, sagar pareek sagarpar...@gmail.com wrote:
oh yeah my misunderstanding sorry
On Tue, Jul 19, 2011 at 4:33 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote:
I think 6+4+3 6+4+2
On Tue, Jul 19, 2011 at 4:30 PM, sagar pareek
@Sagar: 13 is the correct answer. (6+4+3)
--
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.
ok ok ok thank you all
On Tue, Jul 19, 2011 at 4:35 PM, ankit sambyal ankitsamb...@gmail.comwrote:
@Sagar: 13 is the correct answer. (6+4+3)
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
New constraint:-
What if the array also contains positive and negative numbers?
On Tue, Jul 19, 2011 at 4:36 PM, sagar pareek sagarpar...@gmail.com wrote:
ok ok ok thank you all
On Tue, Jul 19, 2011 at 4:35 PM, ankit sambyal ankitsamb...@gmail.comwrote:
@Sagar: 13 is the correct answer.
Won't this recurrence work:
s[i] = max(s[i-2], s[i-2]+a[i], a[i-1]) work?
I think it works.
On Tue, Jul 19, 2011 at 4:54 PM, oppilas . jatka.oppimi...@gmail.comwrote:
New constraint:-
What if the array also contains positive and negative numbers?
On Tue, Jul 19, 2011 at 4:36 PM, sagar pareek
Yes, to a great extent. Thanks :)
Obviously we can pass arrays across functions by declaring them static. Just
saying.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
Typo in my above post.
s[i] = max(s[i-2], s[i-2]+a[i], s[i-1]) work?
On Tue, Jul 19, 2011 at 4:59 PM, Nitish Garg nitishgarg1...@gmail.comwrote:
Won't this recurrence work:
s[i] = max(s[i-2], s[i-2]+a[i], a[i-1]) work?
I think it works.
On Tue, Jul 19, 2011 at 4:54 PM, oppilas .
the gets function gives me error when i execute the following code
plzz provide suggestions and answers
char str[100];
while(n--)
{
gets(str);
puts(str);
}
suggest alternative methods to solve the anomaly
--
You received this message because you are subscribed to the Google Groups
You can try this :-
fgets(buff,sizeof(buff),stdin) ..
It is recomended not to use gets in g++ or gcc ..
On Jul 19, 4:40 pm, Ankit Sablok ankitsablok19091...@gmail.com
wrote:
the gets function gives me error when i execute the following code
plzz provide suggestions and answers
char
Can you please the explain the approach.. Would be very helpful... I dint
get it ...
On Tue, Jul 19, 2011 at 1:37 PM, archita monga kool.arc...@gmail.comwrote:
yaa..
On Tue, Jul 19, 2011 at 1:35 PM, alagammai narayanan
alagamma...@gmail.com wrote:
Yep.. Its German.. Were you guys able to
Y is it not recommended to use gets in g++ what is the exact reason
can u tell
On Jul 19, 4:47 pm, SAMMM somnath.nit...@gmail.com wrote:
You can try this :-
fgets(buff,sizeof(buff),stdin) ..
It is recomended not to use gets in g++ or gcc ..
On Jul 19, 4:40 pm, Ankit Sablok
It is because it doesn't check any bound checking . So overflow can
easily occur without user's concent .
On Jul 19, 4:48 pm, Ankit Sablok ankitsablok19091...@gmail.com
wrote:
Y is it not recommended to use gets in g++ what is the exact reason
can u tell
On Jul 19, 4:47 pm, SAMMM
printf(\u221E\n);
On Tue, Jul 19, 2011 at 4:10 PM, SAMMM somnath.nit...@gmail.com wrote:
Yaa guys it hav something to do with UNICODE ... I know that
On Jul 19, 3:32 pm, sagar pareek sagarpar...@gmail.com wrote:
yeah in my ubuntu too its not printing :)
On Tue, Jul
ankit solution is correct all five bases will be 1/5 and altitude of each
triangle will be h same. so all have equal area. 1/2*(b/5) *h.
On Tue, Jul 19, 2011 at 2:07 PM, sagar pareek sagarpar...@gmail.com wrote:
Ok then
What about ques 2 ?
On Tue, Jul 19, 2011 at 1:40 PM, Nitish Garg
It's strange I tried it in GCC version 2.95.3 there is gives error ,
but in upper version it gives the correct answer .
I will thinking it will be same for different version .
I also gone for that , but i was having the intution that it doesn't
give the right answer .
Version is a serious mess.
+1 to SAMM
On Tue, Jul 19, 2011 at 5:32 PM, SAMMM somnath.nit...@gmail.com wrote:
It is because it doesn't check any bound checking . So overflow can
easily occur without user's concent .
On Jul 19, 4:48 pm, Ankit Sablok ankitsablok19091...@gmail.com
wrote:
Y is it not recommended to use
Calculate sum'
create heap
extract first k elements.
On Tue, Jul 19, 2011 at 6:31 PM, Rishabh Maurya poofiefoo...@gmail.comwrote:
find distances of given point P(x,y) with all other points in O(n) and
build initial Max-Heap of K elements with key as distance calculated.
Now compare all
its give me warning
warning: universal character names are only valid in C++ and C99
but running... :)
On Tue, Jul 19, 2011 at 6:15 PM, SAMMM somnath.nit...@gmail.com wrote:
It's strange I tried it in GCC version 2.95.3 there is gives error ,
but in upper version it gives the correct
Sorry for my previous post
i got the solution now :)
On Tue, Jul 19, 2011 at 6:29 PM, sagar pareek sagarpar...@gmail.com wrote:
Yeah i saw that solution but question is to divide the traingle in 5 equals
*TRIANGLES *not 5 equal parts
On Tue, Jul 19, 2011 at 5:57 PM, varun pahwa
Question :-
Once upon a time in ancient times there was a king who was very fond of
wines. He had a huge cellar, which had 1000 different varieties of wine all
in different caskets (1000 caskets in all). In the adjoining kingdom there
was a queen who was envious of the king’s huge wine
Dude I am using solaris with G++ version 2.95.3 . it is giving me
error .. It is not compiled as a C file . it was a cpp file . It
thrown as error write at the screen .
On Jul 19, 6:03 pm, sagar pareek sagarpar...@gmail.com wrote:
its give me warning
warning: universal character names are
@Dumanshu:
i know you have given a good explanation but i have never done
parallel computing..
could you illustrate a bit more especially about the n+1th process..
On Tue, Jul 19, 2011 at 3:35 PM, Bhanu Kishore bhanukishor...@gmail.comwrote:
@Venkat. That algorithm doesnt work actually.Try for
# include stdio.h
int main(){printf(\u221E);}
Compiler details:
gcc (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
Ya sorry abt that my algo is wrong!
On Tue, Jul 19, 2011 at 3:35 PM, Bhanu Kishore bhanukishor...@gmail.comwrote:
@Venkat. That algorithm doesnt work actually.Try for 9,8,1. At 1 , it
becomes 0.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks
question had come in Amazon interview ...
--
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.
This is done by using exponential theory :-
I am giving my code here for a^b
int power (int a,int b)
{
int x=1,y=a;
while(b0)
{
if(b%2==1) x=(x*y)
if (b/=2) y=(y*y);
}
return x;
}
Run time O(log b)
--
You received this message because you are subscribed to
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
@Vengadanathan:
I think you should see this link
http://c-faq.com/expr/seqpoints.html
--
Thanks and Regards
*Devansh Gupta*
*B.Tech Third Year*
*MNNIT, Allahabad*
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send
@schrodinger y a[] value is not lost in first call.it should be lost in
first call only?
On Tue, Jul 19, 2011 at 8:24 PM, schrodinger 6fae1ce6347...@gmail.comwrote:
First output of memory location is fine.
Second output is also expected one.
Third output will vary compiler to compiler and
hey guys pls tell any other better solution ...
On Tue, Jul 19, 2011 at 6:41 PM, sagar pareek sagarpar...@gmail.com wrote:
Question :-
Once upon a time in ancient times there was a king who was very fond of
wines. He had a huge cellar, which had 1000 different varieties of wine
all in
Thanks all :)
On Tue, Jul 19, 2011 at 8:37 PM, Deepthi Srinivasan deeps1...@gmail.comwrote:
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
Find unique string from a list of strings in one pass.
--
regards,
chinna.
--
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
sorry.
On Tue, Jul 19, 2011 at 9:07 PM, Shubham Maheshwari
shubham.veloc...@gmail.com wrote:
what is meant by unique string ...!!
A string which occurs only once.
On Tue, Jul 19, 2011 at 9:04 PM, SAMMM somnath.nit...@gmail.com wrote:
There is only one unique string in the list of
Suppose N number of circle is given with their x y coordinate and
radius . Now the question is to find the total area covered by the N
circles .. Circles can be overlapping depending on their coordinates .
--
You received this message because you are subscribed to the Google Groups
Algorithm
can u pl tell wat is dis x y coordinate?
are dey centre coordinates or any point on circumference of circle..
--
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
You can try like this
#include stdio.h
#include string.h
#define N 3
void copy(int A[N][N],int B[N][N])
{
int i,j;
for(i=0;iN;i++)
for(j=0;jN;j++)
A[i][j]=B[i][j];
}
void mul(int A[N][N],int B[N][N],int M[N][N])
{
int i,j,k;
for(i=0;iN;i++)
time complexity is (cost of multiplication)*log(n)
--
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
is this code running?
--
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,
Consider a c++ template funtion
templateclass T
T Add(T a, T b)
{return a+b ;}
if this function is called as T c = Add(SAM, SUNG); what will
happen? What is the problem in the template declaration/ How to solve
the problem.
--
You received this message because you are subscribed to the Google
Yes its running fine at gcc 4.3.2 . And it might show warning in that case
just change the name of the function exp().
--
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
See the input will be :-
6 No of circles
x1 y1 R1
x2 y2 R2
x3 y3 R3
x4 y4 R4
x5 y5 R5
x6 y6 R6
Output:-
Area occupied by the above circles (one line) 4 decimal points .
On Jul 19, 9:01 pm, priyanka goel priya888g...@gmail.com wrote:
can u pl tell wat is dis x y coordinate?
are dey
Hi,
Find the kth smallest element in O(logk) given 2 sorted arrays.
Merging the arrays is not allowed. I can do it in O(k).. How to do in
O(logk)..
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email
@Rishab Thanks ..
could you explain what your are doing in the function exp()..
On Tue, Jul 19, 2011 at 9:47 PM, Rishabh Maurya poofiefoo...@gmail.comwrote:
Yes its running fine at gcc 4.3.2 . And it might show warning in that case
just change the name of the function exp().
--
You
here T becomes char *.. u r trying to add two addreses here...
On Tue, Jul 19, 2011 at 9:46 PM, nidhi jain nidhi.jain311...@gmail.comwrote:
Consider a c++ template funtion
templateclass T
T Add(T a, T b)
{return a+b ;}
if this function is called as T c = Add(SAM, SUNG); what will
happen?
@rishabh , thnX a lot :P
Plz explain further :P
On Tue, Jul 19, 2011 at 10:15 PM, snehi jain snehijai...@gmail.com wrote:
@Rishab Thanks ..
could you explain what your are doing in the function exp()..
On Tue, Jul 19, 2011 at 9:47 PM, Rishabh Maurya poofiefoo...@gmail.comwrote:
The logic which I have posted , it works on that principle only . Take
a good look . It is the standard way fopr finding the power of a
number . (a^b)
You take and example for a=3 and b=4 and test it in My posted code .
then you will understand wht is happening .
On Jul 19, 9:45 pm, snehi jain
Given the following program, MS will be printed, infinite number of
times:
int n = 20;
int i;
for (i=0; in; i--)
printf(MS);
Apply one of the following three operations one at a time such that
MS can be printed 20 times.
1. You can add only one character into it.
2.
Yes sure ,
we know if A B C are matrices of same dimension then Ax(BxC)=(AxB)xC
So now what SAMM is saying i.e normal exponential of any number can be
applied in case of matrix expo too and the same thing I too did but using
loop without recursive fashion.
I hope its clear now .
--
You
Let me explain a little more :-
For example :-
a^b = Can be written as (a^2)^(b/2) For n is even . [ Reason:- For
b/2 in my code orn=n1; in Rishabh code ]
= Can be written as a.(a^2)^(b-1/2) For n is odd [ Reason :-
x=(x*y) for the odd number for getting the alone ]
It works
i know 3 solns!
1) int n = 20;
int i;
for (i=0; i+n; i--)
printf(MS);
2) int n = 20;
int i;
for (i=0; in; n--)
printf(MS);
3) int n = 20;
int i;
for (i=0; -in; i--)
printf(MS);
On Tue, Jul 19, 2011 at 10:27 PM, Reynald reynaldsus...@gmail.com wrote:
Given the
are the sizes of the two arrays same??
On 7/19/11, swetha rahul swetharahu...@gmail.com wrote:
Hi,
Find the kth smallest element in O(logk) given 2 sorted arrays.
Merging the arrays is not allowed. I can do it in O(k).. How to do in
O(logk)..
--
You received this message
Arrays are not of the same size
On Tue, Jul 19, 2011 at 10:41 PM, Rishabh Maurya poofiefoo...@gmail.comwrote:
Its solvable using Binary Search , offcourse not in log(k) but in log(sum
of size of array).
--
You received this message because you are subscribed to the Google Groups
Given an infinite stream of bits with bits being appended at the
highest significant position. Give an algorithm to say whether the
number formed by sequence of bits that had been processed till then ,
is divisible by 3 or not ?
My sol:
have a variable sum...find the sum of bitswhenever
use automata theory. draw dfa for divisibility by 3..
On Tue, Jul 19, 2011 at 11:23 PM, siva viknesh sivavikne...@gmail.comwrote:
Given an infinite stream of bits with bits being appended at the
highest significant position. Give an algorithm to say whether the
number formed by sequence of
1 - 100 of 130 matches
Mail list logo