View Search of elementh in array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Бинарный поиск работает эффективнее и быстрее, чем линейный, так как множество ненужных чисел попросту отсекается. | |
//Координаты числа - его индекс в массиве (отсчёт начинается с нуля). | |
import java.util.*; | |
public class search { | |
static Scanner scan=new Scanner(System.in); | |
public static void main(String[] args){ | |
int array[]; | |
System.out.print("Enter size of array: "); | |
int n=scan.nextInt(); |
View Fibonacci
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Итерационный метод во много раз быстрее работает, чем рекурсивный и является более эффективным с точки зрения экономии ресурсов процессора. | |
import java.util.*; | |
public class fibonacci { | |
static Scanner scan=new Scanner(System.in); | |
public static void main(String[] args){ | |
System.out.print("Enter size: "); | |
int n=scan.nextInt(); |
View qSort
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
////Скорость работы алгоритма не зависит от размерности массива, но очень зависит от расположения его элементов. Чем они более хаотично разбросаны | |
//тем больше нужно времени для его обработки. Обработка массива в тысячу элементов может быть быстрее его обработки из ста элементов. | |
import java.util.*; | |
public class QuickSort { | |
static Scanner scan = new Scanner(System.in); | |
public static void main(String[] args){ | |
int arrayOfDouble[]; | |
System.out.print("Enter size of array: "); | |
int n = scan.nextInt(); |
View Lab 1 Bubble
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Скорость работы алгоритма не зависит от размерности массива, но очень зависит от расположения его элементов. Чем они более хаотично разбросаны | |
//тем больше нужно времени для его обработки. Обработка массива в тысячу элементов может быть быстрее его обработки из ста элементов. | |
import java.util.*; | |
public class Bubble { | |
static Scanner scan = new Scanner(System.in); | |
public static void main(String[] args) { | |
int n, arrayOfDouble[]; |