@mohit: nice soln :)
On Jul 2, 2:50 pm, mohit goel mohitgoel291...@gmail.com wrote:
May be this can work.give any counter example...
int count;
main()
{
int l,rope,cuts;
scanf(%d%d,l,rope);
count =0;
find_cuts(l,rope);
printf(cuts needed is %d,count);
@mohit: a little change in your function to make it work..
int find_cuts(int l,int rope)
int find_cuts(int l,int rope)
{
if(l==rope)
return count;
count++;
// printf(%d,count);
l=l/2;
if(l==rope)
return count;
if(ropel)
rope =rope-l;
return
@avi dullu: explanation of your code plz..
On Jul 3, 3:57 am, Avi Dullu avi.du...@gmail.com wrote:
Another alternative soln.
int rec_cut(int l, int k) {
if (l == k) return 0;
int tmp = k - (l1);
return 1 + rec_cut(l1, tmp = 0 ? k : tmp);
}
int main() {
int l, k;
scanf(%d%d,
i was actually trying this problem..
www.spoj.pl/problems/LQDCANDY
I'm getting WA still..
#includemath.h
#includestdio.h
int cnt;
inline int find_cuts(int l,int rope)
{
if(l==rope)
return cnt;
cnt++;
l=l/2;
if(l==rope)
return cnt;
if(ropel)
I think its problem of overflow?
the input data is 10^18.Otherwise the problem is trivial
On Sun, Jul 3, 2011 at 7:02 PM, cegprakash cegprak...@gmail.com wrote:
i was actually trying this problem..
www.spoj.pl/problems/LQDCANDY
I'm getting WA still..
#includemath.h
#includestdio.h
that will not work.
for example we need a rope of length 4 from a rope of length 16
we need 2 cuts
16== 8 + 8 == 8+ 4+ 4
--
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
nope
On Jul 2, 1:14 pm, keyan karthi keyankarthi1...@gmail.com wrote:
yup :)
On Sat, Jul 2, 2011 at 1:38 PM, Shalini Sah shalinisah.luv4cod...@gmail.com
wrote:
i guess the no. of 1s in the binary representation of the number is the
answer..for 6 its 2...
On Sat, Jul 2, 2011 at 1:32
k - rope of desired length.
l - rope of given length
m = 2;
while(k % m)
m *= 2;
ans :: (log2(l) - log2(m) + 1).
ex.
k = 6,l = 8
so initially m = 2;
after 1st iteration m = 4;
then break;
so min = log2(8) - log2(4) + 1 = 3 -2 + 1 = 2.
On Sat, Jul 2, 2011 at 1:16 AM, cegprakash
xor the length of the rope with the required length and difference between
the indexes of first set and last set bit *may* be the answer !!
On Sat, Jul 2, 2011 at 1:46 PM, cegprakash cegprak...@gmail.com wrote:
nope
On Jul 2, 1:14 pm, keyan karthi keyankarthi1...@gmail.com wrote:
yup :)
k is an even number and m=2 in your code. k%2 is always 0. your while
loop does nothing.
On Jul 2, 1:26 pm, varun pahwa varunpahwa2...@gmail.com wrote:
k - rope of desired length.
l - rope of given length
m = 2;
while(k % m)
m *= 2;
ans :: (log2(l) - log2(m) + 1).
ex.
k = 6,l = 8
so
@varun
I think u want to write
while (k % m == 0)
On Sat, Jul 2, 2011 at 1:56 PM, varun pahwa varunpahwa2...@gmail.comwrote:
k - rope of desired length.
l - rope of given length
m = 2;
while(k % m)
m *= 2;
ans :: (log2(l) - log2(m) + 1).
ex.
k = 6,l = 8
so initially m = 2;
after 1st
whats mean by first set bit and last set bit? do you simply mean the
index of first and last bit?
On Jul 2, 1:25 pm, sunny agrawal sunny816.i...@gmail.com wrote:
xor the length of the rope with the required length and difference between
the indexes of first set and last set bit *may* be the
yes i have written that only
difference between indexes of first set bit and last set bit
On Sat, Jul 2, 2011 at 2:08 PM, cegprakash cegprak...@gmail.com wrote:
whats mean by first set bit and last set bit? do you simply mean the
index of first and last bit?
On Jul 2, 1:25 pm, sunny agrawal
l = 81 0 0 0
k = 6 0 1 1 0
xor 1 1 1 0
difference = 2
l = 161 0 0 0 0
k = 4 0 0 1 0 0
xor
On Sat, Jul 2, 2011 at 2:09 PM, sunny agrawal sunny816.i...@gmail.comwrote:
yes i have written that only
difference between indexes of first set bit
even that won't work
for example:
if we need a length of rope 14 from a length of rope 16
according to varun's algo
initially m=2
14%2 is 0.. so m=4
14%4 is not 0.. break..
so log2(16)-log2(14)+ 1 == 4-3+1 = 2 which is wrong
but actually we need atleast 3 cuts.
16== 8 + 8 == 8+ 4+ 4 == 8 + 4+
@varun: i think it works.. could u tell me how u found 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
@ sunny: so your's doesn't work right?
--
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
why ?
On Sat, Jul 2, 2011 at 2:20 PM, cegprakash cegprak...@gmail.com wrote:
@ sunny: so your's doesn't work right?
--
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
@varun: explanation or proof for your soln. plz..
--
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
oh fine.. got it now.. set bit is '1' right.. and is there any short
ways to find the difference between first set and short set bit
without dividing by 2 repeatedly?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send
for a number N
first set bit(From Left) is simply integer value of log(N)
last set bit can be calculated as
N = N-(N(N-1)); and then Log(N)
int i = log(n);
n -= n(n-1);
int j = log(n);
i-j will be the answer.
On Sat, Jul 2, 2011 at 2:34 PM, cegprakash cegprak...@gmail.com wrote:
oh fine..
awesome!! thank you so much :)
On Jul 2, 2:11 pm, sunny agrawal sunny816.i...@gmail.com wrote:
for a number N
first set bit(From Left) is simply integer value of log(N)
last set bit can be calculated as
N = N-(N(N-1)); and then Log(N)
int i = log(n);
n -= n(n-1);
int j = log(n);
btw what N = N-(N(N-1)) does actually
On Jul 2, 2:11 pm, sunny agrawal sunny816.i...@gmail.com wrote:
for a number N
first set bit(From Left) is simply integer value of log(N)
last set bit can be calculated as
N = N-(N(N-1)); and then Log(N)
int i = log(n);
n -= n(n-1);
int j = log(n);
try out with examples!!
u will surely get in 2-3 examples
N(N-1) is a very famous expression, used in counting set bits. see what
this expression return
On Sat, Jul 2, 2011 at 2:51 PM, cegprakash cegprak...@gmail.com wrote:
btw what N = N-(N(N-1)) does actually
On Jul 2, 2:11 pm, sunny
@sunny
that will work fine(xoring).
In place of Xoring u can also do OR of two number and find the distance
between fist set bit from left and first set bit from right,
Since bit operation is really fast operation so best algo this is of
complexity O(1);
Explanation How it works:
In l only
@sunny
the no of set bits in m will tell what all length(4,2 in above case)
are need to be merged.
e.g if if m ==6 then m = 0110
since bit set position are 2 and 1.
so length of rope need to combine is 2^2=4 and 2^1 = 2;i.e 4 and 2
Thnaks
Santosh
On Sat, Jul 2, 2011 at 2:58 PM, santosh mahto
@ sunny
21 is 0
32 is 2
43 is 0
5 4 is 4
65 is 4
I don't find anything
--
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
power of 2 less than n right?
On Jul 2, 2:38 pm, cegprakash cegprak...@gmail.com wrote:
@ sunny
21 is 0
32 is 2
43 is 0
5 4 is 4
65 is 4
I don't find anything
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group,
no no.. it should be multiple of 2 less than n? even that doesn't
satisfies for 43
On Jul 2, 2:41 pm, cegprakash cegprak...@gmail.com wrote:
power of 2 less than n right?
On Jul 2, 2:38 pm, cegprakash cegprak...@gmail.com wrote:
@ sunny
21 is 0
32 is 2
43 is 0
5 4 is 4
65 is 4
May be this can work.give any counter example...
int count;
main()
{
int l,rope,cuts;
scanf(%d%d,l,rope);
count =0;
find_cuts(l,rope);
printf(cuts needed is %d,count);
getch();
return 0;
}
int find_cuts(int l,int rope)
{
@cegprakash
Expression resets the least significant set bit
On Sat, Jul 2, 2011 at 3:20 PM, mohit goel mohitgoel291...@gmail.comwrote:
May be this can work.give any counter example...
int count;
main()
{
int l,rope,cuts;
scanf(%d%d,l,rope);
count =0;
nn-1 is the expression to find out if n is a power of 2...If nn-1 returns
0 its a power of 2 else its not.
And what sunny said is also ryt
On Sat, Jul 2, 2011 at 3:47 PM, sunny agrawal sunny816.i...@gmail.comwrote:
@cegprakash
Expression resets the least significant set bit
On Sat, Jul
@sunny ya i wanted to write the while(k % m == 0)
On Sat, Jul 2, 2011 at 3:47 AM, sameer.mut...@gmail.com
sameer.mut...@gmail.com wrote:
nn-1 is the expression to find out if n is a power of 2...If nn-1
returns 0 its a power of 2 else its not.
And what sunny said is also ryt
On Sat,
@sunny thnx for the correction.
On Sat, Jul 2, 2011 at 9:16 AM, varun pahwa varunpahwa2...@gmail.comwrote:
@sunny ya i wanted to write the while(k % m == 0)
On Sat, Jul 2, 2011 at 3:47 AM, sameer.mut...@gmail.com
sameer.mut...@gmail.com wrote:
nn-1 is the expression to find out if n is
Another alternative soln.
int rec_cut(int l, int k) {
if (l == k) return 0;
int tmp = k - (l1);
return 1 + rec_cut(l1, tmp = 0 ? k : tmp);
}
int main() {
int l, k;
scanf(%d%d, l, k);
printf(%d\n, rec_cut(l, k));
return 0;
}
Veni Vedi Slumber !
On Sat, Jul 2, 2011 at 9:47 PM,
can any one tell the best compiler for c and c++...
Thanks,
G. Shashank Reddy
--
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/-/g2ZE6Sm9p-MJ.
To post to this
In windows you can choose codeblocks or best is use linux gnu compiler
On Wed, Jun 15, 2011 at 8:50 PM, shashankreddy509
shashankreddy...@gmail.com wrote:
can any one tell the best compiler for c and c++...
Thanks,
G. Shashank Reddy
--
You received this message because you are
intel icc compiler
On Wed, Jun 15, 2011 at 08:20:39AM -0700, shashankreddy509 wrote:
can any one tell the best compiler for c and c++...
Thanks,
G. Shashank Reddy
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view
i need compiler for windows 7...
--
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/-/Y9OZdeYwmggJ.
To post to this group, send email to
I would recommend you to read complete Java Reference book by Herbert
Schildt, it will take you nicely through the basics of creating window
based applications. First read the chapters on Applets and AWT and
then you should be able to easily and naturally graduate to using
Swing.
On Thu, Jun 9,
@naveen Thanks for the prompt reply
I am already aware of Applets and AWT and have started getting acquainted to
Swing
but the problem lies where to start from. Its like I want a small example or
few starting steps.
Complete Reference is the book that i refer.
On Thu, Jun 9, 2011 at 1:48 PM,
As soon as i type Java Swing PDFs in google, i get lots of results.
See if anyone of them can help you.
No tutorial i am having as such specifically for Swing.
On Thu, Jun 9, 2011 at 1:53 PM, snehi jain snehijai...@gmail.com wrote:
@naveen Thanks for the prompt reply
I am already aware of
i Did that before asking for help on the group.
anyways thanks :)
Swing isnt necessary, someone referred so i am trying to learn it.
Any info regarding desktop or phone apps. will be appreciated.
On Thu, Jun 9, 2011 at 2:00 PM, Navneet Gupta navneetn...@gmail.com wrote:
As soon as i type Java
Hi Snehi...Follow following links to kick-start your Swing!!
http://www.herongyang.com/Swing/Introduction-First-Swing-Program-SwingHello.html
http://www.herongyang.com/Swing/Introduction-First-Swing-Program-SwingHello.html
http://www.dreamincode.net/forums/topic/206319-first-swing-application/
hey Karan... thanks a lot
the links are helpful :)
its an app. that can help in building one's vocab.
its basically a thought right now. Will ask more when things start taking
desired shape a little bit.
On Thu, Jun 9, 2011 at 4:59 PM, karan sachan karansac...@gmail.com wrote:
Hi Snehi...Follow
I am last year student preparing for placements
can any one give some ebooks on data structure, algo etc. like beofre some
time , some one posted a book how to crack the coding interview that was
an awesome book thanks to the guy who send the book . if anyone has some
good ebooks or links
can anyone tell me how to think about this problem?
--
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 Guys ,
Can any one give link for tutorial or videos about
segment trees. I am unable to understand the basic idea behind it .
Regards,
vinod
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send
Question :Let A[1..n] be an array of integers. Design an efficient
divide and conquer algorithm to determine if A contains a majority
element, i.e an element appears more than n/2 times in A. What is the
time complexity of your algorithm?
Answer:
a[1..n] is an array
int majorityElement(int a[],
You have N marbles and K slots. You have to follow the below mentioned
rules :
1. You can put in a marble or take out a marble from slot numbered
1 at any time.
2. You can put in a marble or take out a marble from slot numbered
i only if there exists a marble at the slot i - 1.
3. The
Hi,
I hope this is correct. Please correct if I am wrong.
Short answer:
Let a = (k-n)/(n-1)
Let b = (k-n)%(n-1)
steps = (n-1)(a)(a+1)/2 + b
Put = steps + n
Remove = steps
Explanation:
Example with n = 3 k =10:
Start by putting balls in 1,2,3
1 2 3 x x x x x x
Now move balls from 1-3 to
You are given n coins, at least one of which is bad. All the good
coins weigh the same, and
all the bad coins weigh the same. The bad coins are lighter than the
good coins.
Find the exact number of bad coins by making O(logn)^2 weighings on a
balance. Each
weighing tells you whether the total
http://www.spoj.pl/problems/PIGBANK/
can anyone give me an idea how to solve this problem...?? I dont think
the knapsack algo would be of help here as here we need to find
minimum value..please refer to the link and if anyone can help, i
would be very thankful.
regards,
aksha
--
You received
a small modification in normal knapsack algo ll do :)
On Thu, Feb 24, 2011 at 4:06 PM, Akshata Sharma
akshatasharm...@gmail.comwrote:
http://www.spoj.pl/problems/PIGBANK/
can anyone give me an idea how to solve this problem...?? I dont think
the knapsack algo would be of help here as here we
Consider a simple polygon P over vertices, on the plane, and a point
s, which maybe inside or outside P. Design an O(nlogn) algorithm that
finds a line segment starting from, and cutting a maximum number of
edges of P. An edge of P is any one of the line segments making up its
boundary. (Note that
Mike Johnson wrote:
Plesae rite a program for me to find prime nummers. It should be recursive
prorgram. What duz that mean?
If u type a nummer like 10 it should say 1 is prime, 2 is prime, 3 is prime,
4 is not prime up to 10.
This iz not homewurk I just thout of it myself. Lol.
/* Sure
fun(n)
{
if(n=2)
return (1);
else
return ((fun(n-1)*fun(n-2));
}
find the order of complexity .
--
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,
O(2^n)
On Sat, Jan 22, 2011 at 8:58 PM, Decipher ankurseth...@gmail.com wrote:
fun(n)
{
if(n=2)
return (1);
else
return ((fun(n-1)*fun(n-2));
}
find the order of complexity .
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post
Could u pls explain ??
--
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,
T(n) = T(n-1) + T(n-2) + O(1)
On Sat, Jan 22, 2011 at 11:28 PM, Decipher ankurseth...@gmail.com wrote:
Could u pls explain ??
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
Got AC with your code with small corrections to the output -
don't use getchar();
output specification says: Each line of output should be followed by a
blank line (so, add blank line to match the sample output)
you print a whitespace after each number, so the last character in your line
is a
i improved upon my code but still i get a presentation error dunno wts the
judge judging it shows me the correct way when i output test cases on my
compiler but on the judge it says wrong answer or presentation error
#includeiostream
#includecstdio
#includevector
#includealgorithm
#includecmath
Redirect your output to the file, and you'll see that at the end of line you
have extra blank.
You need to write something like this (in all sections):
for(i=j;i(j+2*C-1);i++) {
if (i != j) printf( );
printf(%d,s[i]); // note there is no space
}
--
You received this message because you are
Polish your Mathematical aptitude, basic data structures, matrices and
linear programming(added advantage) might help
-
Azhar.
On Sat, Jan 15, 2011 at 7:07 PM, Decipher ankurseth...@gmail.com wrote:
Can anyone help me find some questions or post some questions on
Synopsys(EDA tool-based
Can anyone help me find some questions or post some questions on
Synopsys(EDA tool-based company) for Software Engineer profile ? Or did
anyone had an interview with them ? It is visiting our college in few weeks
for campus recruitment . I will be thankful if anyone could give some
suggestions
Problem D: Numbered Grid
A grid of size N rows and M columns is filled with numbers, one in
each cell. You start at the centre of the cell at the top-left corner
(1,1) and your destination is the centre of the cell at the bottom-
right corner(N,M). In each step, you are only allowed to move to
its a dp prob...
--
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
algogeeks+unsubscr...@googlegroups.com.
For more options, visit
I am trying to solve this problem, got some idea but am not
clear...please give your input...
http://www.codechef.com/problems/MONEY
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
http://userweb.cs.utexas.edu/users/moore/best-ideas/mjrty/index.html
_Asit
On Wed, Sep 22, 2010 at 9:12 AM, pre pre.la...@gmail.com wrote:
Hi all,
pls help me solve this problem..
Design an algorithm to find the majority element of an array..
majority element must be an element tht has the
Use majority vote algorithm:
http://userweb.cs.utexas.edu/~moore/best-ideas/mjrty/index.html
On Wed, Sep 22, 2010 at 9:12 AM, pre pre.la...@gmail.com wrote:
Hi all,
pls help me solve this problem..
Design an algorithm to find the majority element of an array..
majority element must be an
printf(%d%d,scanf(%d%d,a b))
--
Rahul K Rai
rahulpossi...@gmail.com
--
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
output will be
2 garbage_value
scanf returns numbers of inputs taken from std input and since there should
be 2 arguments in printf according to the format, so garbage value will
print
On Wed, Sep 22, 2010 at 2:25 PM, rahul rai raikra...@gmail.com wrote:
printf(%d%d,scanf(%d%d,a b))
--
it accepts input into a,b an prints garbage value cos scanf returns the
number of values that accept nput ad in printf there is no variable from
where value is printed
On Wed, Sep 22, 2010 at 2:25 PM, rahul rai raikra...@gmail.com wrote:
printf(%d%d,scanf(%d%d,a b))
--
Rahul K Rai
@Dave: Thanks alot for enlightening us!
@Manju: ya.. you are right. The same was stated by me in the my prev
reply! :-)
On Aug 29, 10:50 pm, Manjunath Manohar manjunath.n...@gmail.com
wrote:
it is compiler dependant da..the evaluation of this kind of expressions
--
You received this message
In php it is 19.
?php
$x=5;
printf(%d,($x++ + ++$x + $x++));
?
On Aug 28, 1:35 pm, jagadish jagadish1...@gmail.com wrote:
I ran this code..
int main() { int x=5;
printf(%d,(x++ + ++x + x++));
}
The output printed was 18 instead of 19.. Should it not be 19?
--
You received this message
Ya after some reading i got to know that it was implementation
dependent..
And that the answer is undefined!
On Aug 28, 5:07 pm, Chi c...@linuxdna.com wrote:
In php it is 19.
?php
$x=5;
printf(%d,($x++ + ++$x + $x++));
?
On Aug 28, 1:35 pm, jagadish jagadish1...@gmail.com wrote:
I ran
Your code violates the C standard, which says:
Between the previous and next sequence point an object shall have its
stored value modified at most once by the evaluation of an expression.
Furthermore, the prior value shall be read only to determine the value
to be stored.
Regarding postfix
can anyone suggest me lectures / videos for BASICS of BITS manipulation?
thanks in advance
Rahul K Rai
rahulpossi...@gmail.com
--
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.
http://graphics.stanford.edu/~seander/bithacks.html
http://graphics.stanford.edu/~seander/bithacks.htmlit has all that you
need.
On Sat, Aug 14, 2010 at 7:53 PM, rahul rai raikra...@gmail.com wrote:
can anyone suggest me lectures / videos for BASICS of BITS manipulation?
thanks in advance
Thanks a lot , it's a life saver , i will work it out fully .
2010/8/14, Asit Baran Das asitbaran@gmail.com:
http://graphics.stanford.edu/~seander/bithacks.html
http://graphics.stanford.edu/~seander/bithacks.htmlit has all that you
need.
On Sat, Aug 14, 2010 at 7:53 PM, rahul rai
@ashish cant u make use of char *p[30] for 2 d array
On Wed, Jul 7, 2010 at 9:34 AM, Ashish Goel ashg...@gmail.com wrote:
char name[][10] is a auto variable on stack, so no pointers here
Best Regards
Ashish Goel
Think positive and find fuel in failure
+919985813081
+919966006652
Hey anyone doing topcoder srm 375, please help me out in medium
question, question is..
Rabbits often feel lonely, so one group of rabbits decided to gather
together and play a game. The game is played on a horizontal row of N
cells (N = 2), numbered 0 to N - 1 from left to right. Each cell is
can you specify the question name or link of question on topcoder
--
Regards
Jitendra Kushwaha
MNNIT, Allahabad
--
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
Contest in running and you are posting the 550 points problem? Its unfair.
Ask after it gets over.
On 6 July 2010 17:30, crazysaikat crazysai...@gmail.com wrote:
Hey anyone doing topcoder srm 375, please help me out in medium
question, question is..
Rabbits often feel lonely, so one group of
char name[3][10]={jan,feb,march};
name[0],name[1],name[2] are the elements of an array 'name'.
Can we think of name as an array of pointers where each pointer is of
type char (*p)[10]?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to
char name[][10] is a auto variable on stack, so no pointers here
Best Regards
Ashish Goel
Think positive and find fuel in failure
+919985813081
+919966006652
On Wed, Jul 7, 2010 at 9:10 AM, UMESH KUMAR kumar.umesh...@gmail.comwrote:
char name[][10]={jan,feb,march};
Name is a 2-D
This a good example of dynamic programming.
On Fri, Jun 4, 2010 at 10:15 AM, satwik krishna sathi...@gmail.com wrote:
i think the best way to trace is to draw a picture of the stack and put the
values and acc understand the flow
On Fri, Jun 4, 2010 at 7:22 AM, Prashant Kulkarni
int Max(int a[],int n)
{
int max;
if(n==1)
return a[0];
else
max=Max(a,n-1);
if(maxa[n-1])
return max;
else
return a[n-1];
}
Hi, the above is a code to find the max in an array recursively. I
int Max(int a[],int n)
{
int max;
if(n==1) ---( 1 )
return a[0];
else
max=Max(a,n-1);
---( 2 )
if(maxa[n-1])
return max;
@Prashant: Are you saying that after the base case has been reached, only
then statements 3,4 will be executed for all the recursive calls?
On Fri, Jun 4, 2010 at 7:52 PM, Prashant Kulkarni prashant.r.k...@gmail.com
wrote:
int Max(int a[],int n)
{
int max;
if(n==1)
loop recurs with array index n,n-1,..,0 as stated in this thread.
will return Max value from array, for (n-1) upon each integer of
iteration n, upon condition present element is larger than previous
element, otherwise, it will return the previous value.
the algorithm seems to provide a
i think the best way to trace is to draw a picture of the stack and put the
values and acc understand the flow
On Fri, Jun 4, 2010 at 7:22 AM, Prashant Kulkarni prashant.r.k...@gmail.com
wrote:
int Max(int a[],int n)
{
int max;
if(n==1)
On Wed, Apr 14, 2010 at 1:22 PM, vikrant singh vikrantsing...@gmail.comwrote:
there is a problem to find first K digits of no. N^N , where N can be as
large as 10^9.
so, the algo goes like,
take fractional part(f) of Nlog10(N).
and temp=pow(10,f),
result =(long )10^k * temp.
I want to
Can anyone please solve any of the following problems? I need a
detailed solution. It is my data structure assignment, and i have to
submit it by the 4th of april. Please someone help me... its urgent.
Show that if an edge(u,v)is contained in some MST, then it is a light
edge crossing some cut
GOOD ONE-
Data Structures , Algorithms and Applications in C++ by Sartaj Sahani
On Feb 7, 1:58 pm, Atul Aggarwal [EMAIL PROTECTED] wrote:
Hello Everybody,
I am beginner in Algorithms. Which book I should prefer for understanding
basic algos? Also tell me some good book for graph Theory and
corman for algorithms
On 2/9/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
GOOD ONE-
Data Structures , Algorithms and Applications in C++ by Sartaj Sahani
On Feb 7, 1:58 pm, Atul Aggarwal [EMAIL PROTECTED] wrote:
Hello Everybody,
I am beginner in Algorithms. Which book I should
I can vouch for 'algorithm design' by Jon Klienberg if CLR becomes a bit
heavy.
On Feb 7, 2008 11:13 PM, dor [EMAIL PROTECTED] wrote:
I used Cormen as an intro to algorithms (Thomas H. Cormen, Charles E.
Leiserson, Ronald L. Rivest, and Cliff Stein, Introduction to
Algorithms 2nd edition,
I used Cormen as an intro to algorithms (Thomas H. Cormen, Charles E.
Leiserson, Ronald L. Rivest, and Cliff Stein, Introduction to
Algorithms 2nd edition, published by MIT Press and McGraw-Hill).
On Feb 7, 1:58 pm, Atul Aggarwal [EMAIL PROTECTED] wrote:
Hello Everybody,
I am beginner in
Hi
I need to find x that will minimize Ax-b=0, under the inequality
constraints Cxd.
Actually the constraints in my problem are only upper and lower bounds
to x values.
x is 4x1 vector, A is about 100x4 (and b is of course 100x1(.
What is the appropriate algorithm?
Is there any C / C++ code
Series-parallel graphs may be recognized in linear time and their
series-parallel decomposition may be constructed in linear time as
well. See en.wikipedia.org/wiki/Series-parallel_graph. Reference 3 in
that article may be what you are looking for.
Dave
On Nov 14, 5:31 am, fpalamariu [EMAIL
201 - 300 of 330 matches
Mail list logo