Re: [algogeeks] Puzzle

2011-07-29 Thread sagar pareek
check this out... http://groups.google.com/group/algogeeks/browse_thread/thread/be213f8937b02858?hl=en# On Thu, Jul 28, 2011 at 10:00 PM, shubham shubh2...@gmail.com wrote: answer is: 1 hr 20 mins. But i don't know how to arrive at the solution. help anyone.. -- You received

Re: [algogeeks] Find the number of solutions.

2011-07-29 Thread Kunal Patil
x^(x^x) - (x^x)^x = 0 Thus, x^(x^x) = (x^x)^x Let's open it up by taking log on both sides... (x^x)*log(x) = x* log(x^x) (x^x)*log(x) = x*x*log(x) If x==1 equation is satisfied as log(x) becomes 0.. so x=1 is definitely a solution. what if when x != 1 cancelling log(x) on both the sides.. x^x =

Re: [algogeeks] Programming Puzzle!!!!!!!

2011-07-29 Thread ankit sambyal
Let S be the exact amount for which minimum coins are to found. And denom[] be the array which contains different denominations. Let N be the size of the denom[] array. Algo: 1. int memo[S] 2. initialize all its elements to infinite 3.for i=1 to S for j=0 to N-1 if(denom[j] i

Re: [algogeeks] swapping 2 variables without using temporary variables

2011-07-29 Thread tech rascal
@reynald: this won't work for floatsis there any other case u can think of, where this method won't work?? 2011/7/29 A for ♥ღAakasHღ♥ littleidol...@gmail.com a=(a+b)-(b=a); *Aakash Abhishek Pradhan** **MCA Final Year, NIT Durgapur* -- You received this message because you are

[algogeeks] Novell - Puzzle

2011-07-29 Thread Reynald
If a cow produces its first she-calf at age two years and after that produces another single she-calf every year, how many she-calves are there after 12 years? assuming none die. and a similar one, asked to another guy, Suppose a newly-born pair of rabbits, one male, one female, are put in a

[algogeeks] wht is d logic behind this

2011-07-29 Thread jagrati verma
an array containing +ve and -ve integers.find sub array with the largest sum -- 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] Programming Puzzle!!!!!!!

2011-07-29 Thread AMAN AGARWAL
Can you please explain the logic behind this algo in detail... On Fri, Jul 29, 2011 at 11:32 AM, ankit sambyal ankitsamb...@gmail.comwrote: Let S be the exact amount for which minimum coins are to found. And denom[] be the array which contains different denominations. Let N be the size of the

Re: [algogeeks] Novell - Technical Interview

2011-07-29 Thread Vishal Thanki
For 2nd, Are you looking for this? /lib/modules/kernel_versionbuild/ ? Or the kernel image? It can be found under /boot/. But that depends upon the distribution, there is no symbolic link present for kernel image as far as i know. On Fri, Jul 29, 2011 at 9:45 AM, rajeev bharshetty

[algogeeks] Re: constraint programming

2011-07-29 Thread pschaus
I'm not familiar with Choco in particular but you are probably trying to post an element constraint. Make sure that the index variable has a domain inside the range of the array on which you apply the element (-1 should not be in the domain). On Jul 29, 1:24 am, hafsainfo haafsa...@gmail.com

[algogeeks] Novell - Algorithms round

2011-07-29 Thread Reynald
Write and implement an algorithm to find the nth Fibonacci number, optimized for space and time. -- 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,

Re: [algogeeks] Novell - Technical Interview

2011-07-29 Thread Azhar Hussain
symbolic link /boot/vmlinuz will point to the actual kernel executable(or image). /lib/modules are modules that can be loaded if required. google for vmlinuz or lib modules for more info. - Azhar. On Fri, Jul 29, 2011 at 11:54 AM, Vishal Thanki vishaltha...@gmail.comwrote: For 2nd, Are you

Re: [algogeeks] Novell - Algorithms round

2011-07-29 Thread sunny agrawal
can be found in lg(n) using Matrix Exponential method | 1 1 |^n | 1 0 | [f(i) f(i-1)]* |1 1| = [f(i+1) f(i)] |1 0| On Fri, Jul 29, 2011 at 12:05 PM, Reynald reynaldsus...@gmail.com wrote: Write and implement an algorithm to find the nth Fibonacci number, optimized for space

[algogeeks] longest common string!!!!!

2011-07-29 Thread AMAN AGARWAL
please give the solution for this problem... Give an algorithm to find the Longest common string of strings with lengths m,n respectively and also analyse their time complexities -- AMAN AGARWAL Success is not final, Failure is not fatal: It is the courage to continue that counts! -- You

Re: [algogeeks] Programming Puzzle!!!!!!!

2011-07-29 Thread ankit sambyal
I have used dynamic programing to solve the problem. I have used memo[] array to memoize the value of previous state. You should take an example and try to work it out using the algo... -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post

Re: [algogeeks] longest common string!!!!!

2011-07-29 Thread sunny agrawal
String need to be contiguous or not ? On Fri, Jul 29, 2011 at 12:23 PM, AMAN AGARWAL mnnit.a...@gmail.com wrote: please give the solution for this problem... Give an algorithm to find the Longest common string of strings with lengths m,n respectively and also analyse their time

Re: [algogeeks] swapping 2 variables without using temporary variables

2011-07-29 Thread Prem Krishna Chettri
Replying to all the Above Code. 1 XOR operation to swap variable are not a solution as it fails for swapping of same value results 0. 2 the Short and Sweet looking various modification of code fails to swap data when U swap data between two different data type. So I suggest you all guys to use

[algogeeks] Re: Novell - Puzzle

2011-07-29 Thread shiv narayan
solutions for cow questions: if we consider first cow would she calf at age 2 then first new cow would come at age two. at end of 2nd year: 1st would give new cow: at end of 3rd year:1st cow would another new cow at end of 4th year :1st cow will give new cow and the cow born at end of 2nd year

Re: [algogeeks] Logical operator question

2011-07-29 Thread Vijay Khandar
Thanks, but also one small doubt If x=y=z=-4 then plz tell me o/p of pf(++x++y||++z) and pf(x,y,z) these two statements. On Fri, Jul 29, 2011 at 10:52 AM, jagrati verma jagrativermamn...@gmail.com wrote: vijay x=y=z=-1 so for ++x++y||++z ++x=0 so 1st condition will get false so

Re: [algogeeks] Logical operator question

2011-07-29 Thread Prem Krishna Chettri
1 and -3 -3 -4.. Verify the Compilation.. Regards Prem On Fri, Jul 29, 2011 at 12:35 PM, Vijay Khandar vijaykhand...@gmail.comwrote: Thanks, but also one small doubt If x=y=z=-4 then plz tell me o/p of pf(++x++y||++z) and pf(x,y,z) these two statements. On Fri, Jul

Re: [algogeeks] Logical operator question

2011-07-29 Thread Vijay Khandar
Yes , so can u explai me plz, i m little bit confusing..Vijay On Fri, Jul 29, 2011 at 12:39 PM, Prem Krishna Chettri hprem...@gmail.comwrote: 1 and -3 -3 -4.. Verify the Compilation.. Regards Prem On Fri, Jul 29, 2011 at 12:35 PM, Vijay Khandar

[algogeeks] Re: wht is d logic behind this

2011-07-29 Thread shiv narayan
this is very popular interview question i also want solution. On Jul 29, 11:19 am, jagrati verma jagrativermamn...@gmail.com wrote:  an array containing +ve and -ve integers.find sub array with the largest sum -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] Logical operator question

2011-07-29 Thread Vijay Khandar
Thanks Prem got it now... On Fri, Jul 29, 2011 at 12:44 PM, Vijay Khandar vijaykhand...@gmail.comwrote: Yes , so can u explai me plz, i m little bit confusing..Vijay On Fri, Jul 29, 2011 at 12:39 PM, Prem Krishna Chettri hprem...@gmail.com wrote: 1 and -3 -3

Re: [algogeeks] Logical operator question

2011-07-29 Thread Prem Krishna Chettri
Short and Easy.. Operation Check both side (if not Zero) B4 verifying the result || operation Check only either side.Depends on the precedence on which it applies. Now Work it Out. On Fri, Jul 29, 2011 at 12:44 PM, Vijay Khandar vijaykhand...@gmail.comwrote: Yes , so can u explai me plz, i

Re: [algogeeks] Logical operator question

2011-07-29 Thread Vijay Khandar
Thanks. On Fri, Jul 29, 2011 at 12:46 PM, Prem Krishna Chettri hprem...@gmail.comwrote: Short and Easy.. Operation Check both side (if not Zero) B4 verifying the result || operation Check only either side.Depends on the precedence on which it applies. Now Work it Out. On Fri,

[algogeeks] Re: wht is d logic behind this

2011-07-29 Thread SAMMM
Do u want the subarray consisting of consecutive elements ??? -- 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] Novell - Puzzle

2011-07-29 Thread Hemalatha
@Shivnarayan As per the analysis from the number of cows produced from the she-calves of the 1st cow, I get the foll numbers: 1+2+4+7+11+16+22+29+38+48+59+1(MainCow) = 238. Correct me If am wrong. Regards Hemalatha On Fri, Jul 29, 2011 at 11:45 AM, Reynald reynaldsus...@gmail.com wrote: If

Re: [algogeeks] swapping 2 variables without using temporary variables

2011-07-29 Thread tech rascal
can u give an explanation for ...how xor method fails for same values?? I think it will work right... On Fri, Jul 29, 2011 at 12:26 PM, Prem Krishna Chettri hprem...@gmail.comwrote: Replying to all the Above Code. 1 XOR operation to swap variable are not a solution as it fails for swapping

Re: [algogeeks] swapping 2 variables without using temporary variables

2011-07-29 Thread Prem Krishna Chettri
http://en.wikipedia.org/wiki/XOR_swap_algorithm Answer as well as broaden you guys Concept on Memory.. Have a look On Fri, Jul 29, 2011 at 12:54 PM, tech rascal techrascal...@gmail.comwrote: can u give an explanation for ...how xor method fails for same values?? I think it will work right...

Re: [algogeeks] Novell - Puzzle

2011-07-29 Thread Reynald Suz
Shivnarayan, why should we add all Fibonacci number? Since 1+1 both digits represent the same cow. I think the last Fibonacci is the answer. I'm sorry if I'm wrong. On Fri, Jul 29, 2011 at 12:53 PM, Hemalatha hemalatha.amru...@googlemail.com wrote: @Shivnarayan As per the analysis from the

Re: [algogeeks] Re: wht is d logic behind this

2011-07-29 Thread Ram CEG
kadane's algo...google it On Fri, Jul 29, 2011 at 12:52 PM, SAMMM somnath.nit...@gmail.com wrote: Do u want the subarray consisting of consecutive elements ??? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send

[algogeeks] Re: Novell - Algorithms round

2011-07-29 Thread SAMMM
Yess ... For For example :- F(n) = | 1 1 |^n | 1 0 | For calculating a^n ... use the Exponential method Here a will be your Matrix .. int result (int a,int n) { int x=1,y=a; while(n0) { if(n%2==1) x=(x*y); /* Instead of X=1 i(n case of ODD ) substiute

Re: [algogeeks] swapping 2 variables without using temporary variables

2011-07-29 Thread tech rascal
yeah thanxgot it this won't work if memory locations of both variables is same On Fri, Jul 29, 2011 at 1:03 PM, Prem Krishna Chettri hprem...@gmail.comwrote: http://en.wikipedia.org/wiki/XOR_swap_algorithm Answer as well as broaden you guys Concept on Memory.. Have a look On Fri,

[algogeeks] Re: wht is d logic behind this

2011-07-29 Thread Anurag Gupta
you refer cormen too On Jul 29, 11:19 am, jagrati verma jagrativermamn...@gmail.com wrote:  an array containing +ve and -ve integers.find sub array with the largest sum -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this

Re: [algogeeks] [offtopic] Something to share for those preparing for Amazon Campus Interviews!

2011-07-29 Thread Rahul Menon
@RAHUL SINGHAL Sorry to bother you! Unfortunately I cant find any such links in topcoder. Can you just share a link here! -- 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] Novell - Puzzle

2011-07-29 Thread sunny agrawal
No ans will be sum of all final fib. number is the no of she-calves of age 0 second last is number is she-calves of age 1 ...and so on so answer is sum of all On Fri, Jul 29, 2011 at 1:09 PM, Reynald Suz reynaldsus...@gmail.comwrote: Shivnarayan, why should we add all Fibonacci number? Since

Re: [algogeeks] [offtopic] Something to share for those preparing for Amazon Campus Interviews!

2011-07-29 Thread sunny agrawal
http://www.topcoder.com/tc?module=Staticd1=tutorialsd2=alg_index On Fri, Jul 29, 2011 at 1:31 PM, Rahul Menon menonrahul1...@gmail.comwrote: @RAHUL SINGHAL Sorry to bother you! Unfortunately I cant find any such links in topcoder. Can you just share a link here! -- You received this

[algogeeks] Re: binary search tree question!!!!

2011-07-29 Thread shiv narayan
would it work temp=root; for(int i=0;ik;i++) { temp=temp-left; } On Jul 29, 10:48 am, sunny agrawal sunny816.i...@gmail.com wrote: Node* x = TREE_MINIMUM(root); for(int i = 0; i k-1; i++){ x = TREE-SUCCESSOR(x);} return x; On Fri, Jul 29, 2011 at 11:08 AM, noobcoder

Re: [algogeeks] Programming Puzzle!!!!!!!

2011-07-29 Thread AMAN AGARWAL
what do you mean when u say initialize all its elements to infinite. i am not able to get this logic. memo[i-denom[j]] +1 memo[i] can you please explain??? On Fri, Jul 29, 2011 at 11:32 AM, ankit sambyal ankitsamb...@gmail.comwrote: Let S be the exact amount for which minimum coins

Re: [algogeeks] Programming Puzzle!!!!!!!

2011-07-29 Thread ankit sambyal
It means a very large value, can be the max value that an integer can hold -- 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] Programming Puzzle!!!!!!!

2011-07-29 Thread AMAN AGARWAL
what do u mean by memo[i]=memo[i-denom[j]] +1 memo[i] will be containing infinite value. memo[i-denom[j]] will also contain infinite value On Fri, Jul 29, 2011 at 11:32 AM, ankit sambyal ankitsamb...@gmail.comwrote: Let S be the exact amount for which minimum coins are to found. And

[algogeeks]

2011-07-29 Thread Puneet Gautam
If u have to sort a large amount of data,but the memory space is insufficient for the same...How would u sort the data..? Reply asap everyone.. Thanks in advance...! -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send

Re: [algogeeks] longest common string!!!!!

2011-07-29 Thread sagar pareek
Longest common sub sequence complexity O(n*n); Have you ever studied DAA ? On Fri, Jul 29, 2011 at 12:25 PM, sunny agrawal sunny816.i...@gmail.comwrote: String need to be contiguous or not ? On Fri, Jul 29, 2011 at 12:23 PM, AMAN AGARWAL mnnit.a...@gmail.comwrote: please give the solution

[algogeeks] Testcases

2011-07-29 Thread Puneet Gautam
Hey everyone , pls tell me how testcases of following: 1. 3 sides of a triangle are taken, output whether its obstuse, scalene,isosceles..? 2. testcases of a duster... I know nothing about testcases, so pls reply accordingly..!! -- You received this message because you are subscribed to the

[algogeeks] DS representation.

2011-07-29 Thread Puneet Gautam
Hi, pls tell me which data structure has following representation:: A+Bx+Cx(^2)+Dx(^3)+...+Nx(^n-1).?? reply asap...!! -- 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] DS representation.

2011-07-29 Thread Prem Krishna Chettri
SLL... Bit Field (best optimisation)... On Fri, Jul 29, 2011 at 3:06 PM, Puneet Gautam puneet.nsi...@gmail.comwrote: Hi, pls tell me which data structure has following representation:: A+Bx+Cx(^2)+Dx(^3)+...+Nx(^n-1).?? reply asap...!! -- You received this message because

Re: [algogeeks] DS representation.

2011-07-29 Thread sunny agrawal
Array that that stores A,B,C,D,E. it looks like u r on some telephonic interview :P On Fri, Jul 29, 2011 at 3:06 PM, Puneet Gautam puneet.nsi...@gmail.comwrote: Hi, pls tell me which data structure has following representation:: A+Bx+Cx(^2)+Dx(^3)+...+Nx(^n-1).?? reply

Re: [algogeeks]

2011-07-29 Thread rajeev bharshetty
B Trees data structures are optimal for such problems. These algorithms help to access large amount of data which we cannot fit into main memory . On Fri, Jul 29, 2011 at 2:58 PM, Puneet Gautam puneet.nsi...@gmail.comwrote: If u have to sort a large amount of data,but the memory space is

Re: [algogeeks] DS representation.

2011-07-29 Thread rajeev bharshetty
You can use a Hash map which maps the coefficients of the equation and their exponents. Is this feasible ?? On Fri, Jul 29, 2011 at 3:10 PM, sunny agrawal sunny816.i...@gmail.comwrote: Array that that stores A,B,C,D,E. it looks like u r on some telephonic interview :P On Fri, Jul 29,

Re: [algogeeks]

2011-07-29 Thread Anand Saha
You have to use External Merge Sort. -- On Fri, Jul 29, 2011 at 2:58 PM, Puneet Gautam puneet.nsi...@gmail.comwrote: If u have to sort a large amount of data,but the memory space is insufficient for the same...How would u sort the data..? Reply asap everyone.. Thanks in advance...! --

Re: [algogeeks] self referential struct. Contd.

2011-07-29 Thread Puneet Gautam
@nikhil: If i declare Char b after int c.., would there be any difference...? On 7/28/11, Nikhil Gupta nikhilgupta2...@gmail.com wrote: Here's another example. struct example { int a; char b; int c; } Now if a variable of type example is declared then (considering base address as 2000)

Re: [algogeeks]

2011-07-29 Thread Puneet Gautam
@Anand: What is external merge sort...? On 7/29/11, Anand Saha anands...@gmail.com wrote: You have to use External Merge Sort. -- On Fri, Jul 29, 2011 at 2:58 PM, Puneet Gautam puneet.nsi...@gmail.comwrote: If u have to sort a large amount of data,but the memory space is insufficient

[algogeeks] Re: Novell - Puzzle

2011-07-29 Thread shiv narayan
i think for rat pair answer should be same as cow..correct me if i am wrong On Jul 29, 1:10 pm, sunny agrawal sunny816.i...@gmail.com wrote: No ans will be sum of all final fib. number is the no of she-calves of age 0 second last is number is she-calves of age 1 ...and so on so answer is

Re: [algogeeks] Programming Puzzle!!!!!!!

2011-07-29 Thread Arun Vishwanathan
I can tell u the logic if the minimum existing coin denomination is 1 cent for instance.If the minimum denomination is not 1 u might need to modify the algorithm I guess let v1,v2.vn be the values of the coin denominations u have in the array dynamic programming solution would be as follows:

Re: [algogeeks] Programming Puzzle!!!!!!!

2011-07-29 Thread Ravinder Kumar
It is just integer knapsack. On Fri, Jul 29, 2011 at 11:34 AM, Arun Vishwanathan aaron.nar...@gmail.comwrote: I can tell u the logic if the minimum existing coin denomination is 1 cent for instance.If the minimum denomination is not 1 u might need to modify the algorithm I guess let

Re: [algogeeks] Re: permutation of string with repeated characters...

2011-07-29 Thread snehi jain
i did a dry run on this code and didnt find the significance of mk array ... so i did remove it from the code .. and the code works fine .. i more thing ... the code repeats same palindromes as in incase of ABA baa is coming twice.. correct me if i am wrong ... On Fri, Jul 29, 2011 at 10:47 AM,

[algogeeks] NIT Warangal people

2011-07-29 Thread azad
please share the questions of facebook interviwe rounds, fb coming in my coll on 5th.. -- 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

Re: [algogeeks] Programming Puzzle!!!!!!!

2011-07-29 Thread ankit sambyal
@aman: My mistake. set* memo[0]=0* The revised algo is : Algo: 1. int memo[S] 2. initialize all its elements to infinite. * 3.memo[0]=0* 4.for i=1 to S for j=0 to N-1 if(denom[j] imemo[i-denom[j]] +1 memo[i]) memo[i]=memo[i-denom[j]] +1 5. return memo[S] --

[algogeeks] do while problem

2011-07-29 Thread nullpointer
#includestdio.h void add(); void subtract(); int main() {int choice; printf(enter your choice:1.add 2.subtract:); scanf(%d,choice); switch(choice) {case 1: add(); break; default: printf(wrong choice entered); } } void add() {int a,b; char c; do {printf(enter two numbers:);

[algogeeks] Re: self referential struct. Contd.

2011-07-29 Thread nullpointer
#includestdio.h #includeconio.h struc MyStructA { char a; char b; int c; }; struct MyStructB { char a; int c; char b; }; int main(void) { struct MyStructA A; struct MyStructB B; int sizeA = sizeof(struct MyStructA); int sizeB = sizeof(struct MyStructB); return 0; } OUTPUT IS A = 8

Re: [algogeeks] Re: permutation of string with repeated characters...

2011-07-29 Thread Ravinder Kumar
void printPerm(char *s,int i ,int len){ if( i == len){ printf(%s\n,s); return ; } int j ; char t ; char h[26] ; memset(h,'0',26); for(j = i ; j len ; j++ ){ if(h[s[j]-'a'] == '0'){ h[s[j]-'a'] = '1' ; t = s[i] ; s[i] = s[j] ; s[j] =

Re: [algogeeks] Novell - Technical Interview

2011-07-29 Thread Reynald Suz
Rajeev, I think 'vmlinuz' file in /boot directory is the symbolic link to kernel. On Fri, Jul 29, 2011 at 9:45 AM, rajeev bharshetty rajeevr...@gmail.comwrote: 1 )System map in Linux is a Symbol table used by the kernel. Mapping of symbol names and addresses. 2 ) IS it /usr/src/linux ???

Re: [algogeeks] Testcases

2011-07-29 Thread Umer Farooq
Is that from a phone interview of MS? :-| On Fri, Jul 29, 2011 at 2:32 PM, Puneet Gautam puneet.nsi...@gmail.comwrote: Hey everyone , pls tell me how testcases of following: 1. 3 sides of a triangle are taken, output whether its obstuse, scalene,isosceles..? 2. testcases of a duster... I

Re: [algogeeks]

2011-07-29 Thread Ravinder Kumar
external merge sort . On Fri, Jul 29, 2011 at 10:54 AM, rajeev bharshetty rajeevr...@gmail.comwrote: B Trees data structures are optimal for such problems. These algorithms help to access large amount of data which we cannot fit into main memory . On Fri, Jul 29, 2011 at 2:58 PM, Puneet

Re: [algogeeks]

2011-07-29 Thread Anika Jain
this is the recursive code..Iterative does any1 know? On Thu, Jul 28, 2011 at 7:58 AM, ambika iyer balu200...@gmail.com wrote: @tushar : thnx!! On Thu, Jul 28, 2011 at 8:11 PM, Tushar Bindal tushicom...@gmail.comwrote: it should be O(n) where n is number of nodes as we get into the

Re: [algogeeks]

2011-07-29 Thread Puneet Gautam
But in B-trees also we need to store large no of pointers in the main memory. Wont that outrun memory space..? Can we use B+ trees ..?Would that be any good..? On 7/29/11, rajeev bharshetty rajeevr...@gmail.com wrote: B Trees data structures are optimal for such problems. These algorithms help

Re: [algogeeks] DS representation.

2011-07-29 Thread Prem Krishna Chettri
For all Folks.. DS question answer cannot be simple yes no. it is always the tradeoff of Space and time Complexity. On Fri, Jul 29, 2011 at 3:26 PM, rajeev bharshetty rajeevr...@gmail.comwrote: You can use a Hash map which maps the coefficients of the equation and their exponents. Is this

Re: [algogeeks]

2011-07-29 Thread vaibhav shukla
If u have 2GB of data file which has one string per line and u have to sort it, and X MB of memory is available.then divide the file into 'K' chunks of X MB each. Bring each chunk into memory and sort lines by any usual O(nlgn) algorithm \. Save the lines back to files. D this for all chunks and

Re: [algogeeks] DS representation.

2011-07-29 Thread Puneet Gautam
@sunny: well not really in an interview .. its that adobe is coming 1st august to our college.. I found this question in its placement papers..!!! I thought there might be a predefined ds for such representation... What is an SLL..? On 7/29/11, rajeev bharshetty rajeevr...@gmail.com wrote:

Re: [algogeeks] Re: plz give some efficient method to find out if a point lies inside or outside the triangle?

2011-07-29 Thread Udit Gupta
Join the given point with all the vertices of the triangle and calculate the area of each of the three sub-triangles thus formed now compare the area of original triangle with the sum of the area of those 3 triangles if that comes out to be equal, then the point lies inside otherwise not. On Fri,

Re: [algogeeks] DS representation.

2011-07-29 Thread sunny agrawal
SLL = singly linked list but i think array is better choice :) On Fri, Jul 29, 2011 at 3:36 PM, Puneet Gautam puneet.nsi...@gmail.comwrote: @sunny: well not really in an interview .. its that adobe is coming 1st august to our college.. I found this question in its placement papers..!!! I

[algogeeks] !!!!

2011-07-29 Thread naveen ms
The minimum number of multiplications required to evaluate the expression a + bx + cx2 + dx3 + ex4 is 1). 4 2) 5 3). 3 4) 7how to solve these kind of questions...?? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group,

Re: [algogeeks] !!!!

2011-07-29 Thread Anurag Narain
4 a+x(b+x(c+x(d+ex))) -- 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,

[algogeeks] Doubt

2011-07-29 Thread Nikhil Gupta
What is meant by the statement : byte0 = (num x00FF) 0 And what is meant by the operators , ^ , , | and how are they used? -- Nikhil Gupta Senior Co-ordinator, Publicity CSI, NSIT Students' Branch NSIT, New Delhi, India -- You received this message because you are subscribed to the

Re: [algogeeks] Doubt

2011-07-29 Thread aditi garg
right shift.^ Xor, and,| OR operators... the statement means u r anding the bits of num wid the bits in the hexadecimal number x000FF and thn right shifting the bits by 0 number of times( effectively in this case u wont be shifting) On Fri, Jul 29, 2011 at 5:50 PM, Nikhil Gupta

Re: [algogeeks] NIT Warangal people

2011-07-29 Thread Snigdha Chandan
Which College ?? On Fri, Jul 29, 2011 at 4:19 PM, azad azad.monik...@gmail.com wrote: please share the questions of facebook interviwe rounds, fb coming in my coll on 5th.. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this

Re: [algogeeks] doubt in checking if 2 strings are anagrams

2011-07-29 Thread Siddharth kumar
for long strings, the values will be larger. a simple approach could be to store occurrence of each char of both the strings in an integer array of size 26 and if both the arrays are same then the two strings are anagrams. -- You received this message because you are subscribed to the

Re: [algogeeks] Doubt

2011-07-29 Thread Nikhil Gupta
And what does ~ operator do? On Fri, Jul 29, 2011 at 5:59 PM, aditi garg aditi.garg.6...@gmail.comwrote: right shift.^ Xor, and,| OR operators... the statement means u r anding the bits of num wid the bits in the hexadecimal number x000FF and thn right shifting the bits by 0 number of

Re: [algogeeks] Doubt

2011-07-29 Thread rajeev bharshetty
~ does bitwise not on the operand . It simply inverts all the bits . On Fri, Jul 29, 2011 at 7:09 PM, Nikhil Gupta nikhilgupta2...@gmail.comwrote: And what does ~ operator do? On Fri, Jul 29, 2011 at 5:59 PM, aditi garg aditi.garg.6...@gmail.comwrote: right shift.^ Xor, and,| OR

Re: [algogeeks] doubt in checking if 2 strings are anagrams

2011-07-29 Thread Siddharth kumar
#includeiostream #includestring.h using namespace std; int main() { char str1[] = sdfgkirertyujvcheddirtyutrdfgrtyuigfkrertyuijhgfdshh; char str2[] = redirtyhgfdshhrtyrsujvcheierdutrdfgrtyuigfkdfgktyuij; int len1 = strlen(str1), len2 = strlen(str2); if(len1 != len2) {

Re: [algogeeks] !!!!

2011-07-29 Thread saurabh singh
well this one followed the well known horners rule, On Fri, Jul 29, 2011 at 5:41 PM, Anurag Narain anuragnar...@gmail.comwrote: 4 a+x(b+x(c+x(d+ex))) -- 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] !!!!

2011-07-29 Thread naveen ms
thank u:) -- 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

[algogeeks] static array

2011-07-29 Thread Arshad Alam
what would be the output of below program #includestdio.h #includeconio.h void main() { clrscr(); static int a[5]; int i; for(i=0;i=4;i++) printf(\n%d,a[i]); getch(); } -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

Re: [algogeeks] do while problem

2011-07-29 Thread Ankur Khurana
or cin.ignore() or while(getchar()!='\n'0; instead of only a getchar. On Fri, Jul 29, 2011 at 5:03 PM, sunny agrawal sunny816.i...@gmail.comwrote: when you enter two numbers and press Enter new line character is passed as character c Change your code as Follows: printf(do you want to

Re: [algogeeks] doubt in checking if 2 strings are anagrams

2011-07-29 Thread saurabh singh
use a bitfield to optimize space On Fri, Jul 29, 2011 at 7:14 PM, Siddharth kumar siddhartha.baran...@gmail.com wrote: #includeiostream #includestring.h using namespace std; int main() { char str1[] = sdfgkirertyujvcheddirtyutrdfgrtyuigfkrertyuijhgfdshh; char str2[] =

[algogeeks] Re: permutation of string with repeated characters...

2011-07-29 Thread amit karmakar
i more thing ... the code repeats same palindromes as in incase of ABA baa is coming twice.. Put back mk array in place and baa won't be repeated. The idea is that out of all available options for filling a particular position in our partial solution at each round of backtracking we choose for

Re: [algogeeks] static array

2011-07-29 Thread aditi garg
0 0 0 0 0 On Fri, Jul 29, 2011 at 7:35 PM, Arshad Alam alam3...@gmail.com wrote: what would be the output of below program #includestdio.h #includeconio.h void main() { clrscr(); static int a[5]; int i; for(i=0;i=4;i++) printf(\n%d,a[i]); getch(); }

Re: [algogeeks] static array

2011-07-29 Thread sagar pareek
0 0 0 0 0 u are taking array static which initialize its elements with zero :) On Fri, Jul 29, 2011 at 7:38 PM, aditi garg aditi.garg.6...@gmail.comwrote: 0 0 0 0 0 On Fri, Jul 29, 2011 at 7:35 PM, Arshad Alam alam3...@gmail.com wrote: what would be the output of below program

[algogeeks] Re: permutation of string with repeated characters...

2011-07-29 Thread amit karmakar
The seen array filters out the characters which are available for filling a particular position. The mk array makes sure that we choose only one of the repeated characters. for example, if the array is aba if mk array is there backtracking will try like String : a _ _ or b _ _

Re: [algogeeks] static array

2011-07-29 Thread Arshad Alam
Yes I agree static variables initialises with 0 but 0 will be at the very first position of the array, so what about second, third ... positions of array..why all those are also 0 but it should be any garbage value... please clarify it. On Fri, Jul 29, 2011 at 7:38 PM, sagar pareek

Re: [algogeeks] doubt in checking if 2 strings are anagrams

2011-07-29 Thread snehi jain
thanks .. @siddhartha : i know the hashing technique ... and the problem of longer strings can be reduced by subtracting a large constant value from the ASCII value of all the characters .. and its not only with cubes even if u add squares of ascii values ... i think it will work . @saurabh : in

[algogeeks] Re: constraint programming

2011-07-29 Thread hafsainfo
thank you On 29 juil, 06:32, pschaus psch...@gmail.com wrote: I'm not familiar with Choco in particular but you are probably trying to post an element constraint. Make sure that the index variable has a domain inside the range of the array on which you apply the element (-1 should not be in

Re: [algogeeks] doubt in checking if 2 strings are anagrams

2011-07-29 Thread saurabh singh
ignore above status...i was looking at two problems simulataneously...posted on the wrong one... apologies...really its embarrasing. On Fri, Jul 29, 2011 at 8:11 PM, snehi jain snehijai...@gmail.com wrote: thanks .. @siddhartha : i know the hashing technique ... and the problem of longer

Re: [algogeeks] doubt in checking if 2 strings are anagrams

2011-07-29 Thread snehi jain
no problem .. but can u find a bug in this technique .. On Fri, Jul 29, 2011 at 8:17 PM, saurabh singh saurab...@gmail.com wrote: ignore above status...i was looking at two problems simulataneously...posted on the wrong one... apologies...really its embarrasing. On Fri, Jul 29, 2011 at 8:11

Re: [algogeeks] doubt in checking if 2 strings are anagrams

2011-07-29 Thread saurabh singh
Things can go very bad in case the string length is large and mostly of non priniting chars. and wat if there are chars with negative ascii value?does ur logic handles this situation?I doubt it does, On Fri, Jul 29, 2011 at 8:21 PM, snehi jain snehijai...@gmail.com wrote: no problem .. but can

[algogeeks] Re: permutation of string with repeated characters...

2011-07-29 Thread amit karmakar
there was an typo, if mk array is *not* there backtracking will try like On Jul 29, 7:13 pm, amit karmakar amit.codenam...@gmail.com wrote: The seen array filters out the characters which are available for filling a particular position. The mk array makes sure that we choose only one of the

[algogeeks] Re: plz give some efficient method to find out if a point lies inside or outside the triangle?

2011-07-29 Thread Don
That should work, but I'd bet that my method is faster. Don On Jul 29, 6:02 am, Udit Gupta uditgupta...@gmail.com wrote: Join the given point with all the vertices of the triangle and calculate the area of each of the three sub-triangles thus formed now compare the area of original triangle

Re: [algogeeks] static array

2011-07-29 Thread sagar pareek
During declaration of static variables.. after assigning memory to all the elements it initialize *ALL THE MEMORY ALLOTTED *members with zero...* * On Fri, Jul 29, 2011 at 8:09 PM, Arshad Alam alam3...@gmail.com wrote: Yes I agree static variables initialises with 0 but 0 will be at the very

Re: [algogeeks] static array

2011-07-29 Thread Arshad Alam
ok thanx brother i got now On Fri, Jul 29, 2011 at 9:07 PM, sagar pareek sagarpar...@gmail.com wrote: During declaration of static variables.. after assigning memory to all the elements it initialize *ALL THE MEMORY ALLOTTED *members with zero...* * On Fri, Jul 29, 2011 at 8:09 PM,

Re: [algogeeks]

2011-07-29 Thread ankit sambyal
@anika: Here is the iterative code: void iter_mirror(Node *root) { if(root==NULL) return; Node *stack[100]; Node *temp,*temp1; int top=-1; stack[++top]=root; while(top!=-1) { temp=stack[top]; temp1=temp-left; temp-left=temp-right;

Re: [algogeeks]

2011-07-29 Thread Puneet Gautam
@vaibhav :Cool ...!! thanks buddy..! On 7/29/11, vaibhav shukla vaibhav200...@gmail.com wrote: If u have 2GB of data file which has one string per line and u have to sort it, and X MB of memory is available.then divide the file into 'K' chunks of X MB each. Bring each chunk into memory and

  1   2   >