-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathImp_Notes.txt
30 lines (15 loc) · 1.47 KB
/
Imp_Notes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Bitwise operations help us in a lot of problems. We can find the non-repeating element in an array, find number of set-bits, do division, find subsets and so on. Indeed, we can see that learning to cleverly use bitwise operations is vital to any programmer.
xor o with x=x and xor of same nos =0. To find the no repeated odd times
XOR has certain properties
Assume a1 ^ a2 ^ a3 ^ …^ an = a and a1 ^ a2 ^ a3 ^ …^ an-1 = b -- to find the missing no
Then a ^ b = an
postfix expressions are evaluated fatser since they dont require paranthesis
Collections.sort(list, Collections.reverseOrder()); --- to sort the list in reverse order
Stream does not store elements. It simply conveys elements from a source such as a data structure, an array, or an I/O channel, through a pipeline of computational operations.
A binary heap is a Binary Tree with the following properties:
1) It’s a complete tree (All levels are completely filled except possibly the last level and the last level has all keys as left as possible). This property of Binary Heap makes them suitable to be stored in an array.
2) A Binary Heap is either Min Heap or Max Heap. In a Min Binary Heap, the key at the root must be minimum among all keys present in Binary Heap. The same property must be recursively true for all nodes in Binary Tree. Max Binary Heap is similar to MinHeap.
##IMP
Advantages of BST over Hash Table
Modulo 10^9+7 (1000000007)
we do this in many ques to prevent integer overflow like array que no 94