google interview university (jwasham) 2

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

How do you solve the Dining Philosophers problem?

"- critical section is picking up one fork, second fork, and then eating then putting down forks.

What are 3 properties of good hashing functions?

"- minimize collisions

What is the difference between a pointer and a reference?

"- must dereference a pointer: foo->prop

How can you solve a set cover problem?

"- pick largest set that covers most of the uncovered spots

What are 3 good uses of hash tables?

"- quick lookups, inserts, and deletes

What are the difference between 32-bit and 64-bit applications?

"32-bit:

What is a suffix array?

"A suffix array is a sorted array of all suffixes of a string.

What does ACID stand for?

"Atomicity

What is tri-color marking?

"Because of these performance problems, most modern tracing (mark and sweep) garbage collectors implement some variant of the tri-color marking abstraction. This avoids the execution pause common to mark and sweep.

What are 2 examples of probabilistic data structures?

"Bloom filter

What are some differences between C++ and Java?

"C++:

Difference between inline functions and macros?

"Each reduces overhead of function calls at the expense of program size

What is the relationship to false positives/negatives with a Bloom filter?

"False negatives are not possible.

What are the pros and cons of garbage collection?

"Good:

Is knapsack problem NP-complete?

"The decision problem form of the knapsack problem (Can a value of at least V be achieved without exceeding the weight W?) is NP-complete, thus there is no known algorithm both correct and fast (polynomial-time) on all cases.

How are interfaces handled in Python?

"There are none.

What is a hard problem that is not in NP?

"Two-player games such as chess provide examples of problems that are not in NP.

How do you represent negative infinity in Python?

-float('Inf')

What is a spinlock?

A form of busy waiting, that waits in a loop and repeatedly checks if a lock is available.

If this exists, you can't use Dijkstra.

A negative-weight edge.

Maintaining a sorted array is good for what type of operations?

A sorted array will be appropriate if and only if there are not many insertions or deletions.

Why are Fibonacci heaps special?

Fibonacci heaps support insert and decrease-key operations in constant amortized time, with O(lg n) amortized time extract-min and delete operations.

What should you do to make a Singleton thread-safe?

It's best to make getInstance() thread-safe, or make generating the instance thread-safe so getInstance does not suffer from thread-safety overhead each time it's called.

How can you transpose a matrix in a matrix?

Label each row and column with row and column number. Sort by column, then by row.

What is a tracing garbage collector?

Mark and sweep: pauses execution in order to mark all objects referenced by any thread of the program.

What is memory-mapping?

Memory-mapping a file uses the operating system virtual memory system to access the data on the file system directly, instead of using normal I/O functions. Memory-mapping typically improves I/O performance because it does not involve a separate system call for each access and it does not require copying data between buffers - the memory is accessed directly by both the kernel and the user application.

Why is an adjacency list for the best choice for a planar graph?

Planar graphs are always sparse, since any n-vertex planar graph can have at most 3n − 6 edges. Thus they should be represented using adjacency lists.

How can you rotate an array of size n by k positions?

Reverse 0 to k - 1, reverse k to end. Then reverse it all.

What makes van Emde Boas trees special?

Van Emde Boas priority queues support O(lg lg n) insertion, deletion, search, max, and min operations where each key is an element from 1 to n.

What is bcrypt?

bcrypt is a password hashing function based on the Blowfish cipher. Besides incorporating a salt to protect against rainbow table attacks, bcrypt is an adaptive function: over time, the iteration count can be increased to make it slower, so it remains resistant to brute-force search attacks even with increasing computation power.

How do you represent infinity in Python?

float('Inf')

What can you use to solve linear programming problems in Python?

numpy.linalg.solve()

What can you use to compute all-pairs shortest-paths?

scipy.sparse.csgraph.floyd_warshall

What algorithm is used for locality-sensitive hashing?

simhash

When using k-nearest neighbors, what k should be used for size of points n?

sqrt(n)


Set pelajaran terkait

Introduction to the Philippine Folk Dance/ Common Dance Terms in Folkdance

View Set

Global Competition for Products and Services and Jobs

View Set

Information Security Chapter 8 Review Questions

View Set

Historic Documents That Influenced Ideas About the U.S. Government

View Set