File tree Expand file tree Collapse file tree 5 files changed +41
-16
lines changed
src/chapter21miscconcepts Expand file tree Collapse file tree 5 files changed +41
-16
lines changed Original file line number Diff line number Diff line change 5
5
<projects >
6
6
</projects >
7
7
<buildSpec >
8
+ <buildCommand >
9
+ <name >org.python.pydev.PyDevBuilder</name >
10
+ <arguments >
11
+ </arguments >
12
+ </buildCommand >
8
13
<buildCommand >
9
14
<name >org.eclipse.jdt.core.javabuilder</name >
10
15
<arguments >
13
18
</buildSpec >
14
19
<natures >
15
20
<nature >org.eclipse.jdt.core.javanature</nature >
21
+ <nature >org.python.pydev.pythonNature</nature >
16
22
</natures >
17
23
</projectDescription >
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" standalone =" no" ?>
2
+ <?eclipse-pydev version =" 1.0" ?><pydev_project >
3
+ <pydev_property name =" org.python.pydev.PYTHON_PROJECT_INTERPRETER" >Default</pydev_property >
4
+ <pydev_property name =" org.python.pydev.PYTHON_PROJECT_VERSION" >python 2.7</pydev_property >
5
+ </pydev_project >
Original file line number Diff line number Diff line change 1
- /chapter01introduction /
2
- /chapter02recursionandbacktracking /
3
- /chapter03linkedlists /
4
- /chapter04stacks /
5
- /chapter05queues /
6
- /chapter06trees /
7
- /chapter07priorityqueues /
8
- /chapter08disjointsets /
9
- /chapter10sorting /
10
- /chapter11searching /
11
- /chapter12selectionalgorithms /
12
- /chapter15stringalgorithms /
13
- /chapter17greedyalgorithms /
14
- /chapter18divideandconquer /
15
- /chapter19dynamicprogramming /
16
1
/chapter21miscconcepts /
Original file line number Diff line number Diff line change
1
+ /*Copyright (c) Dec 22, 2014 CareerMonk Publications and others.
2
+ * E-Mail : info@careermonk.com
3
+ * Creation Date : 2015-01-10 06:15:46
4
+ * Last modification : 2006-05-31
5
+ by : Narasimha Karumanchi
6
+ * File Name : CheckEndian.java
7
+ * Book Title : Data Structures And Algorithms Made In Java
8
+ * Warranty : This software is provided "as is" without any
9
+ * warranty; without even the implied warranty of
10
+ * merchantability or fitness for a particular purpose.
11
+ *
12
+ */
13
+
14
+
15
+ package chapter21miscconcepts ;
16
+
17
+ public class CountNumberofSetbitsin1toN {
18
+ public int countNumberofSetbitsin1toN (int n ) {
19
+ long i = 0 , j , count = 0 ;
20
+ for (i = 1 ; i <=n ; i ++){
21
+ j = i ;
22
+ while (j >0 ) {
23
+ count ++;
24
+ j = j & (j - 1 );
25
+ }
26
+ }
27
+ return count ;
28
+ }
29
+ }
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ int[][] rotateByOneElementClockwise(int[][] matrix) {
28
28
// move left
29
29
roataedMatrix [i ][j -1 ] = matrix [i ][j ];
30
30
} else if (i +j <=n -1 && i >j ){
31
- // move top
31
+ // move up
32
32
roataedMatrix [i -1 ][j ] = matrix [i ][j ];
33
33
} else if (i +j >=n -1 && i <j ) {
34
34
// move down
You can’t perform that action at this time.
0 commit comments