Suppose you have an array of 99 numbers. The array contains the digits 1 to 100 with one digit missing. Describe four different algorithms to compute the missing number. Two of these should optimize for low storage and two of these should optimize for fast processing.
Perl Performance Interview Questions
- Describe how you would store a social graph in a relational database.
- Describe an efficient algorithm to determine whether or not person X is a 2nd degree connection of person Y.
- Describe an efficient algorithm to determine whether or not person X is a 3rd degree connection of person Y.
- How can you make #3 very quick. E.g. how does Linked In compute 3rd degree connections quickly?
Write a string to find a substring in a given string. Do this in O(n) or better
What is a hashtable? Give an example of a type of problem that a hashtable is useful for.
Explain big o notation and how it is useful in computer science to classify algorithms.
- What order is a hash table lookup?
- What order is determining if a number is even or odd?
- What order is finding an item in an unsorted list?
- What order is a binary search?
For the data structures: Array and Linked List explain:
- Where you might use them
- Operations that are commonly supported (add, insert etc)
Design a system to efficiently calculate the top 1MM Google search queries and create a report of these. Additionally:
- You are given twelve servers
- Each has two processors, 4GB of ram and four 400GB hard drives.
- The machines are networked
- The log data as roughly 100 Billion log lines in it.
- The log data comes in twelve, 320 Gb files.
- Each line of the files has roughly 40 search queries
- You can only use open source software or software that you write.
Write a function to efficiently determine the result of a game of Tic Tac Toe.
The function takes as input the game and the sign (x or o) of the player. The function returns if this player has won the game or not.
Carefully consider both the data structure and the algorithm for your answer.
Efficiently calculate the shortest distance between two Facebook users given an API endpoint that returns all friends of a given user.
Given any integer, efficiently find the next highest integer that uses the same digits.
For example if the number is 15432, you should return 21345.
Write a function that, given a word and a dictionary will efficiently return the minimal edits (character addition or deletion) to get to a word that exists in the dictionary.
Given two arrays of strings, A and B.
B contains every element in A, and has one additional member, for example:
* A = ['dog', 'cat', 'monkey]
* B = ['cat', 'rat', 'dog', 'monkey']
Write a function to find the extra string in B. Do this in O(n)