Muutke küpsiste eelistusi

Elements of Programming Interviews in Java: The Insiders' Guide [Pehme köide]

(Centre for the Study of Law and Governance), ,
  • Formaat: Paperback / softback, 528 pages, kõrgus x laius x paksus: 229x152x27 mm, kaal: 699 g
  • Ilmumisaeg: 19-Sep-2015
  • Kirjastus: Createspace Independent Publishing Platform
  • ISBN-10: 1517435803
  • ISBN-13: 9781517435806
Teised raamatud teemal:
  • Formaat: Paperback / softback, 528 pages, kõrgus x laius x paksus: 229x152x27 mm, kaal: 699 g
  • Ilmumisaeg: 19-Sep-2015
  • Kirjastus: Createspace Independent Publishing Platform
  • ISBN-10: 1517435803
  • ISBN-13: 9781517435806
Teised raamatud teemal:
Get a PDF sampler of EPI from http://bit.ly/http://elementsofprogramminginterviews.com/sample/

Have you ever...

  • Wanted to work at an exciting futuristic company?
  • Struggled with an interview problem that could have been solved in 15 minutes?
  • Wished you could study real-world computing problems?

If so, you need to read Elements of Programming Interviews (EPI).

The core of EPI is a collection of 300 problems with detailed solutions, including over100 figures and 250 tested programs. The problems are challenging, well-motivated, and accessible. They are representative of the questionsasked at interviews at the most exciting companies.

The book begins with a summary of patterns for data structure, algorithms, and problem solving that will help you solve the most challenging interview problems. This is followed by chapters on basic and advanced data structures, algorithm design, concurrency, system design, probability and discrete mathematics. Each chapter starts with a brief review of key concepts and results followed by a deep and wide set of questions.

EPI concludes with a summary of the nontechnical aspects of interviewing, including common mistakes, strategies for a great interview, perspectives from across the table, negotiating the best offer, and much more.

"This book is the best compilation of programming related problems I have seen. It is a great resource for a diverse set of topics when preparing for technical interviews, as a quick refresher in a subject area or when you are just looking for a brain teaser to challenge yourself."
Shashank Gupta / Scaligent, formerly Engineering Manager, Amazon.com, Senior Engineering Manager,Yahoo!, Manager of Software Development, Cisco Systems

Introduction 1(5)
I The Interview
6(36)
1 Getting Ready
7(5)
2 Strategies For A Great Interview
12(7)
3 Conducting An Interview
19(4)
4 Problem Solving
23(19)
II Problems
42(459)
5 Primitive Types
43(14)
5.1 Computing the parity of a word
43(2)
5.2 Swap bits
45(2)
5.3 Reverse bits
47(1)
5.4 Find a closest integer with the same weight
47(2)
5.5 Compute x × y without arithmetical operators
49(1)
5.6 Compute x/y
50(1)
5.7 Compute xy
51(1)
5.8 Reverse digits
52(1)
5.9 Check if a decimal integer is a palindrome
53(1)
5.10 Generate uniform random numbers
54(1)
5.11 Rectangle intersection
55(2)
6 Arrays
57(34)
6.1 The Dutch national flag problem
57(4)
6.2 Increment an arbitrary-precision integer
61(1)
6.3 Multiply two arbitrary-precision integers
62(1)
6.4 Advancing through an array
63(1)
6.5 Delete a key from an array
64(1)
6.6 Delete duplicates from a sorted array
65(1)
6.7 Buy and sell a stock once
66(1)
6.8 Buy and sell a stock twice
67(1)
6.9 Enumerate all primes to n
68(2)
6.10 Permute the elements of an array
70(3)
6.11 Compute the next permutation
73(2)
6.12 Sample offline data
75(1)
6.13 Sample online data
76(2)
6.14 Compute a random permutation
78(1)
6.15 Compute a random subset
79(2)
6.16 Generate nonuniform random numbers
81(2)
6.17 The Sudoku checker problem
83(2)
6.18 Compute the spiral ordering of a 2D array
85(3)
6.19 Rotate a 2D array
88(1)
6.20 Compute rows in Pascal's Triangle
89(2)
7 Strings
91(18)
7.1 Interconvert strings and integers
91(1)
7.2 Base conversion
92(1)
7.3 Compute the spreadsheet column encoding
93(1)
7.4 Replace and remove
94(2)
7.5 Test palindromicity
96(1)
7.6 Reverse all the words in a sentence
97(1)
7.7 Compute all mnemonics for a phone number
98(2)
7.8 The look-and-say problem
100(1)
7.9 Convert from Roman to decimal
101(1)
7.10 Compute all valid IP addresses
102(2)
7.11 Write a string sinusoidally
104(1)
7.12 Implement run-length encoding
105(1)
7.13 Implement the UNIX tail command
106(1)
7.14 Find the first occurrence of a substring
107(2)
8 Linked Lists
109(18)
8.1 Merge two sorted lists
110(1)
8.2 Reverse a singly linked list
111(1)
8.3 Reverse a single sublist
112(1)
8.4 Test for cyclicity
113(2)
8.5 Test for overlapping lists---lists are cycle-free
115(1)
8.6 Test for overlapping lists---lists may have cycles
116(2)
8.7 Delete a node from a singly linked list
118(1)
8.8 Remove the kth last element from a list
119(1)
8.9 Remove duplicates from a sorted list
120(1)
8.10 Implement cyclic right shift for singly linked lists
121(1)
8.11 Implement even-odd merge
122(1)
8.12 Test whether a singly linked list is palindromic
123(1)
8.13 Implement list pivoting
124(1)
8.14 Add list-based integers
125(2)
9 Stacks and Queues
127(19)
9.1 Implement a stack with max API
127(3)
9.2 Evaluate RPN expressions
130(2)
9.3 Test a string over "{,},(/),[ ,]" for well-formedness
132(1)
9.4 Normalize pathnames
133(1)
9.5 BST keys in sort order
134(1)
9.6 Search a postings list
135(1)
9.7 Compute buildings with a sunset view
136(2)
9.8 Sort a stack
138(1)
9.9 Compute binary tree nodes in order of increasing depth
139(2)
9.10 Implement a circular queue
141(1)
9.11 Implement a queue using stacks
142(1)
9.12 Implement a queue with max API
143(3)
10 Binary Trees
146(23)
10.1 Test if a binary tree is balanced
148(2)
10.2 Test if a binary tree is symmetric
150(1)
10.3 Compute the lowest common ancestor in a binary tree
151(2)
10.4 Compute the LCA when nodes have parent pointers
153(1)
10.5 Sum the root-to-leaf paths in a binary tree
154(1)
10.6 Find a root to leaf path with specified sum
155(1)
10.7 Compute the kth node in an inorder traversal
156(1)
10.8 Compute the successor
157(1)
10.9 Implement an inorder traversal with O(1) space
158(2)
10.10 Reconstruct a binary tree from traversal data
160(2)
10.11 Reconstruct a binary tree from a preorder traversal with markers
162(1)
10.12 Form a linked list from the leaves of a binary tree
163(1)
10.13 Compute the exterior of a binary tree
163(2)
10.14 Compute the right sibling tree
165(2)
10.15 Implement locking in a binary tree
167(2)
11 Heaps
169(12)
11.1 Merge sorted files
170(2)
11.2 Sort an increasing-decreasing array
172(1)
11.3 Sort an almost-sorted array
173(1)
11.4 Compute the κ closest stars
174(2)
11.5 Compute the median of online data
176(2)
11.6 Compute the κ largest elements in a max-heap
178(1)
11.7 Implement a stack API using a heap
179(2)
12 Searching
181(22)
12.1 Search a sorted array for first occurrence of κ
183(2)
12.2 Search a sorted array for the first element greater than κ
185(1)
12.3 Search a sorted array for entry equal to its index
186(1)
12.4 Search a cyclically sorted array
187(1)
12.5 Compute the integer square root
188(1)
12.6 Compute the real square root
189(2)
12.7 Search in a 2D sorted array
191(2)
12.8 Find the min and max simultaneously
193(2)
12.9 Find the kth largest element
195(2)
12.10 Compute the optimum mailbox placement
197(1)
12.11 Find the missing IP address
198(2)
12.12 Find the duplicate and missing elements
200(3)
13 Hash Tables
203(28)
13.1 Partition into anagrams
204(1)
13.2 Test for palindromic permutations
205(1)
13.3 Is an anonymous letter constructible?
206(2)
13.4 Implement an ISBN cache
208(2)
13.5 Compute the LCA, optimizing for close ancestors
210(1)
13.6 Compute the κ most frequent queries
211(1)
13.7 Find the nearest repeated entries in an array
211(1)
13.8 Find the smallest subarray covering all values
212(5)
13.9 Find smallest subarray sequentially covering all values
217(2)
13.10 Find the longest subarray with distinct entries
219(1)
13.11 Find the length of a longest contained interval
220(2)
13.12 Compute the average of the top three scores
222(2)
13.13 Compute all string decompositions
224(1)
13.14 Find a highest affinity pair
225(2)
13.15 Test the Collatz conjecture
227(2)
13.16 Implement a hash function for chess
229(2)
14 Sorting
231(20)
14.1 Compute the intersection of two sorted arrays
232(2)
14.2 Implement mergesort in-place
234(1)
14.3 Count the frequencies of characters in a sentence
235(1)
14.4 Remove first-name duplicates
236(1)
14.5 Render a calendar
237(2)
14.6 Merging intervals
239(2)
14.7 Compute the union of intervals
241(2)
14.8 Partitioning and sorting an array with many repeated entries
243(3)
14.9 Team photo day---1
246(2)
14.10 Implement a fast sorting algorithm for lists
248(1)
14.11 Compute a salary threshold
249(2)
15 Binary Search Trees
251(29)
15.1 Test if a binary tree satisfies the BST property
251(3)
15.2 Find the first occurrence of a key in a BST
254(2)
15.3 Find the first key larger than a given value in a BST
256(1)
15.4 Find the κ largest elements in a BST
257(1)
15.5 Compute the LCA in a BST
258(1)
15.6 Reconstruct a BST from traversal data
259(3)
15.7 Find the closest entries in three sorted arrays
262(2)
15.8 Enumerate numbers of the form a + b √2
264(3)
15.9 The most visited pages problem
267(2)
15.10 Build a minimum height BST from a sorted array
269(1)
15.11 Insertion and deletion in a BST
270(3)
15.12 Test if three BST nodes are totally ordered
273(1)
15.13 The range lookup problem
274(2)
15.14 Add credits
276(2)
15.15 Count the number of entries in an interval
278(2)
16 Recursion
280(21)
16.1 The Tower of Hanoi problem
280(3)
16.2 Generate all nonattacking placements of n-Queens
283(1)
16.3 Generate permutations
284(2)
16.4 Generate the power set
286(3)
16.5 Generate all subsets of size κ
289(1)
16.6 Generate strings of matched parens
290(1)
16.7 Generate palindromic decompositions
291(2)
16.8 Generate binary trees
293(1)
16.9 Implement a Sudoku solver
294(2)
16.10 Compute a Gray code
296(2)
16.11 Compute the diameter of a tree
298(3)
17 Dynamic Programming
301(30)
17.1 Count the number of score combinations
304(2)
17.2 Compute the Levenshtein distance
306(3)
17.3 Count the number of ways to traverse a 2D array
309(3)
17.4 Compute the binomial coefficients
312(1)
17.5 Search for a sequence in a 2D array
313(2)
17.6 The knapsack problem
315(3)
17.7 The bedbathandbeyond.com problem
318(3)
17.8 Find the minimum weight path in a triangle
321(1)
17.9 Pick up coins for maximum gain
322(2)
17.10 Count the number of moves to climb stairs
324(1)
17.11 The pretty printing problem
325(3)
17.12 Find the longest nondecreasing subsequence
328(3)
18 Greedy Algorithms and Invariants
331(19)
18.1 Implement Huffman coding
332(3)
18.2 Compute an optimum assignment of tasks
335(2)
18.3 Implement a schedule which minimizes waiting time
337(1)
18.4 The interval covering problem
337(5)
18.5 The 3-sum problem
342(1)
18.6 Find the majority element
343(1)
18.7 The gasup problem
344(2)
18.8 Compute the maximum water trapped by a pair of vertical lines
346(1)
18.9 Compute the largest rectangle under the skyline
347(3)
19 Graphs
350(23)
19.1 Identify the celebrity
352(1)
19.2 Search a maze
353(3)
19.3 Paint a Boolean matrix
356(2)
19.4 Compute enclosed regions
358(2)
19.5 Degrees of connectedness---1
360(2)
19.6 Clone a graph
362(1)
19.7 Making wired connections
363(2)
19.8 Transform one string to another
365(1)
19.9 Addition chain exponentiation
366(3)
19.10 Team photo day---2
369(1)
19.11 Compute a shortest path with fewest edges
370(3)
20 Parallel Computing
373(15)
20.1 Implement caching for a multithreaded dictionary
374(2)
20.2 Analyze two unsynchronized interleaved threads
376(1)
20.3 Implement synchronization for two interleaving threads
377(2)
20.4 Implement a thread pool
379(1)
20.5 Deadlock
380(1)
20.6 Implement a Timer class
381(1)
20.7 The readers-writers problem
382(2)
20.8 The readers-writers problem with write preference
384(1)
20.9 Test the Collatz conjecture in parallel
384(2)
20.10 Design TeraSort and PetaSort
386(1)
20.11 Implement distributed throttling
387(1)
21 Design Problems
388(17)
21.1 Design a spell checker
390(1)
21.2 Design a solution to the stemming problem
390(1)
21.3 Plagiarism detector
391(1)
21.4 Pair users by attributes
392(1)
21.5 Design a system for detecting copyright infringement
393(1)
21.6 Design TEX
394(1)
21.7 Design a search engine
395(1)
21.8 Implement PageRank
396(1)
21.9 Design a scalable priority system
397(1)
21.10 Create photomosaics
398(1)
21.11 Implement Mileage Run
398(2)
21.12 Implement Connexus
400(1)
21.13 Design an online advertising system
400(1)
21.14 Design a recommendation system
401(1)
21.15 Design an optimized way of distributing large files
402(1)
21.16 Design the World Wide Web
403(1)
21.17 Estimate the hardware cost of a photo sharing app
404(1)
22 Honors Class
405(96)
22.1 Compute the greatest common divisor
406(1)
22.2 Find the first missing positive entry
407(1)
22.3 Buy and sell a stock κ times
408(1)
22.4 Compute the maximum product of all entries but one
409(2)
22.5 Compute the longest contiguous increasing subarray
411(2)
22.6 Rotate an array
413(2)
22.7 Identify positions attacked by rooks
415(2)
22.8 Justify text
417(2)
22.9 Reverse sublists κ at a time
419(1)
22.10 Implement list zipping
420(1)
22.11 Copy a postings list
421(1)
22.12 Compute the median of a sorted circular linked list
422(1)
22.13 Compute the longest substring with matching parens
423(1)
22.14 Compute the maximum of a sliding window
424(2)
22.15 Implement preorder and postorder traversals without recursion
426(3)
22.16 Compute fair bonuses
429(3)
22.17 Find κ elements closest to the median
432(1)
22.18 Search a sorted array of unknown length
433(2)
22.19 Search in two sorted arrays
435(1)
22.20 Find the kth largest element---large n, small κ
436(1)
22.21 Find an element that appears only once
437(2)
22.22 Find the line through the most points
439(3)
22.23 Find the shortest unique prefix
442(2)
22.24 Compute the smallest nonconstructible change
444(1)
22.25 Find the most visited pages in a window
445(1)
22.26 Convert a sorted doubly linked list into a BST
446(2)
22.27 Convert a BST to a sorted doubly linked list
448(1)
22.28 Merge two BSTs
449(2)
22.29 Test if a binary tree is an almost BST
451(2)
22.30 The view from above
453(3)
22.31 Searching a min-first BST
456(2)
22.32 Implement regular expression matching
458(3)
22.33 Synthesize an expression
461(2)
22.34 Count inversions
463(2)
22.35 Draw the skyline
465(5)
22.36 Find the two closest points
470(3)
22.37 Measure with defective jugs
473(2)
22.38 Compute the maximum subarray sum in a circular array
475(2)
22.39 Determine the critical height
477(2)
22.40 Voltage selection in a logic circuit
479(1)
22.41 Find the maximum 2D subarray
480(3)
22.42 Trapping water
483(2)
22.43 Load balancing
485(2)
22.44 Search for a pair-sum in an abs-sorted array
487(3)
22.45 The heavy hitter problem
490(1)
22.46 Find the longest subarray whose sum ≤ κ
491(2)
22.47 Degrees of connectedness---2
493(2)
22.48 Compute a minimum delay schedule, unlimited resources
495(1)
22.49 Road network
496(2)
22.50 Test if arbitrage is possible
498(1)
22.51 The readers-writers problem with fairness
499(1)
22.52 Implement a producer-consumer queue
500(1)
III Notation, Language, and Index
501(11)
Notation
502(2)
Java
504(1)
23 Java
504(8)
23.1 The JVM
506(1)
23.2 Throw vs. throws
507(1)
23.3 Final, Finally, and Finalizer
507(1)
23.4 Equals() vs. ==
508(1)
23.5 Equals() and hashCode()
508(1)
23.6 List, ArrayList, and LinkedList
508(1)
23.7 String vs. StringBuilder
509(1)
23.8 Autoboxing
510(1)
23.9 Static initialization
511(1)
Index of Terms 512