Java data structures for coding interview

# Java is still good for coding interview

Many people think python is the best choice for coding interviews. True. But Java is good as python. Here is basic java types to remind. It's referenced the book 'Elements of Programming Interviews in Java (opens new window)'

# Back to the basic

Java has no unsigned integers, and the integer width is compiler and machine-dependent in C.

Data structure
Key Points
Primitive types Know how int, char, double, etc. are represented in memory and the primitive operations on them.
Arrays Fast access for element at an index, slow lookups(unless sorted) and insertions. Be comfortable with notions of iteration, resizing, partitioning, merging, etc.
Strings Know how strings are represented in memory. Unserstand basic operators such as comparison, copying, matching, joining, splitting, etc.
Lists Understand trade-offs with respect to arrays. Be comfortable with iteration, insertion, and deletion within singly and doubly linked lists. Know how to implement a list with dynamic allocation, and with arrays.
Stacks and queues Recongnize where last-in first-out(stack) and first-in first-out(queue) sementics are applicable. Know array and linked list implementations.
Binary trees Use for representing hierarchical data. Know about depth, height, leaves, search path, traversal sequences, successor/predecessor operations.
Heaps O(1) lookup find-max,
O(logn) insertion,
O(lonn) deletion of max.
Node and array representations. Min-heap variant.
Hash tables O(1) insertions, deletions and lookups.
Key disadvantages: not suitable for order-related queries; need for resizing; poor worse-case performance. Understand implementation using array of buckets and collision chains. Know hash functions for integers, strings, objects
Binary search trees O(logn) insertions, deletions, lookups, find-min, find-max, successor, predecessor when tree is height-balanced
Unserstand node fields, pointer implementation. Be familiar with notion of balance, and operations maintaining balance.