Skip to content

Commit 10602fd

Browse files
committed
fix readme
1 parent 029a99c commit 10602fd

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

‎README.md

+22-15
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
- [Math.floor](#mathfloor)
7070
- [Math.round](#mathround)
7171
- [JavaScript Integer Max Min](#javascript-integer-max-min)
72+
- [Difference between i++ and ++i](#difference-between-i-and-i)
7273
- [Bitwise operation in JavaScript](#bitwise-operation-in-javascript)
7374
- [Right Shift x>>y](#right-shift-xy)
7475
- [Left Shift x<<y](#left-shift-xy)
@@ -665,32 +666,29 @@ When Browser's are not using Merge sort they most of the time use Quick sort var
665666

666667
In Quick sort we do not create auxiliary arrays. Therefore, it is good choice for Array to use quick sort. However in merge sort we create 2 auxiliary arrays. Therefore, linked list is a good choice.
667668

668-
669-
670669
## Mathematics & Stats You should know
671670

672-
673671
### XOR operator
674672

675673
XOR represents the inequality function, i.e., the output is true if the inputs are not alike otherwise the output is false. A way to remember XOR is "must have one or the other but not both". XOR can also be viewed as addition modulo 2.
676674

677675
#### Different Numbers can be solved by XOR
678676

679-
Find how many different numbers in the array.
677+
Find how many different numbers in the array.
680678

681-
Input =[3, 5, 6, 3, 3 , 9, 5]
679+
Input =[3, 5, 6, 3, 3 , 9, 5]
682680

683-
answer = 4
681+
answer = 4
684682

685-
There are 4 values 3,5, 6,9.
683+
There are 4 values 3,5, 6,9.
686684

687685
```js
688-
x =0;
689-
array.forEach(num=> x ^= num);
686+
x = 0;
687+
array.forEach((num) => (x ^= num));
690688
return x;
691689
```
692690

693-
`^=` [XOR assignment operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_XOR).
691+
`^=` [XOR assignment operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_XOR).
694692

695693
### How to initialize array of size n?
696694

@@ -858,20 +856,29 @@ It is 16 digit number.
858856
- `Number.MIN_SAFE_INTEGER` = -9007199254740992
859857
- `Number.MAX_SAFE_INTEGER` = 9007199254740991
860858

859+
## Difference between i++ and ++i
860+
861+
So basically ++i returns the value after it is incremented, while i++ return the value before it is incremented.
862+
863+
![](https://i.imgur.com/mwT7aco.png)
864+
865+
![](https://i.imgur.com/mp77XBD.png)
866+
867+
## Bitwise operation in JavaScript
861868

862-
## Bitwise operation in JavaScript
869+
### Right Shift x>>y
863870

864-
### Right Shift x>>y
871+
Moving bit/s towards the right side in binary number.
865872

866-
Moving bit/s towards the right side in binary number.
873+
`4>>2 = 16`
867874

868875
`x>>y` means `x/2^y` divide x by 2 to the power of y.
869876

870877
### Left Shift x<<y
871878

872-
Moving bit/s towards the left side in binary number.
879+
Moving bit/s towards the left side in binary number.
873880

874-
`4<<2 == 0`
881+
`4<<2 = 0`
875882

876883
`x<<y` means `x*2^y` multiply x by 2 to the power of y.
877884

0 commit comments

Comments
 (0)