[algogeeks] Re: Help me find my Recursive algo complexity

2012-10-10 Thread KK
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'm

[algogeeks] Re: Help woth LISP

2012-07-09 Thread Geoffrey Summerhayes
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

Re: [algogeeks] Re: Help sourcebit !!!

2011-10-06 Thread aditya kumar
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 shukla.rama...@gmail.comwrote: Hey mate dont worry there is nothing like

[algogeeks] Re: Help sourcebit !!!

2011-10-05 Thread raman shukla
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,

[algogeeks] Re: help

2011-09-13 Thread DIVIJ WADHAWAN
Try material of MBA coaching institutes wiz Career Launcher,Time etc On Sep 12, 6:11 pm, wellwisher p9047551...@gmail.com 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

Re: [algogeeks] Re: help

2011-09-13 Thread mithun bs
Quantitative Aptitude by R.S.Agarwal. On Tue, Sep 13, 2011 at 2:12 PM, DIVIJ WADHAWAN divij...@gmail.com wrote: Try material of MBA coaching institutes wiz Career Launcher,Time etc On Sep 12, 6:11 pm, wellwisher p9047551...@gmail.com wrote: please suggest me some good aptitude books

[algogeeks] Re: Help on Recursion Bit Operators related problems

2011-08-04 Thread Navneet
bit twiddling hacks, a stanford resource. http://graphics.stanford.edu/~seander/bithacks.html On Aug 4, 10:55 am, Shashank Jain shashan...@gmail.com wrote: even this is a gud 1.http://www.cprogramming.com/tutorial/bitwise_operators.html Shashank Jain IIIrd year Computer Engineering Delhi

Re: [algogeeks] Re: Help on Recursion Bit Operators related problems

2011-08-04 Thread Samba Ganapavarapu
thank you Shashank navneet - Samba On Thu, Aug 4, 2011 at 3:24 AM, Navneet navneetn...@gmail.com wrote: bit twiddling hacks, a stanford resource. http://graphics.stanford.edu/~seander/bithacks.html On Aug 4, 10:55 am, Shashank Jain shashan...@gmail.com wrote: even this is a gud 1.

[algogeeks] Re: help..

2011-07-14 Thread rj7
@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

Re: [algogeeks] Re: help to code

2011-07-06 Thread Tushar Bindal
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.

[algogeeks] Re: Help!!

2011-07-06 Thread KK
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 kunalkapadi...@gmail.com wrote: This is the solution to the MST problem m getting WA again n again... cant figure out where's the mistake... so plzzz

[algogeeks] Re: help to code

2011-07-05 Thread shiv narayan
@ 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 tushicom...@gmail.com wrote: If my

[algogeeks] Re: help to code

2011-07-05 Thread shiv narayan
@ 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 tushicom...@gmail.com wrote: If my

[algogeeks] Re: help..

2011-07-03 Thread cegprakash
@sameer: thank you On Jul 2, 3:47 pm, 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, Jul 2, 2011 at 3:47 PM, sunny agrawal

[algogeeks] Re: help..

2011-07-03 Thread cegprakash
@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);

[algogeeks] Re: help..

2011-07-03 Thread cegprakash
@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

[algogeeks] Re: help..

2011-07-03 Thread cegprakash
@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,

[algogeeks] Re: help..

2011-07-03 Thread cegprakash
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)

Re: [algogeeks] Re: help..

2011-07-03 Thread saurabh singh
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

[algogeeks] Re: help..

2011-07-02 Thread cegprakash
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

[algogeeks] Re: help..

2011-07-02 Thread cegprakash
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

Re: [algogeeks] Re: help..

2011-07-02 Thread varun pahwa
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

Re: [algogeeks] Re: help..

2011-07-02 Thread sunny agrawal
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 :)

[algogeeks] Re: help..

2011-07-02 Thread cegprakash
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

Re: [algogeeks] Re: help..

2011-07-02 Thread sunny agrawal
@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

[algogeeks] Re: help..

2011-07-02 Thread cegprakash
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

Re: [algogeeks] Re: help..

2011-07-02 Thread sunny agrawal
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

Re: [algogeeks] Re: help..

2011-07-02 Thread 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

[algogeeks] Re: help..

2011-07-02 Thread cegprakash
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+

[algogeeks] Re: help..

2011-07-02 Thread cegprakash
@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] Re: help..

2011-07-02 Thread cegprakash
@ 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

Re: [algogeeks] Re: help..

2011-07-02 Thread sunny agrawal
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

[algogeeks] Re: help..

2011-07-02 Thread cegprakash
@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] Re: help..

2011-07-02 Thread cegprakash
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

Re: [algogeeks] Re: help..

2011-07-02 Thread sunny agrawal
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..

[algogeeks] Re: help..

2011-07-02 Thread cegprakash
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);

[algogeeks] Re: help..

2011-07-02 Thread cegprakash
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);

Re: [algogeeks] Re: help..

2011-07-02 Thread sunny agrawal
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

Re: [algogeeks] Re: help..

2011-07-02 Thread 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

Re: [algogeeks] Re: help..

2011-07-02 Thread santosh mahto
@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

[algogeeks] Re: help..

2011-07-02 Thread cegprakash
@ 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

[algogeeks] Re: help..

2011-07-02 Thread cegprakash
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,

[algogeeks] Re: help..

2011-07-02 Thread cegprakash
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

Re: [algogeeks] Re: help..

2011-07-02 Thread mohit goel
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) {

Re: [algogeeks] Re: help..

2011-07-02 Thread sunny agrawal
@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;

Re: [algogeeks] Re: help..

2011-07-02 Thread sameer.mut...@gmail.com
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

Re: [algogeeks] Re: help..

2011-07-02 Thread varun pahwa
@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,

Re: [algogeeks] Re: help..

2011-07-02 Thread varun pahwa
@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

Re: [algogeeks] Re: help..

2011-07-02 Thread Avi Dullu
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,

[algogeeks] Re: Help

2011-02-15 Thread Don
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

[algogeeks] Re: help me debug this

2011-01-17 Thread juver++
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

Re: [algogeeks] Re: help me debug this

2011-01-17 Thread ankit sablok
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

Re: [algogeeks] Re: help me debug this

2011-01-17 Thread juver++
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

[algogeeks] Re: Help with Increment Operators in C!

2010-08-29 Thread jagadish
@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

[algogeeks] Re: Help with Increment Operators in C!

2010-08-28 Thread Chi
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

[algogeeks] Re: Help with Increment Operators in C!

2010-08-28 Thread jagadish
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

[algogeeks] Re: Help with Increment Operators in C!

2010-08-28 Thread Dave
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

[algogeeks] Re: Help

2008-02-09 Thread [EMAIL PROTECTED]
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

[algogeeks] Re: Help

2008-02-09 Thread gurbinder dhillon
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

[algogeeks] Re: Help

2008-02-08 Thread subhojit ban
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,

[algogeeks] Re: Help

2008-02-07 Thread dor
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

[algogeeks] Re: help with serie-parallel recognition algorithm

2007-11-14 Thread Dave
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

[algogeeks] Re: Help! - rectangle packing problem

2007-06-20 Thread Ramaswamy R
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

[algogeeks] Re: help me with finding the time complexcity

2007-05-29 Thread BiGYaN
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 iostream.h void main() { int a[10][4]= {{ 16,17,19,13},

[algogeeks] Re: help me with finding the time complexcity

2007-05-28 Thread Satya
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 so

[algogeeks] Re: help me with finding the time complexcity

2007-05-28 Thread sl7fat
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:

[algogeeks] Re: help making regular expression

2007-03-15 Thread Pradeep Muthukrishnan
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 and

[algogeeks] Re: help making regular expression

2007-03-15 Thread Karthik Singaram L
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

[algogeeks] Re: help making regular expression

2007-03-15 Thread Karthik Singaram L
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

[algogeeks] Re: help making regular expression

2007-03-15 Thread Rajiv Mathews
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 I

[algogeeks] Re: help =/

2006-10-08 Thread Spiritus
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

[algogeeks] Re: help

2006-07-24 Thread gupta
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

[algogeeks] Re: help

2006-07-24 Thread Sriram Narasimhan
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 start in

[algogeeks] Re: help

2006-07-09 Thread adak
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

[algogeeks] Re: Help me with this problem

2006-06-22 Thread adak
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 perfectly

[algogeeks] Re: Help me with this problem

2006-06-22 Thread [EMAIL PROTECTED]
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

[algogeeks] Re: Help me with this problem

2006-06-22 Thread Feng
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 ) = 8

[algogeeks] Re: Help me with this problem

2006-06-17 Thread prashant bhargava
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

[algogeeks] Re: Help me with this problem

2006-06-17 Thread Norbert
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 i

[algogeeks] Re: Help me with this problem

2006-06-17 Thread Norbert
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 up

[algogeeks] Re: Help me with this problem

2006-06-17 Thread prashant bhargava
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

[algogeeks] Re: Help on modular arithmetic

2006-04-26 Thread Mikey
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