Data structures Interview Questions | Glassdoor

Data structures Interview Questions

117

interview questions shared by candidates

Data structures Interview Questions

Sort: RelevancePopular Date

Binary tree with parent pointers, given two nodes find common ancestor.

3 Answers

Write a code for finding a certain element in an unsorted array assuming element definitely exists. How can we improve the efficiency?

3 Answers

Write an algorithm that does an in-order traversal of a tree recursively. Now, write the same algorithm iteratively.

4 Answers

How would you print last n elements of a linked list, n being small compared to size of linked list?

3 Answers

Given an array of integers, all but one of which appears an even number of times, find the one integer which appears an odd number of times.

3 Answers

Give me 5 different ways of finding the median (middle element) of a linked list. For the sake of simplicity, assume the list has odd number of ints. Also mention the runtime for each. Follow up: What's the fastest way you could find the median? What is the runtime? Oh.. and yes, code your answer(s) in any language of your preference.

4 Answers

How would you implement a stack to achieve constant time for "push", "pop" and "find mininum" operations?

3 Answers

1. Find common elements between two arrays of integers. 2. Find cycles in a graph. 3. Efficiently find duplicate elements in an array of numbers with bounded entries (for example, elements are between 0 and 99). 4. Reverse word sequence in a string inplace. 5. Efficiently find all Pythogorean triplets in a given array of integers. 6. Find all anagrams in a list of words. 7. Set operations.

2 Answers

Create a Queue using two Stacks.

2 Answers

3. Trees (binary and otherwise) form the basis of many common data structures. Please describe some of these data structures and when they might be used.

2 Answers
2130 of 117 Interview Questions