first commit
This commit is contained in:
commit
3e1d017ff2
BIN
D197_Version_Control/.DS_Store
vendored
Normal file
BIN
D197_Version_Control/.DS_Store
vendored
Normal file
Binary file not shown.
1
D197_Version_Control/d197-version-control
Submodule
1
D197_Version_Control/d197-version-control
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 287d3674869b7c6f2367e8df14243ee8e52663fb
|
||||||
1
D197_Version_Control/d197-version-controlback
Submodule
1
D197_Version_Control/d197-version-controlback
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 6d582531fc4696513f82e83e9f3cf08cc08f5308
|
||||||
Binary file not shown.
@ -0,0 +1,31 @@
|
|||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SequentialSearch
|
||||||
|
*/
|
||||||
|
public class SequentialSearch {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Scanner sc = new Scanner(System.in);
|
||||||
|
System.out.println("check the number x: ");
|
||||||
|
int input = sc.nextInt();
|
||||||
|
int[] arr = { 1, 3, 5, 6, 7, 21, 32, 42, 55, 66, 76, 83, 90 };
|
||||||
|
|
||||||
|
int position = 0;
|
||||||
|
boolean found = false;
|
||||||
|
|
||||||
|
while (position < arr.length && !found) {
|
||||||
|
if (arr[position] == input) {
|
||||||
|
found = true;
|
||||||
|
} else {
|
||||||
|
position = position + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (found) {
|
||||||
|
System.out.println(input + " found in position " + position);
|
||||||
|
} else {
|
||||||
|
System.out.println(input + " Not found in the array");
|
||||||
|
}
|
||||||
|
sc.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
@ -0,0 +1,26 @@
|
|||||||
|
/**
|
||||||
|
* SequentialSearchSortedarray
|
||||||
|
*/
|
||||||
|
public class SequentialSearchSortedarray {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
int[] sortedArray = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
|
||||||
|
int index = SeqSearch(sortedArray, 53);
|
||||||
|
if (index != -1) {
|
||||||
|
System.out.println("Element found at index " + index);
|
||||||
|
} else {
|
||||||
|
System.out.println("Element not found");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int SeqSearch(int[] arr, int value) {
|
||||||
|
for (int i = 0; i < arr.length; i++) {
|
||||||
|
if (arr[i] == value) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
BIN
IntroductiontoComputerScience_D684/Algorithms/Squareroot.class
Normal file
BIN
IntroductiontoComputerScience_D684/Algorithms/Squareroot.class
Normal file
Binary file not shown.
@ -0,0 +1,27 @@
|
|||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Squareroot
|
||||||
|
*/
|
||||||
|
public class Squareroot {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Scanner sc = new Scanner(System.in);
|
||||||
|
System.out.println("enter your guess");
|
||||||
|
double square = sc.nextDouble();
|
||||||
|
|
||||||
|
// initial the difference
|
||||||
|
double epsilon = 1;
|
||||||
|
// initial guess
|
||||||
|
double guess = square / 2.0;
|
||||||
|
|
||||||
|
while (epsilon > 0.001) {
|
||||||
|
double newGuess = (guess + square / guess) / 2.0;
|
||||||
|
epsilon = Math.abs(square - guess * guess);
|
||||||
|
guess = newGuess;
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("The sqaure root of " + square + " is " + guess);
|
||||||
|
sc.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
1
Scripting_and_Programming_Applications_C867/C867Project/c867-scripting-and-programming-applications
Submodule
1
Scripting_and_Programming_Applications_C867/C867Project/c867-scripting-and-programming-applications
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit c3bc5e1255ffb32e44d700b81f367717df7b25ae
|
||||||
1
c867-scripting-and-programming-applications
Submodule
1
c867-scripting-and-programming-applications
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit c8c6099b8ebecf6eba3ae72bdf03bee41d469891
|
||||||
Loading…
Reference in New Issue
Block a user