Presentation is loading. Please wait.

Presentation is loading. Please wait.

Data Structures Interview Questions.

Similar presentations


Presentation on theme: "Data Structures Interview Questions."— Presentation transcript:

1 Data Structures Interview Questions

2 C++ Data Structure Runtimes
Insert Find Delete vector O(n) O(1) amortized O(1) if index is known sorted vector O(log(n)) linked list (list, stack, queue) O(1) *Given an Iterator balanced binary tree (map, set) hash table (unordered_set, unordered_map) Heap (priority_queue) N/A O(1) to find min

3 Common Interview Questions
*These types of questions will not be on the final exam Find the middle element of a linked list in one pass. What if the list has a cycle? Detect a cycle in a linked list.

4 Common Interview Questions
*These types of questions will not be on the final exam Given an array of size 100 containing one copy each of the integers with exactly one integer being repeated once, find the repeated integer. Given an array of arbitrary integers, find all integers that appear exactly twice.

5 Common Interview Questions
*These types of questions will not be on the final exam Implement a stack that can also give the minimum element in the stack at any given time. push, pop, and min must all run in O(1) time.

6 Common Interview Questions
*These types of questions will not be on the final exam In class we described a stack that was implemented as a linked list. How could we implement a stack as a vector? How could we use a single vector to implement 3 stacks?

7 Common Interview Questions
*These types of questions will not be on the final exam Give a function that will sort a vector of string such that all the anagrams are next to each other, ignoring spaces. Two words are anagrams of each other if they use exactly the same letters ex. “interpreter” and “enter err pit”


Download ppt "Data Structures Interview Questions."

Similar presentations


Ads by Google