TATA Consultancy Services Interview Question for SDE1s


Country: India
Interview Type: In-Person




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

linked list gives us the advantage of not needing to maintain the context of length of the queue and current position. All we would need is pointer to current node we can write into.

Where as with array we need to know the length of the array to traverse the array in circular fashion else we will have buffer overflows. Array is always storage efficient but is running time heavy..

- Suhas Manangi July 12, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Also in linked list, "next" pointers increases the space required.

- Klaus July 21, 2015 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

linkedlist - this gives us the ease of needing to know only current node, no need to know the length of the queue nor the current node's position from the start.

array - this is good for storage complexity but will be more running complexity as implementation requires you to know the length of the array and current position from the start or the end of the array.

- suhasjm July 12, 2015 | Flag Reply


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