Symantec
3.2 of 5 1,424 reviews
www.symantec.com Mountain View, CA 5000+ Employees

Symantec Software Engineer Interview Question

I interviewed in Culver City, CA and was asked:
"how to detect cycle in linked list"
Tags: linked list cycle
Add Tags [?]
Answer Flag Question

Part of a Software Engineer Interview Review - one of 289 Symantec Interview Reviews

Answers & Comments

1
of 1
vote
use the fast and slow pointers to detect cycles: one pointer move 1 node at a time, one pointer moves 2 nodes at a time, if there is a cycle then these pointers will meet at some point
- Interview Candidate on Jul 10, 2011 Flag Response
1
of 1
vote
I would create a HashSet to store the set of references (or pointers). Traverse the LL and insert references in the set. Before inserting reference of a node, check to see if the set contains the reference already. If it does, then the LL has a cycle.
- Hari on Sep 23, 2012 Flag Response

To comment on this question, Sign In with Facebook or Sign Up


Symantec – Why Work for Us?

​​What do Symantec employees have in common? We are passionate about what we do and contribute to something really important! We protect the world’s digital information and interactions. At Symantec, you will enjoy an… Full Overview

Provided by employer [?]

Tags are like keywords that help categorize interview questions that have something in common.

Glassdoor is your free inside look at Symantec interview questions and advice. All interview reviews posted anonymously by Symantec employees and interview candidates.