Programming Flashcards
How to reset least significant 1 bit of a number
X & (X-1)
Interval merge formula
end1 > start2 && end2 > start1
When adding numbers always remember to :
Check for overflow condition.
Linked list add remove. Always use :
Dummy head for single LL
dummy head and dummy tail for doubly LL
O(n) of recursive calls formula :
0( branches ^ depth of tree)
For f(n) = f(n-1) + f(n-1)
It is 2^(n)
Tree question first thing to check ?
is it a BST. If yes try to use the property
C# - alphanumeric character how ?
Char.IsLetterOrDigit()
N choose K possibilities
N! / (k! - (N-k)!)
DP
Combinatorics
Optimization
Combinatorics:
How many ?
Number of ways ?
Optimization :
Minimum number of ..
Maximum cost of ..
Index of node in a binary tree
Index of root = 1
Index of left child = parentIndex2
Index of right child = parentIndex2 + 1