Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (42.53 MB, 435 trang )
Join us at www.CrackingTheCodinglnterview.com to download full,
compilable Java / Eclipse solutions, discuss problems from this book
with other readers, report issues, view this book's errata, post your
resume, and seek additional advice.
Interview Questions and Advice
Arrays and Strings
opefully, all readers of this book are familiar with what arrays and strings are, so we
won't bore you with such details. Instead, we'll focus on some of the more common
techniques and issues with these data structures.
Please note that array questions and string questions are often interchangeable.That is,
a question that this book states using an array may be asked instead as a string question, and vice versa.
A hash table is a data structure that maps keys to values for highly efficient lookup. In a
very simple implementation of a hash table, the hash table has an underlying array and
a hash function. When you want to insert an object and its key, the hash function maps
the key to an integer, which indicates the index in the array. The object is then stored at