Re: [algogeeks] Re: Some adobe interview questions.
Q10. array a[]={19 16 18 3 50 70 12 11 14} array b[]; sum required=30 3 11 12 14 16 18 19 50 70 //sort 0 1 2 3 4 5 6 7 8 //index lr count=0,i=0; while(lr) { if(a[l]+a[r])sum r--; elseif(a[l]+a[r])sum l++; else { count++; b[i++]=a[l]; b[i++]=a[r]; } } now b(1,2) carries sum=30 1st time b(3,4) carries sum=30 2nd time...and so on if b[] is empty then sum doesnt exist. On Thu, Jul 7, 2011 at 9:51 AM, Navneet Gupta navneetn...@gmail.com wrote: Anyone for Q10, i wonder if it can really be solved in O(n). Very obvious O(nlogn) is what I know On Thu, Jul 7, 2011 at 1:25 AM, KK kunalkapadi...@gmail.com wrote: for Q5 change the expr into postfix and then build expression tree... but is expression tree same as parse tree?? correct me if i m wrong!! -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards, Navneet -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Some adobe interview questions.
thanks yogi. it is amzing tric and 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...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Some adobe interview questions.
Q3. start with 7000 //8 digit number 7000 7001 //as 7 is 1 time so 8th place is 1 6001 //as due to 1 on 8th place no. of zeros =6 6010 //as 6 is present so 7th place is 1 and 7 is not present so 8th place is again changed to 0 6110 //as 1 is present on 7th place so at 2nd place there should be 1 5110 //as 2nd place is 1 so 0 count remains 5 now 51000100 //as 5 is present so 6th place is 1 and 6 is not present so 7th place is again changed to 0 52000100 //as count of 1 becomes 2 above 52100100 //as 2 is present on 1st place so 3rd place is 1 42100100 // count of 0 remains 4 so 1st place is 4 42101000 // as 4 is present so 5th place is 1 and 5 is not present so 6th place is again changed to 0 On Thu, Jul 7, 2011 at 8:24 PM, raj singh ankurkaku...@gmail.com wrote: thanks yogi. it is amzing tric and 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...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: Some adobe interview questions.
very nice link for questions of type Q9. http://pw1.netcom.com/~tjensen/ptr/ch9x.htm -- 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/-/0ngOncUXrRYJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: Some adobe interview questions.
Q1. First sort both the strings using counting sort perhaps. Then starting from the first character, search for it in the second string using binary search. The succeeding character of A will be searched from the index in B at which last character of A was found Worst case: When both the strings are alike : O(log(m) + log(m-1) + log(m-2) ...log(1)) = O(m*log(m)) But Average case will be quite efficient Abhishek Khattri, Computer Engineering, Netaji Subhas Institute of Technology -- 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/-/vo0EQrVjxBUJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: Some adobe interview questions.
Sol for Q4 int pallindrome(char *str) { static length = strlen(str); if(length 1) return 1; if(str[0] == str[length-1]) { length -= 2; return pallindrome(str+1); } else return 0; } -- 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/-/WwBB4MUlTWMJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: Some adobe interview questions.
Yes I am also getting the same. On Jul 5, 12:50 am, Ritesh Srivastava riteshkumar...@gmail.com wrote: For Q3 . Sum of all the digits should be 8. I think , 42101000 is an answer. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: Some adobe interview questions.
what about 7? 7 occurred once right? On Jul 6, 12:32 am, aditya kumar aditya.kumar130...@gmail.com wrote: in 7000 : '0' occurs seven times and rst of the numbers occur zero times. i still dint get where i am wrong . plz explain me . On Wed, Jul 6, 2011 at 12:47 AM, L prnk.bhatna...@gmail.com wrote: @aditya : I am wondering how many times 7 has occurred. Is it 1? Or is it 0? Please take a moment before posting your solution, and think whether it is write or wrong! On Jul 6, 12:11 am, aditya kumar aditya.kumar130...@gmail.com wrote: Q3. ans:7000 i guess this is also a correct answer and no unique soln as such On Wed, Jul 6, 2011 at 12:37 AM, aditya kumar aditya.kumar130...@gmail.comwrote: boolean palindromeCheck(String string) { len=string.length(); if((string.length()1)) { if((string.charAt(0)==string.charAt(len-1))) { str=; str=str+string.substring(1,(len-1)); palindromeCheck(str); } else { flag=false; } } return flag; } THis also works fine if you dont want to use pointer On Tue, Jul 5, 2011 at 9:37 PM, Azhar Hussain azhar...@gmail.com wrote: For Q4: I think this is the optimal code int recurPalin(char *start, char *end) { if (end start) return true; if (*start != *end) return false; return recurPalin(start+1, end-1); } - Azhar. On Tue, Jul 5, 2011 at 12:21 PM, vikas mehta...@gmail.com wrote: My program for Q4. // recursively find if a given string is palindrome bool IsPalindrome(string s, int start, int start2, bool flag) { bool flag1 = flag; if (start = 0 start2 (s.Length)) { char c1 = s[start]; char c2 = s[start2]; if (c1.Equals(c2)) { if (start == 0 start2 == s.Length - 1) { flag = true; } if (IsPalindrome(s, start - 1, start2 + 1, flag)) { flag1 = true; } } } return flag1; } while calling if (s.Length % 2 != 0) { p.IsPalindrome(s, s.Length / 2 - 1, s.Length / 2 + 1, false); } else { p.IsPalindrome(s, s.Length / 2 - 1, s.Length / 2, false); } -- 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/-/I6SVTB0o-uUJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Some adobe interview questions.
You have given solution for number of coins required for different sum as explained on topcoder tutorial. But I think the question has put forward some conditions based on which it asks us to find the denominations of the 6 coins. You have taken the sum given(which cannot be obtained by using coins we have) in the problem as denominations. I think you have interpreted it erongly. Just hope my interpretation is correct :) On Tue, Jul 5, 2011 at 5:25 PM, Azhar Hussain azhar...@gmail.com wrote: What I understood from the statement is what is the 'minimum denomination' required for a given value. I will try to explain it in short we can solve the problem as sub-problems Lets say you want a denomination for some sum S and 'i' be the previous sum so i = S. If we can find the sum at i we can find the sum for i+1 using i as our reference. For example S= 15. What is the minimum denomination required using the coins 5, 10 from the statement above I cannot calculate sums other than multiples of 5. So, I will write down sums which are multiples of 5 upto 15. 0 5 10 15 Inorder to calculate denominations for 15. I must have calculate denominations of 15, 5, 0 Goal: First 0, this does not require coins so coins are 0. Sum 5, we have found the solution yet for this mark it as infinity. We see that there is only one coin in the denomination pool which is less than this sum. Sum 10, If I can take the previous sum 10 - 5, I will end up having 2 coins but the best solution would be denomination of 10 i.e., 1 coin. I compare the denominations value and the previous sum and store the minimum value. Sum 15, From the previous step 1 coin for 10 and 5 denomination will make up the sum so number of coins are 2. this can be recursively defined as if ((N[j] = i) ((Min[i-N[j]] + 1) Min[i])) Min[i] = Min[i-N[j]] + 1; Where N is the denominations i is the Previous Sum denoted as Min j is the index of denomination sum[1,, 15] = infinity; for sum 0 i = 0; N[0] = 5 and 5 = is false sum remains 0, so Sum[0] = 0. for Sum 5 i = 5 ; N[0] = 5 and 5 = 5 true and (Sum[5-5] + 1) Sum[5] update the sum[5] = sum[5-5] + 1; + 1 because including N[j] coin makes the sum do the same for remaining sums. can be represented mathematically like this *C*(*N*,*m*) = *C*(*N*,*m* - 1) + *C*(*N* - *S**m*,*m*) Or This is the least I can say. M(j) = Minimum number of coins required to make change for amount of money j. M(j) = Min { M( j - vi ) } + 1; i complexity O(n^S) for the Sum S. - Azhar. - Azhar. On Tue, Jul 5, 2011 at 4:37 PM, Dumanshu duman...@gmail.com wrote: @Azhar: could u plz explain the q8. problem. On Jul 5, 12:13 pm, Azhar Hussain azhar...@gmail.com wrote: Q8 is a DP problem, here is the solution #include stdio.h #define MAX 125 #define VAL 6 int Min[MAX]; int N[VAL] = {5, 10, 20, 25, 50, 100}; int main(void) { int i, j; for (i = 1; i MAX; i++) Min[i] = 100; for (i = 5; i MAX; i += 5) for (j = 0; j VAL; j++) if ((N[j] = i) ((Min[i-N[j]] + 1) Min[i])) Min[i] = Min[i-N[j]] + 1; fprintf(stderr, \n***\n); for (i = 0; i MAX; i += 5) fprintf(stderr, %d = %d\n, i, Min[i]); return 0; } OUTPUT: *** 0 = 0 5 = 1 10 = 1 15 = 2 20 = 1 25 = 1 30 = 2 35 = 2 40 = 2 45 = 2 50 = 1 55 = 2 60 = 2 65 = 3 70 = 2 75 = 2 80 = 3 85 = 3 90 = 3 95 = 3 100 = 1 105 = 2 110 = 2 115 = 3 120 = 2 more information can be found athttp:// www.topcoder.com/tc?module=Staticd1=tutorialsd2=dynProg - Azhar. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Tushar Bindal Computer Engineering Delhi College of Engineering Mob: +919818442705 E-Mail : tushicom...@gmail.com Website: www.jugadengg.com -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: Some adobe interview questions.
On Jul 5, 4:04 am, Dumanshu duman...@gmail.com wrote: ans1. use counting sort for character array (0 to 255) then check for the second string if same or not. ans2. send 1 and 2, 1 comes back, send 10 and 5, 2 comes back, send 2 and 1 ans3. As vikas said, sum of digits should b 8. In that case the number must have a zero digit because 1st digit the no. of zeroes can't be zero then. right? print all the combinations. need help on this. ans4. a function with string, first index, last index as arguments and return true or false. increment first index and decrement last index for recursive call. ans5. I have no idea. may b we can take help of shunting algorithm. but there ought to be an easier way to do this. Do we have to WAP a general one for these expressions??? ans6. allocate same number of bytes for the reversed string. now traverse the original string from the back. as soon as u encounter a space say at position x or you come to 0 index, call the current = function (x+1,current) or current = function(0,current). this function copies the original string from position x+1 to (while(space or null)) in reversed string at position current and returns current + no. of characters copied. ans8. somebody plz explain this. do we have to find the values for a,b,c,d,e,f so that we can get return change for 100,50,25,10,5? 10, 5,5,20,25,50... how to get change for 5 then? ans9. lets say we have to allocate 100*200 i.e. rows 100 and columns 200 int **a = (int **)malloc(sizeof(int *)*100); a[0] = (int *)malloc(sizeof(int)*100*200); for(i=1;i100;i++) a[i] = (a[i-1]+200); I think this will be better approach: Let's say the array is 100*100 int (*a)[100]; a = (int (*)[100])malloc(sizeof(int)*100*100); ans10. use hashtables, first traversal get true for all values present. then second traversal, check if (X- arr[i]) is present in hashtable, if yes print. Here I see one problem in it, if the numbers are negative then we cannot hash into directly, we need a modified hash function in this case.here we will have to add maximum negative number(in magnitude) to X-arr[i]. ans11. i think ans to this one is 1 byte. because some information is stored.. may be. m nt sure :P ans12. typedef struct node * NODE; NODE sortlist(NODE head,int n) { if(n==1) return head; if(!n) return null; NODE temp =head; for(int i=0;in\2;i++)temp=temp-next; return merge(sortlist(head,n/2),sortlist(temp,n/2 + (n%2));); } NODE merge(NODE t1,NODE t2) { NODE head=NULL,temp=NULL; int set =0; while(t1 t2) { if(t1-data t2-data) { if(!set){head=t1;temp = head;set=1;t1=t1-next;} else { temp-next = t1; t1=t1-next;} } else { if(!set){head=t2;temp = head;set=1;t2=t2-next;} else { temp-next = t2; t2=t2-next; } } while(t1) { temp-next = t1; t1 = t1-next;} while(t2) { temp-next = t2; t2 = t2-next;} temp-next = NULL; return head; } did i miss any case? On Jul 5, 11:24 am, vikas mehta...@gmail.com wrote: These all were asked cumulatively in five interviews, one after another. Q1 given 2 string A ,B. write a code to find all character of A exists in B or not? Q2. A puzzle athttp://mathforum.org/library/drmath/view/56756.html Q3. Find a 8-digit number, where the first figure defines the count of zeros in this number, the second figure the count of numeral 1 in this number and so on Q4. write a recursive function to find a given string is palindrome or not? Q5. write a code to generate the parse tree like compilers do internally for any given expression e.g. a+(b+c*(e/f)+d)*g Q6. 3 reverse the string word by word e.g. My name is pradeep .. o/p shd be pradeep is name My ...intwer expecting a 1 traversal algo Q7. C++ (What are virtual functions) what happened if I do Base *d = new Derived(); and Derived *d = new Base(); is it error(in which statement) or not if yes what type of error? Q8. you have 6 coins of Indian denomination (a+b+c+d+e+f=115 paisa) ...if user ask for a change of 100,50,25,10,5 paisa then you r not able to give find the value of a,b,c,d,e,f.e.g. lets if user ask for a change of 25 paisa then you r not able to return (10+10+5) or (20+5) Q9. allocate 2D array dynamically with min no. of malloc calls. Q10. given unsorted array and a no. X ,find 2 no. whose sum is Xa[i]+a[j]=X ...do it in O(n) Q11. class A {}; A obj ; what is sizeof(obj)explain ANS Q12. Write a code of Merge sort on Linked list. Lets discuss them -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: Some adobe interview questions.
For Q1: if length1!=length2 = false else take 2 arrays ch1[256] and ch2[256] For every character c in each string increment the element ch[c] in the respective array; now traverse both arrays together. if each ch1[] element =each ch2[] element = true else =false __ Ankit Chaudhary Computer Engineering Netaji Subhas Institute of Technology On Jul 6, 3:50 pm, Abhi abhi123khat...@gmail.com wrote: Q1.First sort both the strings using counting sort perhaps. Then starting from the first character, search for it in the second string using binary search.The succeeding character of A will be searched from the index in B at which last character of A was found Worst case: When both the strings are alike : O(log(m) + log(m-1) + log(m-2) ...log(1)) = O(m*log(m)) But Average case will be quite efficient Abhishek Khattri, Computer Engineering, Netaji Subhas Institute of Technology -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: Some adobe interview questions.
for Q5 change the expr into postfix and then build expression tree... but is expression tree same as parse tree?? correct me if i m wrong!! -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Some adobe interview questions.
Anyone for Q10, i wonder if it can really be solved in O(n). Very obvious O(nlogn) is what I know On Thu, Jul 7, 2011 at 1:25 AM, KK kunalkapadi...@gmail.com wrote: for Q5 change the expr into postfix and then build expression tree... but is expression tree same as parse tree?? correct me if i m wrong!! -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards, Navneet -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: Some adobe interview questions.
My program for Q4. // recursively find if a given string is palindrome bool IsPalindrome(string s, int start, int start2, bool flag) { bool flag1 = flag; if (start = 0 start2 (s.Length)) { char c1 = s[start]; char c2 = s[start2]; if (c1.Equals(c2)) { if (start == 0 start2 == s.Length - 1) { flag = true; } if (IsPalindrome(s, start - 1, start2 + 1, flag)) { flag1 = true; } } } return flag1; } while calling if (s.Length % 2 != 0) { p.IsPalindrome(s, s.Length / 2 - 1, s.Length / 2 + 1, false); } else { p.IsPalindrome(s, s.Length / 2 - 1, s.Length / 2, false); } -- 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/-/I6SVTB0o-uUJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Some adobe interview questions.
Q8 is a DP problem, here is the solution #include stdio.h #define MAX 125 #define VAL 6 int Min[MAX]; int N[VAL] = {5, 10, 20, 25, 50, 100}; int main(void) { int i, j; for (i = 1; i MAX; i++) Min[i] = 100; for (i = 5; i MAX; i += 5) for (j = 0; j VAL; j++) if ((N[j] = i) ((Min[i-N[j]] + 1) Min[i])) Min[i] = Min[i-N[j]] + 1; fprintf(stderr, \n***\n); for (i = 0; i MAX; i += 5) fprintf(stderr, %d = %d\n, i, Min[i]); return 0; } OUTPUT: *** 0 = 0 5 = 1 10 = 1 15 = 2 20 = 1 25 = 1 30 = 2 35 = 2 40 = 2 45 = 2 50 = 1 55 = 2 60 = 2 65 = 3 70 = 2 75 = 2 80 = 3 85 = 3 90 = 3 95 = 3 100 = 1 105 = 2 110 = 2 115 = 3 120 = 2 more information can be found at http://www.topcoder.com/tc?module=Staticd1=tutorialsd2=dynProg - Azhar. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Some adobe interview questions.
don't give programs.. discuss the logic behind that, algorithms are important.. On Tue, Jul 5, 2011 at 12:43 PM, Azhar Hussain azhar...@gmail.com wrote: Q8 is a DP problem, here is the solution #include stdio.h #define MAX 125 #define VAL 6 int Min[MAX]; int N[VAL] = {5, 10, 20, 25, 50, 100}; int main(void) { int i, j; for (i = 1; i MAX; i++) Min[i] = 100; for (i = 5; i MAX; i += 5) for (j = 0; j VAL; j++) if ((N[j] = i) ((Min[i-N[j]] + 1) Min[i])) Min[i] = Min[i-N[j]] + 1; fprintf(stderr, \n***\n); for (i = 0; i MAX; i += 5) fprintf(stderr, %d = %d\n, i, Min[i]); return 0; } OUTPUT: *** 0 = 0 5 = 1 10 = 1 15 = 2 20 = 1 25 = 1 30 = 2 35 = 2 40 = 2 45 = 2 50 = 1 55 = 2 60 = 2 65 = 3 70 = 2 75 = 2 80 = 3 85 = 3 90 = 3 95 = 3 100 = 1 105 = 2 110 = 2 115 = 3 120 = 2 more information can be found at http://www.topcoder.com/tc?module=Staticd1=tutorialsd2=dynProg - Azhar. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Some adobe interview questions.
Q-8: 50,25,10,10,10,10 Q2-: Let A,B,C and D are the persons suct tat A takes 1min, B-2, C-5 and D-10 * A and B go across 2 minutes A goes back with light 1 minute C and D go across 10 minutes B goes back with light 2 minute A and B go across 2 minutes --- Total 17 minutes * -- Regards UDIT DU- MCA -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Some adobe interview questions.
q2.: Basically u must put 10min and 5 min together to save time. also, during return path-u must have some1 with less time already there. that's it ! On Tue, Jul 5, 2011 at 1:00 PM, udit sharma sharmaudit...@gmail.com wrote: Q-8: 50,25,10,10,10,10 Q2-: Let A,B,C and D are the persons suct tat A takes 1min, B-2, C-5 and D-10 * A and B go across 2 minutes A goes back with light 1 minute C and D go across 10 minutes B goes back with light 2 minute A and B go across 2 minutes --- Total 17 minutes * -- Regards UDIT DU- MCA -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: Some adobe interview questions.
I think that for Q3 answer will be unique and will be same as pointed out by Ritesh. On Jul 5, 1:11 pm, vikas mehta...@gmail.com wrote: Sum of all the digits should be 8 But it was not said by the interviewer i think we must print all possible combinations for the question -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: Some adobe interview questions.
ans1. use counting sort for character array (0 to 255) then check for the second string if same or not. ans2. send 1 and 2, 1 comes back, send 10 and 5, 2 comes back, send 2 and 1 ans3. As vikas said, sum of digits should b 8. In that case the number must have a zero digit because 1st digit the no. of zeroes can't be zero then. right? print all the combinations. need help on this. ans4. a function with string, first index, last index as arguments and return true or false. increment first index and decrement last index for recursive call. ans5. I have no idea. may b we can take help of shunting algorithm. but there ought to be an easier way to do this. Do we have to WAP a general one for these expressions??? ans6. allocate same number of bytes for the reversed string. now traverse the original string from the back. as soon as u encounter a space say at position x or you come to 0 index, call thecurrent = function (x+1,current) or current = function(0,current). this function copies the original string from position x+1 to (while(space or null)) in reversed string at position current and returns current + no. of characters copied. ans8. somebody plz explain this. do we have to find the values for a,b,c,d,e,f so that we can get return change for 100,50,25,10,5? 10, 5,5,20,25,50... how to get change for 5 then? ans9. lets say we have to allocate 100*200 i.e. rows 100 and columns 200 int **a = (int **)malloc(sizeof(int *)*100); a[0] = (int *)malloc(sizeof(int)*100*200); for(i=1;i100;i++) a[i] = (a[i-1]+200); ans10. use hashtables, first traversal get true for all values present. then second traversal, check if (X- arr[i]) is present in hashtable, if yes print. ans11. i think ans to this one is 1 byte. because some information is stored.. may be. m nt sure :P ans12. typedef struct node * NODE; NODE sortlist(NODE head,int n) { if(n==1) return head; if(!n) return null; NODE temp =head; for(int i=0;in\2;i++)temp=temp-next; return merge(sortlist(head,n/2),sortlist(temp,n/2 + (n%2));); } NODE merge(NODE t1,NODE t2) { NODE head=NULL,temp=NULL; int set =0; while(t1 t2) { if(t1-data t2-data) { if(!set){head=t1;temp = head;set=1;t1=t1-next;} else { temp-next = t1; t1=t1-next; } } else { if(!set){head=t2;temp = head;set=1;t2=t2-next;} else { temp-next = t2; t2=t2-next; } } while(t1) { temp-next = t1; t1 = t1-next; } while(t2) { temp-next = t2; t2 = t2-next; } temp-next = NULL; return head; } did i miss any case? On Jul 5, 11:24 am, vikas mehta...@gmail.com wrote: These all were asked cumulatively in five interviews, one after another. Q1 given 2 string A ,B. write a code to find all character of A exists in B or not? Q2. A puzzle athttp://mathforum.org/library/drmath/view/56756.html Q3. Find a 8-digit number, where the first figure defines the count of zeros in this number, the second figure the count of numeral 1 in this number and so on Q4. write a recursive function to find a given string is palindrome or not? Q5. write a code to generate the parse tree like compilers do internally for any given expression e.g. a+(b+c*(e/f)+d)*g Q6. 3 reverse the string word by word e.g. My name is pradeep .. o/p shd be pradeep is name My ...intwer expecting a 1 traversal algo Q7. C++ (What are virtual functions) what happened if I do Base *d = new Derived(); and Derived *d = new Base(); is it error(in which statement) or not if yes what type of error? Q8. you have 6 coins of Indian denomination (a+b+c+d+e+f=115 paisa) ...if user ask for a change of 100,50,25,10,5 paisa then you r not able to give find the value of a,b,c,d,e,f.e.g. lets if user ask for a change of 25 paisa then you r not able to return (10+10+5) or (20+5) Q9. allocate 2D array dynamically with min no. of malloc calls. Q10. given unsorted array and a no. X ,find 2 no. whose sum is Xa[i]+a[j]=X ...do it in O(n) Q11. class A {}; A obj ; what is sizeof(obj)explain ANS Q12. Write a code of Merge sort on Linked list. Lets discuss them -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: Some adobe interview questions.
@Azhar: could u plz explain the q8. problem. On Jul 5, 12:13 pm, Azhar Hussain azhar...@gmail.com wrote: Q8 is a DP problem, here is the solution #include stdio.h #define MAX 125 #define VAL 6 int Min[MAX]; int N[VAL] = {5, 10, 20, 25, 50, 100}; int main(void) { int i, j; for (i = 1; i MAX; i++) Min[i] = 100; for (i = 5; i MAX; i += 5) for (j = 0; j VAL; j++) if ((N[j] = i) ((Min[i-N[j]] + 1) Min[i])) Min[i] = Min[i-N[j]] + 1; fprintf(stderr, \n***\n); for (i = 0; i MAX; i += 5) fprintf(stderr, %d = %d\n, i, Min[i]); return 0; } OUTPUT: *** 0 = 0 5 = 1 10 = 1 15 = 2 20 = 1 25 = 1 30 = 2 35 = 2 40 = 2 45 = 2 50 = 1 55 = 2 60 = 2 65 = 3 70 = 2 75 = 2 80 = 3 85 = 3 90 = 3 95 = 3 100 = 1 105 = 2 110 = 2 115 = 3 120 = 2 more information can be found athttp://www.topcoder.com/tc?module=Staticd1=tutorialsd2=dynProg - Azhar. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Some adobe interview questions.
well for question 6 I think calculating size of string will count as one traversal? Correct me if I am wrong? My approach: traverse storing each char in a string.when space encountered push the string in stack I am not sure how my solution is but it doesnt appears gud ryt now. On Tue, Jul 5, 2011 4:34 PM, Dumanshu duman...@gmail.com wrote: ans1. use counting sort for character array (0 to 255) then check for the second string if same or not. ans2. send 1 and 2, 1 comes back, send 10 and 5, 2 comes back, send 2 and 1 ans3. As vikas said, sum of digits should b 8. In that case the number must have a zero digit because 1st digit the no. of zeroes can't be zero then. right? print all the combinations. need help on this. ans4. a function with string, first index, last index as arguments and return true or false. increment first index and decrement last index for recursive call. ans5. I have no idea. may b we can take help of shunting algorithm. but there ought to be an easier way to do this. Do we have to WAP a general one for these expressions??? ans6. allocate same number of bytes for the reversed string. now traverse the original string from the back. as soon as u encounter a space say at position x or you come to 0 index, call thecurrent = function (x+1,current) or current = function(0,current). this function copies the original string from position x+1 to (while(space or null)) in reversed string at position current and returns current + no. of characters copied. ans8. somebody plz explain this. do we have to find the values for a,b,c,d,e,f so that we can get return change for 100,50,25,10,5? 10, 5,5,20,25,50... how to get change for 5 then? ans9. lets say we have to allocate 100*200 i.e. rows 100 and columns 200 int **a = (int **)malloc(sizeof(int *)*100); a[0] = (int *)malloc(sizeof(int)*100*200); for(i=1;i100;i++) a[i] = (a[i-1]+200); ans10. use hashtables, first traversal get true for all values present. then second traversal, check if (X- arr[i]) is present in hashtable, if yes print. ans11. i think ans to this one is 1 byte. because some information is stored.. may be. m nt sure :P ans12. typedef struct node * NODE; NODE sortlist(NODE head,int n) { if(n==1) return head; if(!n) return null; NODE temp =head; for(int i=0;in\2;i++)temp=temp-next; return merge(sortlist(head,n/2),sortlist(temp,n/2 + (n%2));); } NODE merge(NODE t1,NODE t2) { NODE head=NULL,temp=NULL; int set =0; while(t1 t2) { if(t1-data t2-data) { if(!set){head=t1;temp = head;set=1;t1=t1-next;} else { temp-next = t1; t1=t1-next; } } else { if(!set){head=t2;temp = head;set=1;t2=t2-next;} else { temp-next = t2; t2=t2-next; } } while(t1) { temp-next = t1; t1 = t1-next; } while(t2) { temp-next = t2; t2 = t2-next; } temp-next = NULL; return head; } did i miss any case? On Jul 5, 11:24 am, vikas mehta...@gmail.com wrote: These all were asked cumulatively in five interviews, one after another. Q1 given 2 string A ,B. write a code to find all character of A exists in B or not? Q2. A puzzle athttp://mathforum.org/library/drmath/view/56756.html Q3. Find a 8-digit number, where the first figure defines the count of zeros in this number, the second figure the count of numeral 1 in this number and so on Q4. write a recursive function to find a given string is palindrome or not? Q5. write a code to generate the parse tree like compilers do internally for any given expression e.g. a+(b+c*(e/f)+d)*g Q6. 3 reverse the string word by word e.g. My name is pradeep .. o/p shd be pradeep is name My ...intwer expecting a 1 traversal algo Q7. C++ (What are virtual functions) what happened if I do Base *d = new Derived(); and Derived *d = new Base(); is it error(in which statement) or not if yes what type of error? Q8. you have 6 coins of Indian denomination (a+b+c+d+e+f=115 paisa) ...if user ask for a change of 100,50,25,10,5 paisa then you r not able to give find the value of a,b,c,d,e,f.e.g. lets if user ask for a change of 25 paisa then you r not able to return (10+10+5) or (20+5) Q9. allocate 2D array dynamically with min no. of malloc calls. Q10. given unsorted array and a no. X ,find 2 no. whose sum is Xa[i]+a[j]=X ...do it in O(n) Q11. class A {}; A obj ; what is sizeof(obj)explain ANS Q12. Write a code of Merge sort on Linked list. Lets discuss them -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- You received this message
[algogeeks] Re: Some adobe interview questions.
@Saurabh: u can improve upon ur solution. char * outstr; int c =0; void getreversedwords(string str) { index = str.length()-1; //outstr is the answer stack st; while(index) { st.push(str[index]); if(st.top() == ' ') //top is a space st.printstack(); index--; } if(st.isEmpty()==false) st.printstack(); } void printstack() { int set =1; char ch; if(st.top()==' ') { ch = st.pop(); set =0; } while(st.isEmpty()==false) outstr[c++] = st.pop(); if(!set) outstr[c++] = ch; } On Jul 5, 4:10 pm, saurabh singh saurab...@gmail.com wrote: well for question 6 I think calculating size of string will count as one traversal? Correct me if I am wrong? My approach: traverse storing each char in a string.when space encountered push the string in stack I am not sure how my solution is but it doesnt appears gud ryt now. On Tue, Jul 5, 2011 4:34 PM, Dumanshu duman...@gmail.com wrote: ans1. use counting sort for character array (0 to 255) then check for the second string if same or not. ans2. send 1 and 2, 1 comes back, send 10 and 5, 2 comes back, send 2 and 1 ans3. As vikas said, sum of digits should b 8. In that case the number must have a zero digit because 1st digit the no. of zeroes can't be zero then. right? print all the combinations. need help on this. ans4. a function with string, first index, last index as arguments and return true or false. increment first index and decrement last index for recursive call. ans5. I have no idea. may b we can take help of shunting algorithm. but there ought to be an easier way to do this. Do we have to WAP a general one for these expressions??? ans6. allocate same number of bytes for the reversed string. now traverse the original string from the back. as soon as u encounter a space say at position x or you come to 0 index, call the current = function (x+1,current) or current = function(0,current). this function copies the original string from position x+1 to (while(space or null)) in reversed string at position current and returns current + no. of characters copied. ans8. somebody plz explain this. do we have to find the values for a,b,c,d,e,f so that we can get return change for 100,50,25,10,5? 10, 5,5,20,25,50... how to get change for 5 then? ans9. lets say we have to allocate 100*200 i.e. rows 100 and columns 200 int **a = (int **)malloc(sizeof(int *)*100); a[0] = (int *)malloc(sizeof(int)*100*200); for(i=1;i100;i++) a[i] = (a[i-1]+200); ans10. use hashtables, first traversal get true for all values present. then second traversal, check if (X- arr[i]) is present in hashtable, if yes print. ans11. i think ans to this one is 1 byte. because some information is stored.. may be. m nt sure :P ans12. typedef struct node * NODE; NODE sortlist(NODE head,int n) { if(n==1) return head; if(!n) return null; NODE temp =head; for(int i=0;in\2;i++)temp=temp-next; return merge(sortlist(head,n/2),sortlist(temp,n/2 + (n%2));); } NODE merge(NODE t1,NODE t2) { NODE head=NULL,temp=NULL; int set =0; while(t1 t2) { if(t1-data t2-data) { if(!set){head=t1;temp = head;set=1;t1=t1-next;} else { temp-next = t1; t1=t1-next; } } else { if(!set){head=t2;temp = head;set=1;t2=t2-next;} else { temp-next = t2; t2=t2-next; } } while(t1) { temp-next = t1; t1 = t1-next; } while(t2) { temp-next = t2; t2 = t2-next; } temp-next = NULL; return head; } did i miss any case? On Jul 5, 11:24 am, vikas mehta...@gmail.com wrote: These all were asked cumulatively in five interviews, one after another. Q1 given 2 string A ,B. write a code to find all character of A exists in B or not? Q2. A puzzle athttp://mathforum.org/library/drmath/view/56756.html Q3. Find a 8-digit number, where the first figure defines the count of zeros in this number, the second figure the count of numeral 1 in this number and so on Q4. write a recursive function to find a given string is palindrome or not? Q5. write a code to generate the parse tree like compilers do internally for any given expression e.g. a+(b+c*(e/f)+d)*g Q6. 3 reverse the string word by word e.g. My name is pradeep .. o/p shd be pradeep is name My ...intwer expecting a 1 traversal algo Q7. C++ (What are virtual functions) what happened if I do Base *d = new Derived(); and Derived *d = new Base(); is it error(in which statement) or not if yes what type of error? Q8. you have 6 coins of Indian denomination (a+b+c+d+e+f=115 paisa) ...if user ask for a change of 100,50,25,10,5 paisa then you r not able to give find the value of a,b,c,d,e,f.e.g. lets if user ask for a change of 25 paisa then you r not able to return (10+10+5) or (20+5) Q9. allocate 2D array dynamically with min no. of malloc calls. Q10. given unsorted array and a no. X ,find 2 no. whose
Re: [algogeeks] Re: Some adobe interview questions.
I mean is the solution valid? Because pushing will take one traversal and then popping another? On Tue, Jul 5, 2011 at 4:58 PM, Dumanshu duman...@gmail.com wrote: @Saurabh: u can improve upon ur solution. char * outstr; int c =0; void getreversedwords(string str) { index = str.length()-1; //outstr is the answer stack st; while(index) { st.push(str[index]); if(st.top() == ' ') //top is a space st.printstack(); index--; } if(st.isEmpty()==false) st.printstack(); } void printstack() { int set =1; char ch; if(st.top()==' ') { ch = st.pop(); set =0; } while(st.isEmpty()==false) outstr[c++] = st.pop(); if(!set) outstr[c++] = ch; } On Jul 5, 4:10 pm, saurabh singh saurab...@gmail.com wrote: well for question 6 I think calculating size of string will count as one traversal? Correct me if I am wrong? My approach: traverse storing each char in a string.when space encountered push the string in stack I am not sure how my solution is but it doesnt appears gud ryt now. On Tue, Jul 5, 2011 4:34 PM, Dumanshu duman...@gmail.com wrote: ans1. use counting sort for character array (0 to 255) then check for the second string if same or not. ans2. send 1 and 2, 1 comes back, send 10 and 5, 2 comes back, send 2 and 1 ans3. As vikas said, sum of digits should b 8. In that case the number must have a zero digit because 1st digit the no. of zeroes can't be zero then. right? print all the combinations. need help on this. ans4. a function with string, first index, last index as arguments and return true or false. increment first index and decrement last index for recursive call. ans5. I have no idea. may b we can take help of shunting algorithm. but there ought to be an easier way to do this. Do we have to WAP a general one for these expressions??? ans6. allocate same number of bytes for the reversed string. now traverse the original string from the back. as soon as u encounter a space say at position x or you come to 0 index, call thecurrent = function (x+1,current) or current = function(0,current). this function copies the original string from position x+1 to (while(space or null)) in reversed string at position current and returns current + no. of characters copied. ans8. somebody plz explain this. do we have to find the values for a,b,c,d,e,f so that we can get return change for 100,50,25,10,5? 10, 5,5,20,25,50... how to get change for 5 then? ans9. lets say we have to allocate 100*200 i.e. rows 100 and columns 200 int **a = (int **)malloc(sizeof(int *)*100); a[0] = (int *)malloc(sizeof(int)*100*200); for(i=1;i100;i++) a[i] = (a[i-1]+200); ans10. use hashtables, first traversal get true for all values present. then second traversal, check if (X- arr[i]) is present in hashtable, if yes print. ans11. i think ans to this one is 1 byte. because some information is stored.. may be. m nt sure :P ans12. typedef struct node * NODE; NODE sortlist(NODE head,int n) { if(n==1) return head; if(!n) return null; NODE temp =head; for(int i=0;in\2;i++)temp=temp-next; return merge(sortlist(head,n/2),sortlist(temp,n/2 + (n%2));); } NODE merge(NODE t1,NODE t2) { NODE head=NULL,temp=NULL; int set =0; while(t1 t2) { if(t1-data t2-data) { if(!set){head=t1;temp = head;set=1;t1=t1-next;} else { temp-next = t1; t1=t1-next; } } else { if(!set){head=t2;temp = head;set=1;t2=t2-next;} else { temp-next = t2; t2=t2-next; } } while(t1) { temp-next = t1; t1 = t1-next; } while(t2) { temp-next = t2; t2 = t2-next; } temp-next = NULL; return head; } did i miss any case? On Jul 5, 11:24 am, vikas mehta...@gmail.com wrote: These all were asked cumulatively in five interviews, one after another. Q1 given 2 string A ,B. write a code to find all character of A exists in B or not? Q2. A puzzle athttp://mathforum.org/library/drmath/view/56756.html Q3. Find a 8-digit number, where the first figure defines the count of zeros in this number, the second figure the count of numeral 1 in this number and so on Q4. write a recursive function to find a given string is palindrome or not? Q5. write a code to generate the parse tree like compilers do internally for any given expression e.g. a+(b+c*(e/f)+d)*g Q6. 3 reverse the string word by word e.g. My name is pradeep .. o/p shd be pradeep is name My ...intwer expecting a 1 traversal algo Q7. C++ (What are virtual functions) what happened if I do Base *d = new Derived(); and Derived *d = new Base(); is it error(in which statement) or not if yes what type of error? Q8. you have 6 coins of Indian denomination (a+b+c+d+e+f=115 paisa) ...if
[algogeeks] Re: Some adobe interview questions.
The answer to question 3 can also be 6010 right? so no unique 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...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Some adobe interview questions.
@anonymous: nopes , it's wrong1 is one time there so that should be their at index 1.. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Some adobe interview questions.
For Q4: I think this is the optimal code int recurPalin(char *start, char *end) { if (end start) return true; if (*start != *end) return false; return recurPalin(start+1, end-1); } - Azhar. On Tue, Jul 5, 2011 at 12:21 PM, vikas mehta...@gmail.com wrote: My program for Q4. // recursively find if a given string is palindrome bool IsPalindrome(string s, int start, int start2, bool flag) { bool flag1 = flag; if (start = 0 start2 (s.Length)) { char c1 = s[start]; char c2 = s[start2]; if (c1.Equals(c2)) { if (start == 0 start2 == s.Length - 1) { flag = true; } if (IsPalindrome(s, start - 1, start2 + 1, flag)) { flag1 = true; } } } return flag1; } while calling if (s.Length % 2 != 0) { p.IsPalindrome(s, s.Length / 2 - 1, s.Length / 2 + 1, false); } else { p.IsPalindrome(s, s.Length / 2 - 1, s.Length / 2, false); } -- 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/-/I6SVTB0o-uUJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Some adobe interview questions.
boolean palindromeCheck(String string) { len=string.length(); if((string.length()1)) { if((string.charAt(0)==string.charAt(len-1))) { str=; str=str+string.substring(1,(len-1)); palindromeCheck(str); } else { flag=false; } } return flag; } THis also works fine if you dont want to use pointer On Tue, Jul 5, 2011 at 9:37 PM, Azhar Hussain azhar...@gmail.com wrote: For Q4: I think this is the optimal code int recurPalin(char *start, char *end) { if (end start) return true; if (*start != *end) return false; return recurPalin(start+1, end-1); } - Azhar. On Tue, Jul 5, 2011 at 12:21 PM, vikas mehta...@gmail.com wrote: My program for Q4. // recursively find if a given string is palindrome bool IsPalindrome(string s, int start, int start2, bool flag) { bool flag1 = flag; if (start = 0 start2 (s.Length)) { char c1 = s[start]; char c2 = s[start2]; if (c1.Equals(c2)) { if (start == 0 start2 == s.Length - 1) { flag = true; } if (IsPalindrome(s, start - 1, start2 + 1, flag)) { flag1 = true; } } } return flag1; } while calling if (s.Length % 2 != 0) { p.IsPalindrome(s, s.Length / 2 - 1, s.Length / 2 + 1, false); } else { p.IsPalindrome(s, s.Length / 2 - 1, s.Length / 2, false); } -- 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/-/I6SVTB0o-uUJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Some adobe interview questions.
Q3. ans:7000 i guess this is also a correct answer and no unique soln as such On Wed, Jul 6, 2011 at 12:37 AM, aditya kumar aditya.kumar130...@gmail.comwrote: boolean palindromeCheck(String string) { len=string.length(); if((string.length()1)) { if((string.charAt(0)==string.charAt(len-1))) { str=; str=str+string.substring(1,(len-1)); palindromeCheck(str); } else { flag=false; } } return flag; } THis also works fine if you dont want to use pointer On Tue, Jul 5, 2011 at 9:37 PM, Azhar Hussain azhar...@gmail.com wrote: For Q4: I think this is the optimal code int recurPalin(char *start, char *end) { if (end start) return true; if (*start != *end) return false; return recurPalin(start+1, end-1); } - Azhar. On Tue, Jul 5, 2011 at 12:21 PM, vikas mehta...@gmail.com wrote: My program for Q4. // recursively find if a given string is palindrome bool IsPalindrome(string s, int start, int start2, bool flag) { bool flag1 = flag; if (start = 0 start2 (s.Length)) { char c1 = s[start]; char c2 = s[start2]; if (c1.Equals(c2)) { if (start == 0 start2 == s.Length - 1) { flag = true; } if (IsPalindrome(s, start - 1, start2 + 1, flag)) { flag1 = true; } } } return flag1; } while calling if (s.Length % 2 != 0) { p.IsPalindrome(s, s.Length / 2 - 1, s.Length / 2 + 1, false); } else { p.IsPalindrome(s, s.Length / 2 - 1, s.Length / 2, false); } -- 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/-/I6SVTB0o-uUJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: Some adobe interview questions.
@aditya : I am wondering how many times 7 has occurred. Is it 1? Or is it 0? Please take a moment before posting your solution, and think whether it is write or wrong! On Jul 6, 12:11 am, aditya kumar aditya.kumar130...@gmail.com wrote: Q3. ans:7000 i guess this is also a correct answer and no unique soln as such On Wed, Jul 6, 2011 at 12:37 AM, aditya kumar aditya.kumar130...@gmail.comwrote: boolean palindromeCheck(String string) { len=string.length(); if((string.length()1)) { if((string.charAt(0)==string.charAt(len-1))) { str=; str=str+string.substring(1,(len-1)); palindromeCheck(str); } else { flag=false; } } return flag; } THis also works fine if you dont want to use pointer On Tue, Jul 5, 2011 at 9:37 PM, Azhar Hussain azhar...@gmail.com wrote: For Q4: I think this is the optimal code int recurPalin(char *start, char *end) { if (end start) return true; if (*start != *end) return false; return recurPalin(start+1, end-1); } - Azhar. On Tue, Jul 5, 2011 at 12:21 PM, vikas mehta...@gmail.com wrote: My program for Q4. // recursively find if a given string is palindrome bool IsPalindrome(string s, int start, int start2, bool flag) { bool flag1 = flag; if (start = 0 start2 (s.Length)) { char c1 = s[start]; char c2 = s[start2]; if (c1.Equals(c2)) { if (start == 0 start2 == s.Length - 1) { flag = true; } if (IsPalindrome(s, start - 1, start2 + 1, flag)) { flag1 = true; } } } return flag1; } while calling if (s.Length % 2 != 0) { p.IsPalindrome(s, s.Length / 2 - 1, s.Length / 2 + 1, false); } else { p.IsPalindrome(s, s.Length / 2 - 1, s.Length / 2, false); } -- 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/-/I6SVTB0o-uUJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Some adobe interview questions.
in 7000 : '0' occurs seven times and rst of the numbers occur zero times. i still dint get where i am wrong . plz explain me . On Wed, Jul 6, 2011 at 12:47 AM, L prnk.bhatna...@gmail.com wrote: @aditya : I am wondering how many times 7 has occurred. Is it 1? Or is it 0? Please take a moment before posting your solution, and think whether it is write or wrong! On Jul 6, 12:11 am, aditya kumar aditya.kumar130...@gmail.com wrote: Q3. ans:7000 i guess this is also a correct answer and no unique soln as such On Wed, Jul 6, 2011 at 12:37 AM, aditya kumar aditya.kumar130...@gmail.comwrote: boolean palindromeCheck(String string) { len=string.length(); if((string.length()1)) { if((string.charAt(0)==string.charAt(len-1))) { str=; str=str+string.substring(1,(len-1)); palindromeCheck(str); } else { flag=false; } } return flag; } THis also works fine if you dont want to use pointer On Tue, Jul 5, 2011 at 9:37 PM, Azhar Hussain azhar...@gmail.com wrote: For Q4: I think this is the optimal code int recurPalin(char *start, char *end) { if (end start) return true; if (*start != *end) return false; return recurPalin(start+1, end-1); } - Azhar. On Tue, Jul 5, 2011 at 12:21 PM, vikas mehta...@gmail.com wrote: My program for Q4. // recursively find if a given string is palindrome bool IsPalindrome(string s, int start, int start2, bool flag) { bool flag1 = flag; if (start = 0 start2 (s.Length)) { char c1 = s[start]; char c2 = s[start2]; if (c1.Equals(c2)) { if (start == 0 start2 == s.Length - 1) { flag = true; } if (IsPalindrome(s, start - 1, start2 + 1, flag)) { flag1 = true; } } } return flag1; } while calling if (s.Length % 2 != 0) { p.IsPalindrome(s, s.Length / 2 - 1, s.Length / 2 + 1, false); } else { p.IsPalindrome(s, s.Length / 2 - 1, s.Length / 2, false); } -- 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/-/I6SVTB0o-uUJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Some adobe interview questions.
7 occurs 1 time... so 8th digit is 1 On Wed, Jul 6, 2011 at 1:02 AM, aditya kumar aditya.kumar130...@gmail.comwrote: in 7000 : '0' occurs seven times and rst of the numbers occur zero times. i still dint get where i am wrong . plz explain me . On Wed, Jul 6, 2011 at 12:47 AM, L prnk.bhatna...@gmail.com wrote: @aditya : I am wondering how many times 7 has occurred. Is it 1? Or is it 0? Please take a moment before posting your solution, and think whether it is write or wrong! On Jul 6, 12:11 am, aditya kumar aditya.kumar130...@gmail.com wrote: Q3. ans:7000 i guess this is also a correct answer and no unique soln as such On Wed, Jul 6, 2011 at 12:37 AM, aditya kumar aditya.kumar130...@gmail.comwrote: boolean palindromeCheck(String string) { len=string.length(); if((string.length()1)) { if((string.charAt(0)==string.charAt(len-1))) { str=; str=str+string.substring(1,(len-1)); palindromeCheck(str); } else { flag=false; } } return flag; } THis also works fine if you dont want to use pointer On Tue, Jul 5, 2011 at 9:37 PM, Azhar Hussain azhar...@gmail.com wrote: For Q4: I think this is the optimal code int recurPalin(char *start, char *end) { if (end start) return true; if (*start != *end) return false; return recurPalin(start+1, end-1); } - Azhar. On Tue, Jul 5, 2011 at 12:21 PM, vikas mehta...@gmail.com wrote: My program for Q4. // recursively find if a given string is palindrome bool IsPalindrome(string s, int start, int start2, bool flag) { bool flag1 = flag; if (start = 0 start2 (s.Length)) { char c1 = s[start]; char c2 = s[start2]; if (c1.Equals(c2)) { if (start == 0 start2 == s.Length - 1) { flag = true; } if (IsPalindrome(s, start - 1, start2 + 1, flag)) { flag1 = true; } } } return flag1; } while calling if (s.Length % 2 != 0) { p.IsPalindrome(s, s.Length / 2 - 1, s.Length / 2 + 1, false); } else { p.IsPalindrome(s, s.Length / 2 - 1, s.Length / 2, false); } -- 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/-/I6SVTB0o-uUJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Regards,* *Piyush Kapoor,* *CSE-IT-BHU* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Some adobe interview questions.
But '7' has also appeared One time, you need to take that into account. -- 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/-/djbLMkBkRiUJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Some adobe interview questions.
@piyush : thanks i thot most significant bit was take as fisrt figure . On Wed, Jul 6, 2011 at 1:03 AM, Piyush Kapoor pkjee2...@gmail.com wrote: 7 occurs 1 time... so 8th digit is 1 On Wed, Jul 6, 2011 at 1:02 AM, aditya kumar aditya.kumar130...@gmail.com wrote: in 7000 : '0' occurs seven times and rst of the numbers occur zero times. i still dint get where i am wrong . plz explain me . On Wed, Jul 6, 2011 at 12:47 AM, L prnk.bhatna...@gmail.com wrote: @aditya : I am wondering how many times 7 has occurred. Is it 1? Or is it 0? Please take a moment before posting your solution, and think whether it is write or wrong! On Jul 6, 12:11 am, aditya kumar aditya.kumar130...@gmail.com wrote: Q3. ans:7000 i guess this is also a correct answer and no unique soln as such On Wed, Jul 6, 2011 at 12:37 AM, aditya kumar aditya.kumar130...@gmail.comwrote: boolean palindromeCheck(String string) { len=string.length(); if((string.length()1)) { if((string.charAt(0)==string.charAt(len-1))) { str=; str=str+string.substring(1,(len-1)); palindromeCheck(str); } else { flag=false; } } return flag; } THis also works fine if you dont want to use pointer On Tue, Jul 5, 2011 at 9:37 PM, Azhar Hussain azhar...@gmail.com wrote: For Q4: I think this is the optimal code int recurPalin(char *start, char *end) { if (end start) return true; if (*start != *end) return false; return recurPalin(start+1, end-1); } - Azhar. On Tue, Jul 5, 2011 at 12:21 PM, vikas mehta...@gmail.com wrote: My program for Q4. // recursively find if a given string is palindrome bool IsPalindrome(string s, int start, int start2, bool flag) { bool flag1 = flag; if (start = 0 start2 (s.Length)) { char c1 = s[start]; char c2 = s[start2]; if (c1.Equals(c2)) { if (start == 0 start2 == s.Length - 1) { flag = true; } if (IsPalindrome(s, start - 1, start2 + 1, flag)) { flag1 = true; } } } return flag1; } while calling if (s.Length % 2 != 0) { p.IsPalindrome(s, s.Length / 2 - 1, s.Length / 2 + 1, false); } else { p.IsPalindrome(s, s.Length / 2 - 1, s.Length / 2, false); } -- 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/-/I6SVTB0o-uUJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Regards,* *Piyush Kapoor,* *CSE-IT-BHU* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: Some adobe interview questions.
no 7000 is not possible because, '7' is also there so you have to mention at the index of '7' that it is there 1 time.. On Jul 6, 12:32 am, aditya kumar aditya.kumar130...@gmail.com wrote: in 7000 : '0' occurs seven times and rst of the numbers occur zero times. i still dint get where i am wrong . plz explain me . On Wed, Jul 6, 2011 at 12:47 AM, L prnk.bhatna...@gmail.com wrote: @aditya : I am wondering how many times 7 has occurred. Is it 1? Or is it 0? Please take a moment before posting your solution, and think whether it is write or wrong! On Jul 6, 12:11 am, aditya kumar aditya.kumar130...@gmail.com wrote: Q3. ans:7000 i guess this is also a correct answer and no unique soln as such On Wed, Jul 6, 2011 at 12:37 AM, aditya kumar aditya.kumar130...@gmail.comwrote: boolean palindromeCheck(String string) { len=string.length(); if((string.length()1)) { if((string.charAt(0)==string.charAt(len-1))) { str=; str=str+string.substring(1,(len-1)); palindromeCheck(str); } else { flag=false; } } return flag; } THis also works fine if you dont want to use pointer On Tue, Jul 5, 2011 at 9:37 PM, Azhar Hussain azhar...@gmail.com wrote: For Q4: I think this is the optimal code int recurPalin(char *start, char *end) { if (end start) return true; if (*start != *end) return false; return recurPalin(start+1, end-1); } - Azhar. On Tue, Jul 5, 2011 at 12:21 PM, vikas mehta...@gmail.com wrote: My program for Q4. // recursively find if a given string is palindrome bool IsPalindrome(string s, int start, int start2, bool flag) { bool flag1 = flag; if (start = 0 start2 (s.Length)) { char c1 = s[start]; char c2 = s[start2]; if (c1.Equals(c2)) { if (start == 0 start2 == s.Length - 1) { flag = true; } if (IsPalindrome(s, start - 1, start2 + 1, flag)) { flag1 = true; } } } return flag1; } while calling if (s.Length % 2 != 0) { p.IsPalindrome(s, s.Length / 2 - 1, s.Length / 2 + 1, false); } else { p.IsPalindrome(s, s.Length / 2 - 1, s.Length / 2, false); } -- 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/-/I6SVTB0o-uUJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: Some adobe interview questions.
@ashish thanx buddy nice solution On Jul 6, 7:20 am, Ashish Goel ashg...@gmail.com wrote: Q3 : 42101000 started with 7000 then changes this to 6010 51000100 to 42101000 to Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 On Tue, Jul 5, 2011 at 11:54 AM, vikas mehta...@gmail.com wrote: These all were asked cumulatively in five interviews, one after another. Q1 given 2 string A ,B. write a code to find all character of A exists in B or not? Q2. A puzzle athttp://mathforum.org/library/drmath/view/56756.html Q3. Find a 8-digit number, where the first figure defines the count of zeros in this number, the second figure the count of numeral 1 in this number and so on Q4. write a recursive function to find a given string is palindrome or not? Q5. write a code to generate the parse tree like compilers do internally for any given expression e.g. a+(b+c*(e/f)+d)*g Q6. 3 reverse the string word by word e.g. My name is pradeep .. o/p shd be pradeep is name My ...intwer expecting a 1 traversal algo Q7. C++ (What are virtual functions) what happened if I do Base *d = new Derived(); and Derived *d = new Base(); is it error(in which statement) or not if yes what type of error? Q8. you have 6 coins of Indian denomination (a+b+c+d+e+f=115 paisa) ...if user ask for a change of 100,50,25,10,5 paisa then you r not able to give find the value of a,b,c,d,e,f.e.g. lets if user ask for a change of 25 paisa then you r not able to return (10+10+5) or (20+5) Q9. allocate 2D array dynamically with min no. of malloc calls. Q10. given unsorted array and a no. X ,find 2 no. whose sum is Xa[i]+a[j]=X ...do it in O(n) Q11. class A {}; A obj ; what is sizeof(obj)explain ANS Q12. Write a code of Merge sort on Linked list. Lets discuss them -- 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/-/FAVdr2McPqIJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.