Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b4de0af

Browse files
minor changes
1 parent 1b809be commit b4de0af

File tree

13 files changed

+22
-12
lines changed

13 files changed

+22
-12
lines changed

‎InterviewPrograms/src/com/algorithm/search/BinarySearch.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
*
2323
* This search is faster than linear search.
2424
*/
25+
2526
public class BinarySearch {
2627
public static void main(String[] args) {
2728
int array[] = { 10, 20, 30, 40, 50 };

‎InterviewPrograms/src/com/algorithm/search/LinearSearch.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* Worst Case O(n)
1717
* Best Case O(1)
1818
*/
19+
1920
public class LinearSearch {
2021
public static void main(String[] args) {
2122
int array[] ={3,60,35,2,45,320,5};

‎InterviewPrograms/src/com/algorithm/sorting/BubbleSort.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
* Worst Case : O(n^2)
2121
* Best Case : O(n)
2222
*/
23+
2324
public class BubbleSort {
2425
public static void main(String[] args) {
2526
int array[] ={3,60,35,2,45,320,5};

‎InterviewPrograms/src/com/algorithm/sorting/InsertionSort.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
* Worst Case : O(n^2)
2020
* Best Case : O(n)
2121
*/
22+
2223
public class InsertionSort {
2324
public static void main(String[] args) {
2425
int array[] ={3,60,35,2,45,320,5};

‎InterviewPrograms/src/com/algorithm/sorting/MergeSort.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* Worst Case : O(n*log(n))
1919
* Best Case : O(n*log(n))
2020
*/
21+
2122
public class MergeSort {
2223
public static void main(String[] args) {
2324
int array[] = {90,23,101,45,65,23,67,89,34,23};

‎InterviewPrograms/src/com/algorithm/sorting/QuickSort.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
* Best Case : O(n*log(n))
2323
*
2424
*/
25+
2526
public class QuickSort {
2627
public static void main(String[] args) {
2728
int array[] = {90,23,101,45,65,23,67,89,34,23};

‎InterviewPrograms/src/com/algorithm/sorting/SelectionSort.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
* Best Case : O(n*log(n))
2020
*
2121
*/
22+
2223
public class SelectionSort {
2324
public static void main(String[] args) {
2425
int array[] = {64,25,12,22,11};

‎InterviewPrograms/src/com/java/convertor/BinaryToDecimal.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
/*
66
* Binary To Decimal
7-
*
7+
* --------------------
88
* Write a Java Program to convert Binary value
99
* to Decimal value
1010
*
@@ -47,12 +47,12 @@
4747
* decimal value is 7
4848
*
4949
*/
50+
5051
public class BinaryToDecimal {
5152
public static void main(String[] args) {
5253
Scanner scanner = new Scanner(System.in);
5354
System.out.println("Enter the binary number : ");
54-
String input = scanner.nextLine();
55-
int binary = Integer.parseInt(input);
55+
int binary = scanner.nextInt();
5656
int decimal = 0;
5757
int digitCount = 0;
5858

‎InterviewPrograms/src/com/java/convertor/BinaryToOctal.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
package com.java.convertor;
2+
23
/*
34
* Binary to Octal
4-
*
5+
* ----------------
56
* Octal Number System
67
* The octal numeral system, or oct for short,
78
* is the base-8 number system, and uses
@@ -60,6 +61,7 @@
6061
* Decimal Number - 62
6162
*
6263
*/
64+
6365
public class BinaryToOctal {
6466
public static void main(String[] args) {
6567
long binary = 101101101;

‎InterviewPrograms/src/com/java/convertor/DecimalToBinary.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
/*
66
* Decimal To Binary
7-
*
7+
* --------------------
88
* Write a Java Program to convert Decimal
99
* value to Binary Value
1010
*
@@ -46,13 +46,12 @@
4646
* now n is 0, so stop the iteration
4747
* finally binary value is 101
4848
*/
49-
publicclassDecimalToBinary {
50-
49+
50+
publicclassDecimalToBinary {
5151
public static void main(String[] args) {
5252
Scanner scanner = new Scanner(System.in);
5353
System.out.println("Enter the decimal value : ");
54-
String input = scanner.nextLine();
55-
int decimal = Integer.parseInt(input);
54+
int decimal = scanner.nextInt();
5655
long binary = 0;
5756
int i = 0;
5857

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /