Programming Flashcards

1
Q

How to reset least significant 1 bit of a number

A

X & (X-1)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Interval merge formula

A

end1 > start2 && end2 > start1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

When adding numbers always remember to :

A

Check for overflow condition.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Linked list add remove. Always use :

A

Dummy head for single LL

dummy head and dummy tail for doubly LL

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

O(n) of recursive calls formula :

A

0( branches ^ depth of tree)

For f(n) = f(n-1) + f(n-1)

It is 2^(n)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Tree question first thing to check ?

A

is it a BST. If yes try to use the property

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

C# - alphanumeric character how ?

A

Char.IsLetterOrDigit()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

N choose K possibilities

A

N! / (k! - (N-k)!)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

DP
Combinatorics
Optimization

A

Combinatorics:
How many ?
Number of ways ?

Optimization :
Minimum number of ..
Maximum cost of ..

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Index of node in a binary tree

A

Index of root = 1
Index of left child = parentIndex2
Index of right child = parentIndex
2 + 1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly