Re: [algogeeks] output help

2011-08-09 Thread dinesh bansal
On a little-endian machine, bit structure will be represented as: 0x00 00 00 45 which is bit.bit4 = 0010 (2 in decimal) bit.bit3 = 0010 (2 in decimal) bit.bit1 = 1 (1 in decimal) since bit.bit1 exists at the rightmost position, while displaying data as integer, compiler just repeats the same

Re: [algogeeks] output help

2011-08-09 Thread SANDEEP CHUGH
i dnt get it.. any better explanation.. On Tue, Aug 9, 2011 at 1:13 PM, dinesh bansal bansal...@gmail.com wrote: On a little-endian machine, bit structure will be represented as: 0x00 00 00 45 which is bit.bit4 = 0010 (2 in decimal) bit.bit3 = 0010 (2 in decimal) bit.bit1 = 1 (1 in

[algogeeks] Preprocessor Help !!

2011-08-09 Thread Decipher
Q1) How to find factorial of a number at pre-processor stage only ? Q2) In C++ NULL is defined as* #define NULL 0* while in C it is defined as *#define NULL (void *) 0 . *What difference it makes ? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

Re: [algogeeks] Preprocessor Help !!

2011-08-09 Thread Amol Sharma
http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1047589067id=1043284376 -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad On Tue, Aug 9, 2011 at 10:20 PM, Decipher ankurseth...@gmail.com wrote: Q1) How to find factorial of a number at pre-processor

[algogeeks] pls help

2011-08-09 Thread NIKHIL
In a ternary Tree No of leaves 28. How many nodes it have? An AVL tree with height d. How many children it have? -- 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

Re: [algogeeks] pls help

2011-08-09 Thread sagar pareek
1.28+27 2.2pow(d) On Wed, Aug 10, 2011 at 12:07 AM, NIKHIL nikhil.jain.shali...@gmail.comwrote: In a ternary Tree No of leaves 28. How many nodes it have? An AVL tree with height d. How many children it have? -- You received this message because you are subscribed to the Google

Re: [algogeeks] pls help

2011-08-09 Thread sagar pareek
in ques 1 i considered leaves as nodes... if we consider only internal nodes then it have 27 On Wed, Aug 10, 2011 at 1:12 AM, sagar pareek sagarpar...@gmail.com wrote: 1.28+27 2.2pow(d) On Wed, Aug 10, 2011 at 12:07 AM, NIKHIL nikhil.jain.shali...@gmail.comwrote: In a ternary

Re: [algogeeks] pls help

2011-08-09 Thread muthu raj
pls explain how u got 27? *Muthuraj R IV th Year , ISE PESIT , Bangalore* On Wed, Aug 10, 2011 at 1:13 AM, sagar pareek sagarpar...@gmail.com wrote: in ques 1 i considered leaves as nodes... if we consider only internal nodes then it have 27 On Wed, Aug 10, 2011 at 1:12 AM, sagar pareek

Re: [algogeeks] pls help

2011-08-09 Thread Brijesh Upadhyay
I dont think 27 is the right answer,... it should be log 28 /log 3... i mean log 28 base 3 shuold be the no. of internal nodes ! and for any no of leaves , 2781, the answer would be same... -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

Re: [algogeeks] pls help

2011-08-09 Thread sagar pareek
sorry answer is not 27 its *80* just consider a binary tree 1st root has nodes 2^0=1 1st level has 2^1=2 2nd has 2^2=4 so nth level has leaves 2^n now if we have ternary tree then follow same procedure just change 3 with 2.. mean at nth level total leaves 3^n now calculate the level

Re: [algogeeks] pls help

2011-08-09 Thread Brijesh Upadhyay
80??? how can 80 internal nodes just produce only maximum of 81 leaves and that too in 3ary tree the answer is 1+3+9+27 = 40 internal nodes... think like this -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on

Re: [algogeeks] pls help

2011-08-09 Thread Brijesh Upadhyay
1 produces 3 nodes , which then 9 nodes,-- 27 nodes , and thses 27 nodes finally produces =81 leaves so sum of 27+9+3+1= 40 is the right answer... i guess -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web

Re: [algogeeks] pls help

2011-08-09 Thread Brijesh Upadhyay
General approach would be , get the no of levels first by log 28 /log 3 , = 4(use ceiling)...and now 3^0+3^1+3^2+3^3 = 40 will be no of internal nodes.. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit

Re: [algogeeks] pls help

2011-08-09 Thread sagar pareek
Oh! sorry my idea for internal nodes=leaves-1 is only for binary tree like at level 4 total leaves 2^4=32 so internal nodes=32-1=31 also can be checked as 16+8+4+2+1=31 there must be a shortcut for ternary also... by the way brijesh thanks for correcting me. so total internal nodes will be 40

[algogeeks] Recursion Help

2011-08-07 Thread Nikhil Veliath
i am having problems in writing code using recursion.any help !!...any links? -- 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] recursion help!!!

2011-08-07 Thread Nikhil Veliath
i am having problems in writing code using recursion.any help !!...any links? -- 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] recursion help!!!

2011-08-07 Thread sukran dhawan
write simple recursive routines and trace them for each program... using a stack by popping and pushing.do it for some 10 programs.u will automatically appreciate the power of recursion and learn it :) On Sun, Aug 7, 2011 at 8:03 PM, Nikhil Veliath nve...@gmail.com wrote: i am having problems

Re: [algogeeks] recursion help!!!

2011-08-07 Thread Nikhil Veliath
hey can ya give me some recursive codes wid a little explanationthnx in advance! On Sun, Aug 7, 2011 at 8:05 PM, sukran dhawan sukrandha...@gmail.com wrote: write simple recursive routines and trace them for each program... using a stack by popping and pushing.do it for some 10 programs.u

Re: [algogeeks] recursion help!!!

2011-08-07 Thread sukran dhawan
trace recursive routines for fibbonacci series , tree traversal ,gcd routines .google it for the code. On Sun, Aug 7, 2011 at 8:10 PM, Nikhil Veliath nve...@gmail.com wrote: hey can ya give me some recursive codes wid a little explanationthnx in advance! On Sun, Aug 7, 2011 at 8:05 PM,

[algogeeks] output help

2011-08-07 Thread Kamakshii Aggarwal
#includestdio.h int main() { typedef static int *i; static int j; i a = j; printf(%d, *a); getchar(); return 0; } what is the error in the code? -- Regards, Kamakshi kamakshi...@gmail.com -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

Re: [algogeeks] output help

2011-08-07 Thread Amol Sharma
using typedef u define the static keyword as int and the statement static int j thus becomes int int j hence the compiler gives the error multiple storage class in declaration specifiers -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad On Mon, Aug 8, 2011

Re: [algogeeks] output help

2011-08-07 Thread aseem garg
typedef doesn't declare an instance of a variable, it declares a type (type alias actually), static is a qualifier you apply to an instance, not a type, so you can use static when you use the type, but not when you define the type. Aseem On Mon, Aug 8, 2011 at 12:29 AM, Kamakshii Aggarwal

Re: [algogeeks] output help

2011-08-07 Thread Kamakshii Aggarwal
got it...thanks On Mon, Aug 8, 2011 at 12:39 AM, aseem garg ase.as...@gmail.com wrote: typedef doesn't declare an instance of a variable, it declares a type (type alias actually), static is a qualifier you apply to an instance, not a type, so you can use static when you use the type, but

Re: [algogeeks] pls help

2011-08-06 Thread mohit verma
what if the alphabet is {a,b,c,d} and we have to print substrings of length 2 or 3 ? On Sat, Aug 6, 2011 at 11:01 AM, Tushar Bindal tushicom...@gmail.comwrote: @gaurav didn't get this: Just to increase the size of the string by one. Then you can put any character at the the new last

Re: [algogeeks] pls help

2011-08-06 Thread mohit verma
ohh my bad... it is working fine for all cases :) On Sat, Aug 6, 2011 at 11:56 AM, mohit verma mohit89m...@gmail.com wrote: what if the alphabet is {a,b,c,d} and we have to print substrings of length 2 or 3 ? On Sat, Aug 6, 2011 at 11:01 AM, Tushar Bindal tushicom...@gmail.comwrote:

[algogeeks] pls help

2011-08-05 Thread Kamakshii Aggarwal
given a set of letters and a length N, produce all possible output.(Not permutation). For example, give the letter (p,o) and length of 3, produce the following output(in any order you want, not just my example order) ppp ppo poo pop opp opo oop ooo another example would be given (a,b) and length

Re: [algogeeks] pls help

2011-08-05 Thread Raghavan
A *trie *could help here where the number of children for each node matches the required length. On Fri, Aug 5, 2011 at 12:20 PM, Kamakshii Aggarwal kamakshi...@gmail.comwrote: given a set of letters and a length N, produce all possible output.(Not permutation). For example, give the letter

Re: [algogeeks] pls help

2011-08-05 Thread Gaurav Menghani
On Fri, Aug 5, 2011 at 12:20 PM, Kamakshii Aggarwal kamakshi...@gmail.com wrote: given a set of letters and a length N, produce all possible output.(Not permutation). For example, give the letter (p,o) and length of 3, produce the following output(in any order you want, not just my example

Re: [algogeeks] pls help

2011-08-05 Thread Kamakshii Aggarwal
@gaurav:i could not understand ur sol.can u explain it again.. On Fri, Aug 5, 2011 at 12:32 PM, Gaurav Menghani gaurav.mengh...@gmail.comwrote: On Fri, Aug 5, 2011 at 12:20 PM, Kamakshii Aggarwal kamakshi...@gmail.com wrote: given a set of letters and a length N, produce all possible

Re: [algogeeks] pls help

2011-08-05 Thread Gaurav Menghani
The basic idea is that for every position of the string, you fill it with all possible alphabets in your set of allowed alphabets, let the set be called alphabet. Now, you can do this recursively. backtrack(s,l) denotes, a string s has been formed, and is of length l. Now we need to add more

Re: [algogeeks] pls help

2011-08-05 Thread Aman Goyal
as an eg. let ab be the string, and 3 characters length string is wht is expected.. a - - b - - a a - a b - b a - b b - a a a a a b a b a a b b b a a b a b b b a b b b On Fri, Aug 5, 2011 at 12:49 PM, Gaurav Menghani gaurav.mengh...@gmail.comwrote: The basic idea is that for every

Re: [algogeeks] pls help

2011-08-05 Thread Gaurav Menghani
An Implementation: #includeiostream #includestring using namespace std; string alphabet; int maxlen; void backtrack(string s,int l) { if(l==maxlen) { coutsendl; return; } s.push_back('-'); for(int i=0;ialphabet.size();i++) { s[l]=alphabet[i]; backtrack(s,l+1); } } int main() {

Re: [algogeeks] pls help

2011-08-05 Thread Nitin Nizhawan
Or one could just simulate a counting from 0 to (numchars^N)-1 in base numchars. ... code: void printit(int N,char chars[],int index[]){ for(int i=0;iN;i++){ printf(%c,chars[index[i]]); } printf(\n); } void generate(int numchars,char chars[],int N){ int index[100]={0};

Re: [algogeeks] pls help

2011-08-05 Thread Varun Jakhoria
I think it can be done using bitwise ANDing with a mask On Fri, Aug 5, 2011 at 12:58 PM, Gaurav Menghani gaurav.mengh...@gmail.com wrote: An Implementation: #includeiostream #includestring using namespace std; string alphabet; int maxlen; void backtrack(string s,int l) {  if(l==maxlen)

Re: [algogeeks] pls help

2011-08-05 Thread Kamakshii Aggarwal
@gaurav:can u please explain what is the purpose of this line.. s.push_back('-'); On Fri, Aug 5, 2011 at 1:10 PM, Nitin Nizhawan nitin.nizha...@gmail.comwrote: Or one could just simulate a counting from 0 to (numchars^N)-1 in base numchars. ... code: void printit(int N,char chars[],int

Re: [algogeeks] pls help

2011-08-05 Thread Gaurav Menghani
Just to increase the size of the string by one. Then you can put any character at the the new last position, which is 'l'. On Fri, Aug 5, 2011 at 2:34 PM, Kamakshii Aggarwal kamakshi...@gmail.com wrote: @gaurav:can u please explain what is the purpose of this line.. s.push_back('-'); On Fri,

Re: [algogeeks] pls help

2011-08-05 Thread Gaurav Menghani
Great. On Fri, Aug 5, 2011 at 2:42 PM, Kamakshii Aggarwal kamakshi...@gmail.com wrote: @gaurav:i got it..thanks for the solution On Fri, Aug 5, 2011 at 2:34 PM, Kamakshii Aggarwal kamakshi...@gmail.com wrote: @gaurav:can u please explain what is the purpose of this line.. s.push_back('-');

Re: [algogeeks] pls help

2011-08-05 Thread Gaurav Menghani
Even if the number of elements is more than two, it is possible with bitwise operations, but it gets clumsy. Suppose your alphabet has 4 characters. You can either: - Count from 0 to (14*n)-1 and use four bits to denote the selection of the alphabet. Also, only one bit amongst those four should

Re: [algogeeks] pls help

2011-08-05 Thread Nitin Nizhawan
Ok, Thanks On Fri, Aug 5, 2011 at 2:53 PM, Gaurav Menghani gaurav.mengh...@gmail.comwrote: Even if the number of elements is more than two, it is possible with bitwise operations, but it gets clumsy. Suppose your alphabet has 4 characters. You can either: - Count from 0 to (14*n)-1 and use

Re: [algogeeks] pls help

2011-08-05 Thread Tushar Bindal
@gaurav didn't get this: Just to increase the size of the string by one. Then you can put any character at the the new last position, which is 'l'. can u pls explain that? On Fri, Aug 5, 2011 at 2:57 PM, Nitin Nizhawan nitin.nizha...@gmail.comwrote: Ok, Thanks On Fri, Aug 5, 2011 at 2:53

[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] LCS help!!!

2011-08-04 Thread Victor Manuel Grijalva Altamirano
I tried the problem 111 of ACM UVA, History Grading... http://uva.onlinejudge.org/external/1/111.html But in the case: 10 3 1 2 4 9 5 10 6 8 7 1 2 3 4 5 6 7 8 9 10 4 7 2 3 10 6 9 1 5 8 3 1 2 4 9 5 10 6 8 7 2 10 1 3 8 4 9 5 7 6 I get 6 4 10 5 And the solution it´s : 9 5 10 9 Why??? Here it´s

Re: [algogeeks] Complexity Help..

2011-08-03 Thread ankit sambyal
@Aanchal : My mistake... Its complexity can't be O(n^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

[algogeeks] plz help with this

2011-08-02 Thread Gayathri Anandan
I didnt get any output for this pgm. I think its keep on running and got struck in the 6th line. Plz help with this. 1 #includestdio.h 2 #includeconio.h 3 int max(int a[10],int s,int e) 4 { 5 int res,res1,res2,mid=(s+e-1)/2; 6 res1=max(a,s,mid+1); 7 res2=max(a,mid+1,e); 8 res=res1res2?res1:res2;

Re: [algogeeks] plz help with this

2011-08-02 Thread durgaprasad k
I think the code is running infinity times as there is no checking condition when to stop the calculation of max value. so before going to the max function there should be a checking till when you need to run the loop. Regards, Durga On Tue, Aug 2, 2011 at 2:30 PM, Gayathri Anandan

Re: [algogeeks] plz help with this

2011-08-02 Thread Prem Krishna Chettri
Well This is Certainly lacks logic behind the Coder. Please remember EVERY RECURSIVE PROGRAM Need Break for certain condition. here mid keep updating without knowing when to finish the recursion so the code never goes below line seven.. I appreciate this way of Creating LOOP although its a

[algogeeks] Complexity Help..

2011-08-02 Thread aanchal goyal
Can someone please help me with finding the complexity of below code: /*The code is of finding all possible combinations of coins (given in array, each having infinite supply) that sum upto given target value.*/ void solve(int index[], int arr[], int target, int cursum, int n, int sz) { cnt++;

Re: [algogeeks] Complexity Help..

2011-08-02 Thread aanchal goyal
really sorry for that, here is the complete code: #includeiostream using namespace std; void print(int arr[], int index[], int n) { int i=1; while(i=n) { coutarr[index[i]] ; i++; } coutendl; } void solve(int index[], int arr[], int target, int cursum, int n, int sz) {

Re: [algogeeks] Complexity Help..

2011-08-02 Thread Ravinder Kumar
Its complexity is same as of finding the all combination if a given string . it is O(n!) -- *With Regards :* Ravinder Kumar B.Tech Final Year Computer Science and Engineering MNNIT Allahabad -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group.

Re: [algogeeks] Complexity Help..

2011-08-02 Thread aanchal goyal
Can we prove this?? On Wed, Aug 3, 2011 at 1:45 AM, Ravinder Kumar ravinde...@gmail.com wrote: Its complexity is same as of finding the all combination if a given string . it is O(n!) -- *With Regards :* Ravinder Kumar B.Tech Final Year Computer Science and Engineering MNNIT

Re: [algogeeks] Complexity Help..

2011-08-02 Thread aanchal goyal
I was asked a similar question in an interview, and the interviwer told me that it is O(n^2), I have no idea how he got that!! On Wed, Aug 3, 2011 at 1:47 AM, aanchal goyal goyal.aanch...@gmail.comwrote: Can we prove this?? On Wed, Aug 3, 2011 at 1:45 AM, Ravinder Kumar

Re: [algogeeks] Complexity Help..

2011-08-02 Thread Ravinder Kumar
My mistake .I only saw the program flow which is similar to permutation . Its DP similar to 0,1 knapsack Complexity is O(nc) where c is size of knapsack and n is number different of items -- *With Regards :* Ravinder Kumar B.Tech Final Year Computer Science and Engineering MNNIT

Re: [algogeeks] Complexity Help..

2011-08-02 Thread aanchal goyal
But this is not dp rite? I know knapsack problem, it has 2 nested for loops, thats why it is O(nc). And also, here we have infinite supply of each item. And we want all possible ways of getting the sum, not just one way. Here, function is recursively called, like a dfs is performed here... So,

Re: [algogeeks] Complexity Help..

2011-08-02 Thread Ravinder Kumar
it depends on target sum . Size of index array is depends on target sum . Try to dry run it you will get hint . -- 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

Re: [algogeeks] Complexity Help..

2011-08-02 Thread ankit sambyal
@Ravinder : Its not a DP problem.. If it was, where are the sub problems reused or in other words, where is memoization ?? @Anchal : Its complexity is O(n^2). Look at the following segment in ur code : for(int i=index[n];isz;i++) { index[n+1]=i;

Re: [algogeeks] Complexity Help..

2011-08-02 Thread aanchal goyal
let sum=45 int arr[]={1,2,3,4,5}; /*43545 times the function solve is called*/ /*2611 ways of achieving the sum (2611 ways will be printed)*/ if, int arr[]={1,3,10,30,75}; /*2931 times the function solve is called*/ /*53 ways of

Re: [algogeeks] Complexity Help..

2011-08-02 Thread aanchal goyal
@ Ankit Sambyal, please explain me why is it O(n^2) taking into account what the number of times solve is called (in my example above.) On Wed, Aug 3, 2011 at 10:36 AM, aanchal goyal goyal.aanch...@gmail.comwrote: let sum=45 int arr[]={1,2,3,4,5}; /*43545 times the function solve is called*/

Re: [algogeeks] Complexity Help..

2011-08-02 Thread aanchal goyal
sorry, *target=45*, not sum. sum=0 when we call the function the first time. On Wed, Aug 3, 2011 at 10:39 AM, aanchal goyal goyal.aanch...@gmail.comwrote: @ Ankit Sambyal, please explain me why is it O(n^2) taking into account what the number of times solve is called (in my example above.)

Re: [algogeeks] Complexity Help..

2011-08-02 Thread Nitin Nizhawan
Running time can be found by solving this recursion. T(sz,target) = SUM {1=i=sz} T(i,target-1) T(sz,0) = c I think it is around O(sz^target) Thanks Nitin On Wed, Aug 3, 2011 at 10:40 AM, aanchal goyal goyal.aanch...@gmail.comwrote: sorry, *target=45*, not sum. sum=0 when we call the function

[algogeeks] need help

2011-08-01 Thread coder dumca
hi frnds can any body tell me how a student can appear for amazon or microsoft , if these comanies are not coming to the campus. -- 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.

Re: [algogeeks] need help

2011-08-01 Thread Rajeev Kumar
go to this link and upload ur resume...they will call if they feel it is good http://www.india.amazon.com/Careers/ http://www.india.amazon.com/Careers/ On Mon, Aug 1, 2011 at 11:58 PM, coder dumca coder.du...@gmail.com wrote: hi frnds can any body tell me how a student can appear for amazon

[algogeeks] Any help on bits?

2011-07-31 Thread Nikhil Gupta
Given two integers A B. Determine how many bits required to convert A to B. Write a function int BitSwapReqd(int A, int B); -- Nikhil Gupta -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

Re: [algogeeks] Any help on bits?

2011-07-31 Thread prateek gupta
C= A^B then count number of bits set in C. On Sun, Jul 31, 2011 at 5:52 PM, Nikhil Gupta nikhilgupta2...@gmail.comwrote: Given two integers A B. Determine how many bits required to convert A to B. Write a function int BitSwapReqd(int A, int B); -- Nikhil Gupta -- You received this

Re: [algogeeks] Any help on bits?

2011-07-31 Thread Abhishek Gupta
int BitSwap(int A,int B) { int num=A^B; int count=0; while(num!=0) { num=num(num-1); count++; } return count; } this will run in O(m) where m is no. of ON bits (1's). is there any other optimal solution for finding no. of 1's in a number? On Sun, Jul 31, 2011 at

Re: [algogeeks] Any help on bits?

2011-07-31 Thread Surya Prakash
can any one please explain me the question clearly with an examplei'm not geting it! thanx in advance! -- 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

Re: [algogeeks] Any help on bits?

2011-07-31 Thread Amol Sharma
compare bits of the number one by one and and count how many are different print the count.. correct if i am wrong !! -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad On Sun, Jul 31, 2011 at 6:29 PM, Surya Prakash suryaprakash...@gmail.comwrote: can

Re: [algogeeks] Any help on bits?

2011-07-31 Thread Surya Prakash
we can just apply xor operation rightit's more easier!! -- 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] Any help on bits?

2011-07-31 Thread Nikhil Gupta
@Surya, ^ operator mean XOR operation. On Sun, Jul 31, 2011 at 6:41 PM, Surya Prakash suryaprakash...@gmail.comwrote: we can just apply xor operation rightit's more easier!! -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to

Re: [algogeeks] Any help on bits?

2011-07-31 Thread Amol Sharma
yupxor would do the required task eaisly !! -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad On Sun, Jul 31, 2011 at 6:42 PM, Nikhil Gupta nikhilgupta2...@gmail.comwrote: @Surya, ^ operator mean XOR operation. On Sun, Jul 31, 2011 at 6:41 PM, Surya

Re: [algogeeks] Any help on bits?

2011-07-31 Thread Kamakshii Aggarwal
@what kind of operations can be applied to 'A'? On Sun, Jul 31, 2011 at 6:54 PM, Amol Sharma amolsharm...@gmail.com wrote: yupxor would do the required task eaisly !! -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad On Sun, Jul 31, 2011 at 6:42

Re: [algogeeks] Any help on bits?

2011-07-31 Thread Ankit Minglani
@Kamakshi : any kind of operation can be used .. Exactly XORing the bits should do the trick .. and we can then count the number of 1s in the answer to know how many bits are different . This is like the Hamming distance used in Hamming code in Networks . On Sun, Jul 31, 2011 at 8:37 AM,

[algogeeks] Output Help.

2011-07-30 Thread aseem garg
int b=2;b=b++; b=??? Plz explain.. Aseem -- 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.

Re: [algogeeks] Output Help.

2011-07-30 Thread Kamakshii Aggarwal
3.it is same as b=b+1; On Sun, Jul 31, 2011 at 1:32 AM, aseem garg ase.as...@gmail.com wrote: int b=2;b=b++; b=??? Plz explain.. Aseem -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

Re: [algogeeks] Output Help.

2011-07-30 Thread aseem garg
@Kamakshi: Run karke dekh leti pehle. :-/ Aseem On Sun, Jul 31, 2011 at 1:34 AM, Kamakshii Aggarwal kamakshi...@gmail.comwrote: 3.it is same as b=b+1; On Sun, Jul 31, 2011 at 1:32 AM, aseem garg ase.as...@gmail.com wrote: int b=2;b=b++; b=??? Plz explain.. Aseem -- You received

Re: [algogeeks] Output Help.

2011-07-30 Thread aditi garg
it would be undefined... On Sun, Jul 31, 2011 at 1:34 AM, Kamakshii Aggarwal kamakshi...@gmail.comwrote: 3.it is same as b=b+1; On Sun, Jul 31, 2011 at 1:32 AM, aseem garg ase.as...@gmail.com wrote: int b=2;b=b++; b=??? Plz explain.. Aseem -- You received this message because you

Re: [algogeeks] Output Help.

2011-07-30 Thread Kamakshii Aggarwal
oh sorry,mane galat pad lia..mane sirf b++ dekha... it is compiler dependent.value of b is changing twice b/w two serial points On Sun, Jul 31, 2011 at 1:37 AM, aseem garg ase.as...@gmail.com wrote: @Kamakshi: Run karke dekh leti pehle. :-/ Aseem On Sun, Jul 31, 2011 at 1:34 AM, Kamakshii

Re: [algogeeks] Output Help.

2011-07-30 Thread aseem garg
@Aditi: Run karke dekh leti pehle. :-/ Aseem On Sun, Jul 31, 2011 at 1:38 AM, aditi garg aditi.garg.6...@gmail.comwrote: it would be undefined... On Sun, Jul 31, 2011 at 1:34 AM, Kamakshii Aggarwal kamakshi...@gmail.com wrote: 3.it is same as b=b+1; On Sun, Jul 31, 2011 at 1:32 AM,

Re: [algogeeks] Output Help.

2011-07-30 Thread vaibhav shukla
concept of sequence points.search wiki On Sun, Jul 31, 2011 at 1:38 AM, aditi garg aditi.garg.6...@gmail.comwrote: it would be undefined... On Sun, Jul 31, 2011 at 1:34 AM, Kamakshii Aggarwal kamakshi...@gmail.com wrote: 3.it is same as b=b+1; On Sun, Jul 31, 2011 at 1:32 AM, aseem

Re: [algogeeks] Output Help.

2011-07-30 Thread Amol Sharma
@aseem output is 3 only...check it once again http://ideone.com/mWGc5 -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad On Sun, Jul 31, 2011 at 1:37 AM, aseem garg ase.as...@gmail.com wrote: @Kamakshi: Run karke dekh leti pehle. :-/ Aseem On Sun,

Re: [algogeeks] Output Help.

2011-07-30 Thread vidushi
@aseem its 3 different on yours ? On Sun, Jul 31, 2011 at 1:37 AM, aseem garg ase.as...@gmail.com wrote: @Kamakshi: Run karke dekh leti pehle. :-/ Aseem On Sun, Jul 31, 2011 at 1:34 AM, Kamakshii Aggarwal kamakshi...@gmail.com wrote: 3.it is same as b=b+1; On Sun, Jul 31, 2011 at

Re: [algogeeks] Output Help.

2011-07-30 Thread Neeraj Gupta
Yes, it's UB. For such ques, try to run it on ideone. It will give a warning if any operation is not standard. http://ideone.com/bJBGl http://ideone.com/bJBGl On Sun, Jul 31, 2011 at 1:38 AM, aditi garg aditi.garg.6...@gmail.comwrote: it would be undefined... On Sun, Jul 31, 2011 at 1:34

Re: [algogeeks] Output Help.

2011-07-30 Thread aseem garg
I am getting 2. . Aseem On Sun, Jul 31, 2011 at 1:41 AM, Neeraj Gupta neeraj.gupta...@gmail.comwrote: Yes, it's UB. For such ques, try to run it on ideone. It will give a warning if any operation is not standard. http://ideone.com/bJBGl http://ideone.com/bJBGl On Sun, Jul 31, 2011 at

Re: [algogeeks] Output Help.

2011-07-30 Thread aseem garg
On Dev CPP. Aseem On Sun, Jul 31, 2011 at 1:42 AM, aseem garg ase.as...@gmail.com wrote: I am getting 2. . Aseem On Sun, Jul 31, 2011 at 1:41 AM, Neeraj Gupta neeraj.gupta...@gmail.comwrote: Yes, it's UB. For such ques, try to run it on ideone. It will give a warning if any

Re: [algogeeks] Output Help.

2011-07-30 Thread Amol Sharma
yup it is undefined and the warning is justified b=b++ will assign 2 to b then increment b hence 3 is printed -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad On Sun, Jul 31, 2011 at 1:41 AM, Neeraj Gupta neeraj.gupta...@gmail.comwrote: Yes, it's UB. For

Re: [algogeeks] Output Help.

2011-07-30 Thread Sanchit Manchanda
I am getting b=2. Maybe coz we are assigning 2 to b then incrementing b. But still acc to me it should be 3. :-\ No warnings in dev cpp. On Sun, Jul 31, 2011 at 1:43 AM, Amol Sharma amolsharm...@gmail.com wrote: yup it is undefined and the warning is justified b=b++ will assign 2 to b then

Re: [algogeeks] Output Help.

2011-07-30 Thread Kamakshii Aggarwal
@sanchit:it is undefined.. On Sun, Jul 31, 2011 at 1:47 AM, Sanchit Manchanda sanchit...@gmail.comwrote: I am getting b=2. Maybe coz we are assigning 2 to b then incrementing b. But still acc to me it should be 3. :-\ No warnings in dev cpp. On Sun, Jul 31, 2011 at 1:43 AM, Amol Sharma

Re: [algogeeks] Output Help.

2011-07-30 Thread Sanchit Manchanda
I dint get any error, not even warning. it might depend from compiler to compiler. but yeah it should be undefined. On Sun, Jul 31, 2011 at 1:49 AM, Kamakshii Aggarwal kamakshi...@gmail.comwrote: @sanchit:it is undefined.. On Sun, Jul 31, 2011 at 1:47 AM, Sanchit Manchanda

Re: [algogeeks] Output Help.

2011-07-30 Thread gaurav gupta
bt y it sud b undefind? On Sun, Jul 31, 2011 at 1:51 AM, Sanchit Manchanda sanchit...@gmail.comwrote: I dint get any error, not even warning. it might depend from compiler to compiler. but yeah it should be undefined. On Sun, Jul 31, 2011 at 1:49 AM, Kamakshii Aggarwal kamakshi...@gmail.com

Re: [algogeeks] Output Help.

2011-07-30 Thread Kamakshii Aggarwal
@gaurav:refer the link below http://c-faq.com/expr/seqpoints.html On Sun, Jul 31, 2011 at 1:53 AM, gaurav gupta grvgupta...@gmail.com wrote: bt y it sud b undefind? On Sun, Jul 31, 2011 at 1:51 AM, Sanchit Manchanda sanchit...@gmail.comwrote: I dint get any error, not even warning. it

Re: [algogeeks] Output Help.

2011-07-30 Thread gaurav gupta
thanx kamakshi On Sun, Jul 31, 2011 at 1:56 AM, Kamakshii Aggarwal kamakshi...@gmail.comwrote: @gaurav:refer the link below http://c-faq.com/expr/seqpoints.html On Sun, Jul 31, 2011 at 1:53 AM, gaurav gupta grvgupta...@gmail.comwrote: bt y it sud b undefind? On Sun, Jul 31, 2011 at

[algogeeks] please help

2011-07-26 Thread coder coder
Write a program to find the index in an circular array such that the string that is formed starting from that index is first in lexicographic order. on all the sites the code part is misunderstood for the test case ABCDEAABCCDA -- You received this message because you are subscribed to the

Re: [algogeeks] please help

2011-07-26 Thread sukhmeet singh
provide a sample i/p output..!! On Tue, Jul 26, 2011 at 11:43 PM, coder coder i.code.program...@gmail.comwrote: Write a program to find the index in an circular array such that the string that is formed starting from that index is first in lexicographic order. on all the sites the code part

[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] CLRS help

2011-07-04 Thread Anantha Krishnan
CLRS Exercises 32.2-2 How would you extend the Rabin-Karp method to the problem of searching a text string for an occurrence of any one of a given set of k patterns? Start by assuming that all k patterns have the same length. Then generalize your solution to allow the patterns to have different

[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

<    1   2   3   4   >