Citrix System Inc Interview Question for Software Engineer / Developers






Comment hidden because of low score. Click to expand.
0
of 0 vote

The standerd algo is using fast & slow pointers. Fast one incremented by 2 & slow one by 1. We check whether they meet. Now, in a list having cycles we have linear nodes followed by the loop. Fast pointer reach the loop first. When slow pointer reachs the loop say the fast pointer is n nodes ahead in the loop. In every iteration from then this distance reduces by 1. So after n iterations they meet & we find the loop.

If fast ptr is incremented by 3 & slow ptr by 2, we still get the correct result since after both ptr reach the loop the distance betwwen them reduces by 1 in every iteration. However this is less efficient then the first one, since more increments are done to get the same result.

- um December 25, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

how come more increments ..cna you explain ?

- adhi January 12, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

I think it will take equal number of iterations as before. This is because it will converge after n iterations.
Correct me if i am wrong

- Anonymous March 31, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

the number of iterations may be different... number of loops in 2-1 will be less than equal to 3-2. For example take a loop of 8 elements.

- AJ May 08, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Please find my number 9870254038

- Pooja Ghadge May 06, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Please find it

- Pooja Ghadge May 06, 2011 | Flag


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More