Ebook Cracking the coding interview (5/E): Part 2
➤ Gửi thông báo lỗi ⚠️ Báo cáo tài liệu vi phạmNội dung chi tiết: Ebook Cracking the coding interview (5/E): Part 2
Ebook Cracking the coding interview (5/E): Part 2
Interview QuestionsIvinJoin us at www.CrackingTheCodinglnterview.com to download full, compilable Java / Eclipse solutions, discuss problems from this Ebook Cracking the coding interview (5/E): Part 2s book with other readers, report issues, view this book's errata, post your resume, and seek additional advice.Data StructuresInterview Questions and AdviceArrays and StringsHopefully, all readers of this book are familiar with what arrays and strings are, so we won't bore you with such details. In Ebook Cracking the coding interview (5/E): Part 2stead, we'll focus on some of the more common techniques and issues with these data structures.Please note that array questions and string questions aEbook Cracking the coding interview (5/E): Part 2
re often interchangeable. That is, a question that this book states using an array may be asked instead as a string question, and vice versa.Hash TablInterview QuestionsIvinJoin us at www.CrackingTheCodinglnterview.com to download full, compilable Java / Eclipse solutions, discuss problems from this Ebook Cracking the coding interview (5/E): Part 2le 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 that index.Typically, though, this won't quite work right. In the above implementation, th Ebook Cracking the coding interview (5/E): Part 2e hash value of all possible keys must be unique, or we might accidentally overwrite data. The array would have to be extremely large—the size of allEbook Cracking the coding interview (5/E): Part 2
possible keys—to prevent such 'collisions'Instead of making an extremely large array and storing objects at index hash (key), we can make the array muInterview QuestionsIvinJoin us at www.CrackingTheCodinglnterview.com to download full, compilable Java / Eclipse solutions, discuss problems from this Ebook Cracking the coding interview (5/E): Part 2list for this key.Alternatively, we can implement the hash table with a binary search tree. We can then guarantee an 0( log n) lookup time, since we can keep the tree balanced. Additionally, we may use less space, since a large array no longer needs to be allocated in the very beginning.Prior to you Ebook Cracking the coding interview (5/E): Part 2r interview, we recommend you practice both implementing and using hash tables. They are one of the most common data structures for interviews, and itEbook Cracking the coding interview (5/E): Part 2
's almostCrackingTheCodinglnterview.com71Chapter 1 I Arrays and Stringsa sure bet that you will encounter them in your interview process.Below is a siInterview QuestionsIvinJoin us at www.CrackingTheCodinglnterview.com to download full, compilable Java / Eclipse solutions, discuss problems from this Ebook Cracking the coding interview (5/E): Part 2shMapcInteger, student>();3for (Student s : students) map.put(s.getld(), s);4return map;5}Note that while the use of a hash table is sometimes explicitly required, more often than not, it's up to you to figure out that you need to use a hash table to solve the problem.ArrayList (Dynamically Resizing Ebook Cracking the coding interview (5/E): Part 2 Array)An ArrayList, or a dynamically resizing array, is an array that resizes itself as needed while still providing 0(1) access. A typical implementEbook Cracking the coding interview (5/E): Part 2
ation is that when the array is full, the array doubles in size. Each doubling takes 0(n) time, but happens so rarely that its amortized time is stillInterview QuestionsIvinJoin us at www.CrackingTheCodinglnterview.com to download full, compilable Java / Eclipse solutions, discuss problems from this Ebook Cracking the coding interview (5/E): Part 2ntence.add(w);4for (String w : more) sentence.add(w);5return sentence;6}Interview QuestionsIvinJoin us at www.CrackingTheCodinglnterview.com to download full, compilable Java / Eclipse solutions, discuss problems from thisGọi ngay
Chat zalo
Facebook