[algogeeks] Re: question on fork()

2011-08-22 Thread Yasir
Surprisingly, if I comment the last if condition ( which is AFTER red() call ), it is printing red only 6 times as expected.. http://ideone.com/XMHzC main() { fork(); int color=fork(); if(color==0) fork(); red(); //if(color==0) //

[algogeeks] Re: Possible solutions to these sort of Questions

2011-08-17 Thread Yasir
For questions specifically asking about test cases, I would suggest following 3 step approach: First think of a* basic flow that MUST work for the application* (what is expected with the application. Firstly make it clear with you interviewer). eg: 1) User should be able to open Notepad

[algogeeks] Re: Algorithms For Interviews

2011-08-16 Thread Yasir
It was posted recently.. Check the achieves. :) -- 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/-/Lv9GSMFFS00J. To post to this group, send email to

[algogeeks] Re: Algorithms For Interviews

2011-08-16 Thread Yasir
Typo: achieves -- archives -- 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/-/ccCkVtfs3y4J. To post to this group, send email to algogeeks@googlegroups.com.

Re: [algogeeks] Array Problem

2011-08-14 Thread Yasir
any O(nlogn) solution? -- 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/-/7Q8DHLIlbDoJ. To post to this group, send email to algogeeks@googlegroups.com. To

[algogeeks] Re: Closest ancestor of two nodes

2011-08-14 Thread Yasir
Guys, How about the below mentioned implementation? The only assumptions is that nodes should exist in the tree. (will fail if one node exists and another doesn't) static Node LCA(Node root, int d1, int d2){ if(root==null) return root; if(root.left!=null ( root.left.data == d1 ||

[algogeeks] Re: fork() question

2011-08-14 Thread Yasir
Check out second run of same code: http://ideone.com/TK4qu. This time it printed only 8 times. The reason behind this is that, you are using a web based compiler and it sends back the output as soon as main completes its execution. However forked child are yet to complete. -- You received

Re: [algogeeks] Re: an array question

2011-08-14 Thread Yasir
@Ankur, what if the numbers are 23 232?? 23 add 0 == 230 Since, 232 230 === 232 should come first.. Hence answer: 23223. However; 23232 is greater.. wutta say? :-/ -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion

Re: [algogeeks] Re: an array question

2011-08-14 Thread Yasir
Not Sure! Me too looking for a solution.. :D So far, Kunal's approach (Convert each string to length max_size where you append it circularly) seems to be working fine. :-) ..and Chengjie's approach should also work, but the interviewer rejected this idea saying, he wants a good logic for

Re: [algogeeks] Re: logic???????????

2011-08-13 Thread Yasir
Yeah got it. Thanks :) -- 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/-/NAqtuyQmehgJ. To post to this group, send email to algogeeks@googlegroups.com. To

[algogeeks] Need Pointers for dynamic programming concept problems

2011-08-13 Thread Yasir
Hi! Any good source for dynamic programming problems (along with concept)?? No lmgtfy, Please. Direct links will be appreciated. Thanks -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit

[algogeeks] Array question: Detect whether a circular chain with all elements can be formed

2011-08-13 Thread Yasir
An array of strings is given and you have to find out whether a circular chain with all character can be formed or not? Circular chain is formed in way that: if last char of a string is equal to first char of another string then it can be joined.: like ab bxc === axbbxc

Re: [algogeeks] Need Pointers for dynamic programming concept problems

2011-08-13 Thread Yasir
@Raghavan, Thanks man :) -- 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/-/lGIZaHYTu3cJ. To post to this group, send email to algogeeks@googlegroups.com. To

Re: [algogeeks] String Question

2011-08-13 Thread Yasir
Me too didn't get Raghavan's algo... Pls explain.. It seems that above algo will find only longest sequence starting from index 0. Just a thought: Along with raghavan's algo, what if I keep and array_of_integers[string_length] and keep on storing the count in this array. Once string is

Re: [algogeeks] n*n array

2011-08-13 Thread Yasir
Hey, can anyone pls share logic/pseudo code for N*M? (When N can be less than or greater than M.) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit

[algogeeks] Re: TREE question

2011-08-13 Thread Yasir
... if(something) return true; else return false; . // few statements here . Will few statements ever execute?? -- 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] Array question: Detect whether a circular chain with all elements can be formed

2011-08-13 Thread Yasir
why following? if(first==last) return false; example: axxa, ayyb, bzza === ayybbzzaaxxa -- 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] Algorithms for Interviews _scan ocr_.pdf

2011-08-13 Thread Yasir
Kudos to Aditi. :D -- 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/-/gnhokgp_zV0J. To post to this group, send email to algogeeks@googlegroups.com. To

[algogeeks] Re: citrix rd????

2011-08-13 Thread Yasir
Typically first round is coding on paper. (they will ask you to code 2-3 problems.) Brush up bitwise operations ( shifting, and, or, xor), Strings Arrays problems. You may get tree/ll questions as well. but their solutions won't be too large. Like other companies, in interview, mainly DS/OS

Re: [algogeeks] Algorithms for Interviews _scan ocr_.pdf

2011-08-13 Thread Yasir
Oh! come on. It is working! :) anyways, I have mirrored it at http://goo.gl/rbSNE Cheers! \o/ -- 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/-/iHSvoolOJwgJ.

[algogeeks] Re: citrix rd????

2011-08-13 Thread Yasir
I havn't attended citrix's campus drive this year. This is the last year's process. Hopefully would be same. :) Good Luck! -- 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] Algorithms for Interviews _scan ocr_.pdf

2011-08-13 Thread Yasir
@gopi, Mirrored link http://goo.gl/rbSNE is also not working??? it is a 15.5mb file, will take some time to appear on browser (incase you r using FF). -- 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] logic???????????

2011-08-13 Thread Yasir
@Sagar ..an array which is sorted but rotated by some k places which is nt kwn Kindly note that: ARRAY IS KNOWN, k is NOT known. If the array is not known then where will you search an item??? :P :P -- You received this message because you are subscribed to the Google Groups Algorithm

[algogeeks] an array question

2011-08-12 Thread Yasir Imteyaz
An array of integers is given and you have to find the largest possible integer by concatenating all elements: example: array: 87 36 52 answer: 875236 array: 87 9 52 answer: 98752 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view

Re: [algogeeks] an array question

2011-08-12 Thread Yasir
Kindly check it with both the examples. It won't work. -- 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/-/VlT1DNH-vPkJ. To post to this group, send email to

[algogeeks] Re: an array question

2011-08-12 Thread Yasir
@dave, Awesome approach. It was really tough to find a counter example. :D 1st number: 23 2nd number: 23235 Applying ur algo: 23 - 2 -- 23235 Answer using ur algo: 2323235 However the correct answer should be: 2323523 Am I missing something in the above example? :-/ -- You

Re: [algogeeks] Re: logic???????????

2011-08-12 Thread Yasir
how abt http://ideone.com/lN2og ?? -- 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/-/pZdvFb_t2b4J. To post to this group, send email to

[algogeeks] Re: Bitwise operators

2011-08-07 Thread Yasir
let say a=6; binary= 0110 b = ~a = 1001 Now when you print value of ~a or b, it is calculating 2's complement. 1's complement: 0110 2's complement: 0111 (value = -7) Pls check signed bit representation for details. On Aug 7, 4:40 pm, Shashank Jain shashan...@gmail.com

[algogeeks] Re: Bitwise operators

2011-08-07 Thread Yasir
Engineering Delhi College of Engineering On Sun, Aug 7, 2011 at 5:39 PM, Yasir yasir@gmail.com wrote: let say a=6;  binary=   0110 b = ~a =   1001 Now when you print value of ~a or b, it is calculating 2's complement. 1's complement: 0110 2's complement: 0111  (value

[algogeeks] Re: Bitwise operators

2011-08-07 Thread Yasir
0111 -- 0 Kindly, check out following link for more details on 2's complement: http://academic.evergreen.edu/projects/biophysics/technotes/program/2s_comp.htm Thanks, Yasir On Aug 7, 6:01 pm, Shashank Jain shashan...@gmail.com wrote: nd moreover

[algogeeks] A Nice Programming Challenge Question

2011-08-07 Thread Yasir
Guys, Let's try to find out an efficient solution for the following prob: Given N numbers , [N=10^5] we need to count the total pairs of numbers that have a difference of K. [K0 and K1e9] Input Format: 1st line contains N K. 2nd line contains N numbers of the set. All the N numbers are assured

[algogeeks] Re: A Nice Programming Challenge Question

2011-08-07 Thread Yasir
=(x+K),if the elements are not distinct then the number of pairs will be the upper_bound()-lower_bound() for y. Complexity:O(nlogn) On Sun, Aug 7, 2011 at 11:23 PM, Yasir yasir@gmail.com wrote: Guys, Let's try to find out an efficient solution for the following prob: Given N

Re: [algogeeks] A Nice Programming Challenge Question

2011-08-07 Thread Yasir Imteyaz
@Shuaib, You are right, this approach will work! :) But for each element 'e' instead of checking whether *|K-e| *exists, *you should check for either (e+K) or (e-K).* But here the question is, will the hash map really give o(1) access for such a large record? ..and is it a good practice to

[algogeeks] Re: amazon online test format

2011-08-06 Thread Yasir
You can take out sample test at http://www.interviewstreet.com/recruit/test/start/sample Amazon uses same env for online coding test. On Aug 6, 5:55 pm, Atul Verma atul.iit...@gmail.com wrote: it's not like cc format. first they'll ask ur logic and then they see ur code. (no submission

[algogeeks] Re: amazon online test format

2011-08-06 Thread Yasir
Earlier they had telephonic interview as first round but now this online exam has become initial screening test. Based on ur online test's performance they call for phonic round or on- site interview. In online test, there there are 10 mcq questions and 5 coding probs. Cheers \o/ On Aug 6, 7:17 

[algogeeks] Re: amazon online test format

2011-08-06 Thread Yasir
Almost same. For big probs, they don't ask for running code. Only pseudo-code is enough. On Aug 6, 9:42 pm, Ankur Garg ankurga...@gmail.com wrote: The questions in the link are quite decent...Is the toughness level of Amazon test same or more ? On Sat, Aug 6, 2011 at 11:47 AM, shady

[algogeeks] Re: amazon online test format

2011-08-06 Thread Yasir
Same as of DS Algo in GATE exam. http://geeksforgeeks.org/?cat=66 On Aug 7, 2:29 am, Ankur Garg ankurga...@gmail.com wrote: @Yasir MCQ are of which types ??? Regards Ankur Garg On Sat, Aug 6, 2011 at 4:45 PM, Yasir yasir@gmail.com wrote: Earlier they had telephonic interview