Hi Vicky.. Its O(n^K) as u are iterating over all the elements of array for
each of the k element subset!!
On Monday, 8 October 2012 23:53:15 UTC+5:30, ((** VICKY **)) wrote:
>
> Hi, I wrote code for generating all possible sets of length k in a array
> of length n. I did using recursion, but i'
Looks pretty standard. It starts by placing one queen on each square of the
bottom row, then working up through the
rows trying to put a queen in each column. If it can place a queen it gets
added as a possible solution.
The always test in the inner loop checks the 'rook' horizontal and then the
guys its my sincere request to all .. before posting any question plz plz do
search for archives first . if you would had done that you could have got
better knowledge .
On Wed, Oct 5, 2011 at 9:14 PM, raman shukla wrote:
> Hey mate dont worry there is nothing like pattern, You should be able
>
Hey mate dont worry there is nothing like pattern, You should be able
to think little logical and write normal JAVA programs like
implementation of different sorting algorithm in java and finding
regular expression in text file. This is only required, no need to
panic. All the best.
On Oct 5, 5:31
Quantitative Aptitude by R.S.Agarwal.
On Tue, Sep 13, 2011 at 2:12 PM, DIVIJ WADHAWAN wrote:
> Try material of MBA coaching institutes wiz Career Launcher,Time
> etc
>
> On Sep 12, 6:11 pm, wellwisher wrote:
> > please suggest me some good aptitude books
>
> --
> You received this message b
Try material of MBA coaching institutes wiz Career Launcher,Time
etc
On Sep 12, 6:11 pm, wellwisher wrote:
> please suggest me some good aptitude books
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to
thank you Shashank & navneet
- Samba
On Thu, Aug 4, 2011 at 3:24 AM, Navneet wrote:
> bit twiddling hacks, a stanford resource.
>
> http://graphics.stanford.edu/~seander/bithacks.html
>
> On Aug 4, 10:55 am, Shashank Jain wrote:
> > even this is a gud 1.
> http://www.cprogramming.com/tutorial/
bit twiddling hacks, a stanford resource.
http://graphics.stanford.edu/~seander/bithacks.html
On Aug 4, 10:55 am, Shashank Jain wrote:
> even this is a gud
> 1.http://www.cprogramming.com/tutorial/bitwise_operators.html
>
> Shashank Jain
> IIIrd year
> Computer Engineering
> Delhi College of En
@sunny how did you arrive at the bit wise operation thing1
--
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.
Hey anyone Pl help... its clearly written code and algo u know vry
well so it wont take much time :)
On Jul 5, 8:43 pm, KK wrote:
> This is the solution to the MST problem
> m getting WA again n again... cant figure out where's the mistake...
> so plzzz help!!!https://www.spoj.pl/problems
Evenly divisible simply means that a number should be completely divisible
by the given numbers, i.e., it should give a whole number as an answer when
divided by that particular number. Evenly divisible doesn't mean that
quotient should be an even number. It just needs to be a whole number.
Probabl
@ tushar just one modification to you code would make the things
correct.makin if (a % 2*prime[b] == 0) inspite of if (a % prime[b]
== 0) would take care of even things
hope i am correct..
thanx! for the reply
On Jul 5, 10:47 pm, Tushar Bindal wrote:
> If my interpretation is right, following
@ tushar
as per your interpretation this looks coreect...but i am not saying to
exclude all no's which are divisible by first 5 prime no ..question
says to exclude those no which are evenly divisible by first 5 prime
no..
On Jul 5, 10:47 pm, Tushar Bindal wrote:
> If my interpretation is right, f
yeah.. i got acc. I don't get avidullu's solution
--
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...@googlegrou
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 wrote:
> i was actually trying this problem..
>
> www.spoj.pl/problems/LQDCANDY
>
> I'm getting WA still..
>
>
> #include
> #include
> int cnt;
> inline int fi
i was actually trying this problem..
www.spoj.pl/problems/LQDCANDY
I'm getting WA still..
#include
#include
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(rope>l)
rope-=l;
retu
@avi dullu: explanation of your code plz..
On Jul 3, 3:57 am, Avi Dullu wrote:
> Another alternative soln.
>
> int rec_cut(int l, int k) {
> if (l == k) return 0;
> int tmp = k - (l>>1);
> return 1 + rec_cut(l>>1, tmp <= 0 ? k : tmp);
>
> }
>
> int main() {
> int l, k;
> scanf("%d%d", &
@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(rope>l)
rope =rope-l;
return
@mohit: nice soln :)
On Jul 2, 2:50 pm, mohit goel 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);
>
@sameer: thank you
On Jul 2, 3:47 pm, "sameer.mut...@gmail.com"
wrote:
> n&n-1 is the expression to find out if n is a power of 2...If n&n-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 wrote:
>
>
>
>
>
>
>
> >
Another alternative soln.
int rec_cut(int l, int k) {
if (l == k) return 0;
int tmp = k - (l>>1);
return 1 + rec_cut(l>>1, 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:
@sunny thnx for the correction.
On Sat, Jul 2, 2011 at 9:16 AM, varun pahwa wrote:
> @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:
>
>> n&n-1 is the expression to find out if n is a power of 2.
@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:
> n&n-1 is the expression to find out if n is a power of 2...If n&n-1
> returns 0 its a power of 2 else its not.
> And what sunny said is also ryt
>
>
n&n-1 is the expression to find out if n is a power of 2...If n&n-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 wrote:
> @cegprakash
> Expression resets the least significant set bit
>
>
> On Sat, Jul 2, 2011 at 3:20
@cegprakash
Expression resets the least significant set bit
On Sat, Jul 2, 2011 at 3:20 PM, mohit goel 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);
>
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)
{
if(l=
no no.. it should be multiple of 2 less than n? even that doesn't
satisfies for 4&3
On Jul 2, 2:41 pm, cegprakash wrote:
> power of 2 less than n right?
>
> On Jul 2, 2:38 pm, cegprakash wrote:
>
> > @ sunny
>
> > 2&1 is 0
> > 3&2 is 2
> > 4&3 is 0
> > 5 &4 is 4
> > 6&5 is 4
>
> > I don't find a
power of 2 less than n right?
On Jul 2, 2:38 pm, cegprakash wrote:
> @ sunny
>
> 2&1 is 0
> 3&2 is 2
> 4&3 is 0
> 5 &4 is 4
> 6&5 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 ema
@ sunny
2&1 is 0
3&2 is 2
4&3 is 0
5 &4 is 4
6&5 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
algo
@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
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 one
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 wrote:
> btw what N = N-(N&(N-1)) does actually
>
> On Jul 2, 2:11 pm, sunny agrawal wrote:
> >
btw what N = N-(N&(N-1)) does actually
On Jul 2, 2:11 pm, sunny agrawal 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);
>
> i-j will
awesome!! thank you so much :)
On Jul 2, 2:11 pm, sunny agrawal 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);
>
> i-j will be t
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 wrote:
> oh fine.. got it now.. set bi
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
@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
algogeeks+unsubscr...@googlegrou
why ?
On Sat, Jul 2, 2011 at 2:20 PM, cegprakash 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 unsubscribe from
@ 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
@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
algogeeks+unsubscr...@go
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 +
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 wrote:
> yes i have written that only
> difference between indexes of first set bit and last set bit
>
> On
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 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 wrote:
> > xor t
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 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 answer !!
>
>
>
> On Sat,
@varun
I think u want to write
while (k % m == 0)
On Sat, Jul 2, 2011 at 1:56 PM, varun pahwa 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 initially m = 2;
> after 1st iteration m =
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 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 initially m = 2;
>
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 wrote:
> nope
>
> On Jul 2, 1:14 pm, keyan karthi wrote:
> > yup :)
> >
> > On Sat, Jul 2, 2011 at 1:38 PM, Shal
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 wrote:
> nope
nope
On Jul 2, 1:14 pm, keyan karthi wrote:
> yup :)
>
> On Sat, Jul 2, 2011 at 1:38 PM, Shalini Sah
> > 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 PM, cegprakash wrote:
>
> >> the length of the
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
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.
/* S
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 ar
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
#include
#include
#include
#include
#include
using namespace std;
int prime(int
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 w
@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
wrote:
> it is compiler dependant da..the evaluation of this kind of expressions
--
You received this message because you are subscribe
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 incr
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 wrote:
> In php it is 19.
>
> $x=5;
> printf("%d",($x++ + ++$x + $x++));
> ?>
>
> On Aug 28, 1:35 pm, jagadish wrote:
>
> > I ran this code..
>
> > int main() {
In php it is 19.
On Aug 28, 1:35 pm, jagadish 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 because you are subscribed to the Google Groups
"Algorit
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
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 The
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 editi
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 i
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 PRO
I am not sure of a solution for this, but ain't this an NP-complete problem?
On 6/19/07, ihinayana <[EMAIL PROTECTED]> wrote:
>
>
> Description:
> Given a group of rectangles with different integer width and
> height,such as 5*4, 2*3,1*7,etc. The total number of rectangles is
> like 10 or more.The
On May 28, 6:21 pm, sl7fat <[EMAIL PROTECTED]> wrote:
> hi i have an algorthim code and i have to find the time complixcity of
> the code so can you plz help me ASAP the code is written done ,,
> # include
>
> void main()
> {
>
> int a[10][4]=
> {{ 16,17,19,13},
> {18,14,1
thanx for ur help :D
On May 28, 5:22 pm, Satya <[EMAIL PROTECTED]> wrote:
> since your input is of fixed size, your algorithm always runs in
> constant time. If the # of students and # of courses are variable, the
> algorithm is O(n^2).
>
> satya.
>
> On 5/28/07, sl7fat <[EMAIL PROTECTED]> wrote:
since your input is of fixed size, your algorithm always runs in
constant time. If the # of students and # of courses are variable, the
algorithm is O(n^2).
satya.
On 5/28/07, sl7fat <[EMAIL PROTECTED]> wrote:
>
> hi i have an algorthim code and i have to find the time complixcity of
> the code
On 3/15/07, Ravi <[EMAIL PROTECTED]> wrote:
>
> what will be a regular expression(non-UNIX one please) for the set of
> languages which have number of 0s divisible by 5 and number of 1s
> divisible by 2. The set of alphabets is {0,1}.
>
The following is based on `Parallel Regular Expressions'. If
If the DFA works then it can be converted to a regular expression
using standard techniques like the one described in
http://www.cs.colostate.edu/~whitley/CS301/L3.pdf
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
A DFA is possible I guess which is interesting, see if the following
DFA works, since the existence of the DFA relates to the existence of
a Regular Expression Describing the language
State/Input 01
q00 q10 q01
q10 q20
I think a regular expression is just too hard, a CFG might be easier . Let
me know if you have a solution for regular expression
On 3/14/07, Ravi <[EMAIL PROTECTED]> wrote:
>
>
> what will be a regular expression(non-UNIXone please) for the set of
> languages which have number of 0s divisible by 5
1. u should calculate the k variable, that is
if i+j=3 (i=1, j=2, or vice versa) then k=3
if i+j=4 (i=1, j=3, or vice versa) then k=2
if i+j=5 (i=2, j=3, or vice versa) then k=1
2. the last question give the answer to the last 2:
T(m) = 1 if n = 1
2*T(m - 1) + 1 if n > 1
is the reccurence relati
Hi
there are plenty of websites that fetch you data and i feel that everything is just a click away.So just choose books if you want else just start learning via tutorials.
All the best.
Sriram.N
On 7/9/06, hosseingt <[EMAIL PROTECTED]> wrote:
hii'm a begginer.can anyone guide me how to s
hi frnz...
i'm very glad to c this site..
i'm a beginner can anyone suggest me a good book for DATA
STRUCTURES..., presently i'm practicing C++.
i'm very much thankful to u, if u do this...
--~--~-~--~~~---~--~~
You received this message because you are sub
There is a lot of detail available on-line. If you google "Dictionary
of Algorithms and Data Structures", and visit there, you'll be amazed
at the depth of the info.
A good book (not too hard, but something that covers the basics), is a
great asset to have. Perhaps someone here can recommend a go
Maybe I'm wrong, ^_^
On 6/23/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Did I misunderstand the problem, or you did?He is asking the number of bricks that can be placed in a NxM board.
all the configurations you showed have 8 bricks.
--~--~-~--~~~---~--~~
You
Did I misunderstand the problem, or you did?
He is asking the number of bricks that can be placed in a NxM board.
all the configurations you showed have 8 bricks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"A
On 6/23/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
If M >= N and M >= K, then the solution isN * (M/K) + (M - M/K*K) * (N/K)Use integer division
This solution is not corrent.
for example, M = N = 4, K = 2
N * (M/K) + (M - M/K*K) * (N/K) = 4 * ( 4 / 2 ) + ( 4 - 4 / 2 * 2 ) * ( 4 / 2 ) =
If M >= N and M >= K, then the solution is
N * (M/K) + (M - M/K*K) * (N/K)
Use integer division
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algogeek
Norbert wrote:
> I'm unable to solve this problem correctly. Please help me:
>
> You have chess board of size N x M and a lot of bricks of size K x 1.
> How many bricks can you place on this board (brick edges must be
> pallarel to board edges)
>
> Thanks for help
Chessboards are always perfectl
I've encountered the 8*8 and 1*2 version of this problem. The number of feasible placement is much greater than you expected, because very brick has two direction(vertical and horizontal).
One way to solve this N*M and 1*2 version problem is DP, which is fast. But the general problem is too compl
Letters are just numbers bigger than 10:
??
??
qv
qv
qv
qv
wg
wg
wg
wg
0-9, a, b, c, d, e, h, k, n, o, p, q, v, w, g: 10 + 14 = 24
On 6/17/06, prashant bhargava <[EMAIL PROTECTED]> wrote:
> Could u plz explain how u
Could u plz explain how u r getting the answer 24 (for ur 2nd reply) ?? I really didn't understand.plz explainOn 6/17/06, Norbert <
[EMAIL PROTECTED]> wrote:There's another example if you use floating point arithmetic. N = 10,
M = 10, K = 4. Correct answer is 24, not 25On 6/17/06, Norbert <[EMAIL P
There's another example if you use floating point arithmetic. N = 10,
M = 10, K = 4. Correct answer is 24, not 25
On 6/17/06, Norbert <[EMAIL PROTECTED]> wrote:
> Sorry, you're wrong. Consider board of size N = 1, M = 5 and K = 2.
> If you round down (N/K) then you have RESULT = 0. If you round u
Sorry, you're wrong. Consider board of size N = 1, M = 5 and K = 2.
If you round down (N/K) then you have RESULT = 0. If you round up then
you have 5. Also wrong.
On 6/17/06, prashant bhargava <[EMAIL PROTECTED]> wrote:
> if the question is complete then the answer shd' be (N/K) * M bricks
>
> am
if the question is complete then the answer shd' be (N/K) * M bricksam i right??On 6/17/06, Norbert <
[EMAIL PROTECTED]> wrote:I'm unable to solve this problem correctly. Please help me:
You have chess board of size N x M and a lot of bricks of size K x 1.How many bricks can you place on this board
// 10017 The Never Ending Towers of Hanoi
#include
#include
//#include
using namespace std;
vector Pegs[3];
int last_move, cur_move;
//ofstream cout("output.txt");
void Move(int source, int destination)
{
Pegs[destination].push_back(*(Pegs[source].end() - 1));
Pegs[source].er
The answer to the first question is 2. When you take the modulus of a
negative number, think of it as rounding down to a multiple of the
divisor and taking the remainder. If you round down -22 to a multiple
of 3, you get -24, and the difference between -22 and -24 is 2, your
remainder.
I'm not
Thanks for the reply , but i still can't make this work.1. The 1st method i guess would have heavy space requirement,(I'm really trying to improve this method so the i would work for n>15).2. Undoing the queens isn't the problem, but undoing the changes in the domains of unvisited variables is wha
A simple way is to store the state in a temporary object before modifying it and doing the recursive call again.
Other way is since you know which queen you just place before the
recursive call. Just undo that queen. All other further queens will
also be undone when their recursive calls end. I th
90 matches
Mail list logo