Perl Performance Interview Questions

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.

  1. Describe how you would store a social graph in a relational database.
  2. Describe an efficient algorithm to determine whether or not person X is a 2nd degree connection of person Y.
  3. Describe an efficient algorithm to determine whether or not person X is a 3rd degree connection of person Y.
  4. How can you make #3 very quick. E.g. how does Linked In compute 3rd degree connections quickly?

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?

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.