ΔΟΜΕΣ ΔΕΔΟΜΕΝΩΝ & ΑΛΓΟΡΙΘΜΟΙ ΕΡΓΑΣΤΗΡΙΟ

Μέγεθος: px
Εμφάνιση ξεκινά από τη σελίδα:

Download "ΔΟΜΕΣ ΔΕΔΟΜΕΝΩΝ & ΑΛΓΟΡΙΘΜΟΙ ΕΡΓΑΣΤΗΡΙΟ"

Transcript

1 ΔΟΜΕΣ ΔΕΔΟΜΕΝΩΝ & ΑΛΓΟΡΙΘΜΟΙ ΕΡΓΑΣΤΗΡΙΟ Κωδικός Θ: ΤΠ3001, Κωδικός Ε: ΤΠ3101 (ΜΕΥ/Υ) Ώρες (Θ - Ε): 4-2 Προαπαιτούμενα: Δρ. ΒΙΔΑΚΗΣ ΝΙΚΟΣ

2 ΕΡΓΑΣΤΗΡΙΟ 5 Ταξινόμηση με 1. Insertion Sort 2. Selection Sort

3 Insertion Sort Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 3

4 Introduction Is similar to bubble sort. Is more efficient than bubble as the number of element comparisons are less compared to bubble sort. Compares the value until all prior elements are lesser than the compared value. Is a good choice for small or nearly-sorted arrays. More efficient algorithms are: quick, heap, or merge. Positive feature of insertion sorting 1. Simple to implement 2. Efficient on (quite) small or nearly sorted arrays 3. Adaptive (performance adapts to the initial order of elements) 4. Stable (insertion sort retains relative order of the same elements) 5. In-place (requires constant amount of additional space) 6. Online (new elements can be added during the sort). Complexity The complexity is O(n) at best case of an already sorted array and O(n2) at worst case. Insertion Sort Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 4

5 Insertion Sort Insertion sort pseudocode (recall) InsertionSort(A) **sort A[1..n] in place for j 2 to n do key A[j] **insert A[j] into sorted sublist A[1..j 1] i j 1 while (i > 0 and A[i] > key) do A[i+1] A[i] i i 1 A[i+1] key becomes Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 5

6 Insertion Sort Code Description Insertion sort algorithm somewhat resembles selection sort. Array is imaginary divided into two parts sorted one and unsorted one. At the beginning, sorted part contains first element of the array and unsorted one contains the rest. At every step, algorithm takes first element in the unsorted part and inserts it to the right place of the sorted one. When unsorted part becomes empty, algorithm stops. Sketchy, insertion sort algorithm step looks like this: becomes Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 6

7 Insertion Sort visual paradigm 1 Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 7

8 Insertion Sort visual paradigm 1 (cont.) Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 8

9 Insertion Sort visual paradigm 2 ("Sifting down" using swaps) This approach writes sifted element to temporary position many times. Next paradigm eliminates those unnecessary writes Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 9

10 Insertion Sort visual paradigm 3 (Sifting instead of swapping) is the most commonly used modification of the insertion sort Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 10

11 Insertion Sort visual paradigm 4 Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 11

12 Insertion Sort example code 1 void insertionsort(int[] arr) { int i, j, newvalue; for (i = 1; i < arr.length; i++) { newvalue = arr[i]; j = i; while (j > 0 && arr[j - 1] > newvalue) { arr[j] = arr[j - 1]; j--; arr[j] = newvalue; Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 12

13 Insertion Sort example code 2 in Java public class InsertionSort{ public static void main(string a[]){ int i; int array[] = {12,9,4,99,120,1,3,10; System.out.println("\n\n RoseIndia\n\n"); System.out.println(" Selection Sort\n\n"); System.out.println("Values Before the sort:\n"); for(i = 0; i < array.length; i++) System.out.print( array[i]+" "); System.out.println(); insertion_srt(array, array.length); System.out.print("Values after the sort:\n"); for(i = 0; i <array.length; i++) System.out.print(array[i]+" "); System.out.println(); System.out.println("PAUSE"); Example code taken from: Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 13

14 Insertion Sort example code 3 in C++ void insertionsort(int arr[], int length) { int i, j, tmp; for (i = 1; i < length; i++) { j = i; while (j > 0 && arr[j - 1] > arr[j]) { tmp = arr[j]; arr[j] = arr[j - 1]; arr[j - 1] = tmp; j--; Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 14

15 Analisys Array Elements: Start Order = 12, 9, 4, 99, 120, 1, 3, 10 array[ ] = {12, 9, 4, 99, 120, 1, 3, 10, n = 8; i = 1; i < n; 1 < 8 true enters the for j = i; j = 1; Insertion Sort B = array[j]; B = array[1] = 9; ((1>0) && (12 >9)) true enters the while array[j] = array[j-1] array[1] = array[0] = 12; j--; j =0; ((0>0) && (#** > 9)) false not in while array[j] = B array[0] = 9; public static void insertion_srt(int array[], int n){ for (int i = 1; i < n; i++){ int j = i; int B = array[i]; while ((j > 0) && (array[j-1] > B)){ array[j] = array[j-1]; j--; array[j] = B; new array[ ] = {9, 12, 4, 99, 120, 1, 3, 10; Example code taken from: Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 15

16 Analisys Array Elements: Start Order = 12, 9, 4, 99, 120, 1, 3, 10 from previus run: array[ ] = {9, 12, 4, 99, 120, 1, 3, 10; i = 2; i < n; 2 < 8 true enters the for j = i; j = 2; Insertion Sort B = array[j]; B = array[2] = 4; ((2>0) && (12 >4)) true enters the while array[j] = array[j-1] array[2] = array[1] = 12; j--; j =1; ((1>0) && (9 > 4)) true enters the while array[j] = array[j-1] array[1] = array[0] = 9; j--; j = 0; ((0>0) && (9 > 4)) false not in while public static void insertion_srt(int array[], int n){ for (int i = 1; i < n; i++){ int j = i; int B = array[i]; while ((j > 0) && (array[j-1] > B)){ array[j] = array[j-1]; j--; array[j] = B; array[j] = B array[0] = 4; new array[ ] = {4, 9, 12, 99, 120, 1, 3, 10; Example code taken from: Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 16

17 Analisys Array Elements: Start Order = 12, 9, 4, 99, 120, 1, 3, 10 from previus run: array[ ] = {4, 9, 12, 99, 120, 1, 3, 10; i = 3; i < n; 3 < 8 true enters the for Insertion Sort j = i; j = 3; B = array[j]; B = array[3] = 99; public static void insertion_srt(int array[], int n){ for (int i = 1; i < n; i++){ int j = i; int B = array[i]; ((3>0) && (12 > 99)) false not in while while ((j > 0) && (array[j-1] > B)){ array[j] = array[j-1]; j--; array[j] = B; array[j] = B array[3] = 99; new array[ ] = {4, 9, 12, 99, 120, 1, 3, 10; same as before Example code taken from: Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 17

18 Analisys Array Elements: Start Order = 12, 9, 4, 99, 120, 1, 3, 10 from previus run: array[ ] = {4, 9, 12, 99, 120, 1, 3, 10; i = 4; i < n; 4 < 8 true enters the for Insertion Sort j = i; j = 4; B = array[j]; B = array[4] = 120; public static void insertion_srt(int array[], int n){ for (int i = 1; i < n; i++){ int j = i; int B = array[i]; ((4>0) && (99 >120)) false not in while while ((j > 0) && (array[j-1] > B)){ array[j] = array[j-1]; j--; array[j] = B; array[j] = B array[4] = 120; new array[ ] = {4, 9, 12, 99, 120, 1, 3, 10; same as before Example code taken from: Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 18

19 Analisys Array Elements: Start Order = 12, 9, 4, 99, 120, 1, 3, 10 from previus run: array[ ] = {4, 9, 12, 99, 120, 1, 3, 10; i = 5; i < n; 5 < 8 true enters the for j = i; j = 5; B = array[j]; B = array[5] = 1; Insertion Sort public static void insertion_srt(int array[], int n){ ((5>0) && (120 > 1)) true enters the while array[j] = array[j-1] array[5] = array[4] = 120; j--; j =4; ((4>0) && (99 > 1)) true enters the while array[j] = array[j-1] array[4] = array[3] = 99; j--; j =3; ((3>0) && (12 > 1)) true enters the while array[j] = array[j-1] array[3] = array[2] = 12; j--; j =2; ((2>0) && (9 > 1)) true enters the while array[j] = array[j-1] array[2] = array[1] = 9; j--; j =1; ((1>0) && (4 > 1)) true enters the while array[j] = array[j-1] array[1] = array[0] = 4; j--; j =0; ((0>0) && (4 > 1)) false not in while array[j] = B array[0] = 1; new array[ ] = {1,4, 9, 12, 99, 120, 3, 10; for (int i = 1; i < n; i++){ int j = i; int B = array[i]; while ((j > 0) && (array[j-1] > B)){ array[j] = array[j-1]; j--; array[j] = B; Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 19

20 Analisys Array Elements: Start Order = 12, 9, 4, 99, 120, 1, 3, 10 from previus run: array[ ] = {1,4, 9, 12, 99, 120, 3, 10; i = 6; i < n; 6 < 8 true enters the for j = i; j = 6; B = array[j]; B = array[6] = 3; Insertion Sort public static void insertion_srt(int array[], int n){ ((6>0) && (120 > 3)) true enters the while array[j] = array[j-1] array[6] = array[5] = 120; j--; j =5; ((5>0) && (99 > 3)) true enters the while array[j] = array[j-1] array[5] = array[4] = 99; j--; j =4; ((4>0) && (12 > 3)) true enters the while array[j] = array[j-1] array[4] = array[3] = 12; j--; j =3; ((3>0) && (9 > 3)) true enters the while array[j] = array[j-1] array[3] = array[2] = 9; j--; j =2; ((2>0) && (4 > 3)) true enters the while array[j] = array[j-1] array[2] = array[1] = 4; j--; j =1; ((1>0) && (1 > 3)) false not in while array[j] = B array[1] = 3; new array[ ] = {1, 3, 4, 9, 12, 99, 120, 10; for (int i = 1; i < n; i++){ int j = i; int B = array[i]; while ((j > 0) && (array[j-1] > B)){ array[j] = array[j-1]; j--; array[j] = B; Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 20

21 Analisys Array Elements: Start Order = 12, 9, 4, 99, 120, 1, 3, 10 from previus run: array[ ] = {1, 3, 4, 9, 12, 99, 120, 10; i = 7; i < n; 7 < 8 true enters the for j = i; j = 7; B = array[j]; B = array[7] = 10; Insertion Sort public static void insertion_srt(int array[], int n){ ((7>0) && (120 > 10)) true enters the while array[j] = array[j-1] array[7] = array[6] = 120; j--; j =6; ((6>0) && (99 > 10)) true enters the while array[j] = array[j-1] array[6] = array[5] = 99; j--; j =5; ((5>0) && (12 > 10)) true enters the while array[j] = array[j-1] array[5] = array[4] = 12; j--; j =4; ((4>0) && (9 > 10)) false not in while for (int i = 1; i < n; i++){ int j = i; int B = array[i]; while ((j > 0) && (array[j-1] > B)){ array[j] = array[j-1]; j--; array[j] = B; array[j] = B array[4] = 10; new array[ ] = {1, 3, 4, 9,10, 12, 99, 120; Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 21

22 Insertion Sort Analisys Array Elements: Start Order = 12, 9, 4, 99, 120, 1, 3, 10 public static void insertion_srt(int array[], int n){ i = 8; i < n; 8 < 8 false not in for After 8 runs of the for loop (which are as many as the elements in the array) the array is finaly sorted. The while statement runs: 16 times. SORTED ARRAY: {1, 3, 4, 9,10, 12, 99, 120; for (int i = 1; i < n; i++){ int j = i; int B = array[i]; while ((j > 0) && (array[j-1] > B)){ array[j] = array[j-1]; j--; array[j] = B; Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 22

23 Selection Sort Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 23

24 Selection Sort Introduction The idea of the algorithm is quite simple. The array is imaginary divided into two parts - sorted one and unsorted one. At the beginning, sorted part is empty, while unsorted one contains whole array. Find the minimum value in the array swap it first position In next step leave the first value and find the minimum value within remaining values Then swap it with the value of minimum index position Sort the remaining values by using same steps. Selection sort is probably the most intuitive sorting algorithm to invent.. Complexity The complexity in worst-case, average-case, and best-case run-time of Θ(n2), assuming that comparisons can be done in constant time. Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 24

25 Selection Sort Working of the algorithm Say we have an array unsorted A[0],A[1],A[2]... A[n-1] and A[n] as input. Then the following steps are followed by selection sort algorithm to sort the values of an array. (Say we have a key index_of_min that indicate the position of minimum value) 1. Initially variable index_of_min=0; 2. Find the minimum value in the unsorted array. 3. Assign the index of the minimum value into index_of_min variable. 4. Swap minimum value to first position. 5. Sort the remaining values of array (excluding the first value). Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 25

26 Selection Sort visual paradigm 1 (using the minimum value) Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 26

27 Selection Sort visual paradigm 2 (using the maximum value) Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 27

28 Selection Sort example code 1 in Java public void selectionsort(int[] arr) { int i, j, minindex, tmp; int n = arr.length; for (i = 0; i < n - 1; i++) { minindex = i; for (j = i + 1; j < n; j++) if (arr[j] < arr[minindex]) minindex = j; if (minindex!= i) { tmp = arr[i]; arr[i] = arr[minindex]; arr[minindex] = tmp; Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 28

29 Selection Sort example code 2 in Java public class selectionsort{ public static void main(string a[]){ int i; int array[] = {12,9,4,99,120,1,3,10; System.out.println("\n\n RoseIndia\n\n"); System.out.println(" Selection Sort\n\n"); System.out.println("Values Before the sort:\n"); for(i = 0; i < array.length; i++) System.out.print( array[i]+" "); System.out.println(); selection_srt(array, array.length); System.out.print("Values after the sort:\n"); for(i = 0; i <array.length; i++) System.out.print(array[i]+" "); System.out.println(); System.out.println("PAUSE"); Example code taken from: Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 29

30 Selection Sort example code 2 (cont.) in Java public static void selection_srt(int array[], int n){ for(int x=0; x<n; x++){ int index_of_min = x; for(int y=x; y<n; y++){ if(array[index_of_min]<array[y]){ index_of_min = y; int temp = array[x]; array[x] = array[index_of_min]; array[index_of_min] = temp; Example code taken from: Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 30

31 C++ void selectionsort(int arr[], int n) { int i, j, minindex, tmp; for (i = 0; i < n - 1; i++) { minindex = i; for (j = i + 1; j < n; j++) if (arr[j] < arr[minindex]) minindex = j; if (minindex!= i) { tmp = arr[i]; arr[i] = arr[minindex]; arr[minindex] = tmp; Selection Sort example code 3 in C void selection_sort(int num[size]) { int i, j, min; for (i = 0; i < (SIZE-1); i++) { min = i; for (j = (i+1); j < SIZE; j++) { if(num[j] < num[min]) { min = j; if (i!= min) { int swap = num[i]; num[i] = num[min]; num[min] = swap; Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 31

32 Selection Sort example code 3 in Visual Basic Sub selection_sort(num() As Integer) Dim i, j, min As Integer For i = 0 to num().length - 1 min = i For j = i+1 to num().length If num(j) < num(min) Then min = j End If Next If i <> min Then Dim swap As Integer = num(i) num(i) = num(min) num(min) = swap End If Next End Sub Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 32

33 Selection Sort time taken n Milliseconds 10, ,000 3,051 30,000 6,846 40,000 12,188 50,000 19,015 60,000 27,359 Obtained with a Pentium processor, 1.2 GHz, Java 5.0, Linux Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 33

34 Selection Sort Code Analisys Array Elements: Start Order = 12, 9, 4, 99, 120, 1, 3, 10 array[ ] = {12, 9, 4, 99, 120, 1, 3, 10, n = 8; public static void selection_srt(int array[], int n){ x = 0 x = 0; x < n 0 < 8 true, enters for y = x y = 0; index_of_max = x y < n 0 < 8 true, enters for index_of_max = 0; array[inder_of_max] < array [y] 12 < 12 false, not in if y++ y = 1; y < n 1 < 8 true, enters for array[index_of_max] < array [y] 12 < 9 false, not in if y++ y = 2; y < n 2 < 8 true, enters for array[index_of_max] < array [y] 12 < 4 false, not in if y++ y = 3; y < n 3 < 8 true, enters for array[index_of_max] < array [y] 12 < 99 true, enters if index_of_max= y index_of_max = 3 y++ y = 4; y < n 4 < 8 true, enters for array[index_of_max] < array [y] 99 < 120 true, enters if index_of_max = y index_of_max = 4 y++ y = 5; y < n 5 < 8 true, enters for array[index_of_max] < array [y] 120 < 1 false, not in if CONTINUED IN NEXT PAGE for(int x=0; x<n; x++){ int index_of_min = x; for(int y=x; y<n; y++){ if(array[index_of_min]<array[y]){ index_of_min = y; int temp = array[x]; array[x] = array[index_of_min]; array[index_of_min] = temp; Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 34

35 Continued Selection Sort Code Analisys Array Elements: Start Order = 12, 9, 4, 99, 120, 1, 3, 10 public static void selection_srt(int array[], int n){ y++ y = 6; y < n 6 < 8 true, enters for array[inder_of_max] < array [y] 120 < 3 false, not in if y++ y = 7; y < n 7 < 8 true, enters for array[index_of_max] < array [y] 120 < 10 false, not in if y++ y = 8; y < n 8 < 8 false, not in for So after 8 runs, the for loop stops and we have: index_of_max = 4 and x = 0; temp = array[0] temp = 12 array[x] = array[4] array[0] = 120 array[index_of_max] = temp array[4] = 12 new array[ ] = {120, 9, 4, 99, 12, 1, 3, 10 for(int x=0; x<n; x++){ int index_of_min = x; for(int y=x; y<n; y++){ if(array[index_of_min]<array[y]){ index_of_min = y; int temp = array[x]; array[x] = array[index_of_min]; array[index_of_min] = temp; Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 35

36 Selection Sort Code Analisys Array Elements: Start Order = 12, 9, 4, 99, 120, 1, 3, 10 array[ ] = {120, 9, 4, 99, 12, 1, 3, 10 public static void selection_srt(int array[], int n){ x++ x = 1; x < n 1 < 8 true, enters for y = x y = 1; index_of_max = x y < n 1 < 8 true, enters for index_of_max = 1; array[inder_of_max] < array [y] 9 < 9 false, not in if y++ y = 2; y < n 2 < 8 true, enters for array[index_of_max] < array [y] 9 < 4 false, not in if y++ y = 3; y < n 3 < 8 true, enters for array[index_of_max] < array [y] 9 < 99 true, enters if index_of_max = y index_of_max = 3 y++ y = 4; y < n 4 < 8 true, enters for array[index_of_max] < array [y] 99 < 12 false, not in if for(int x=0; x<n; x++){ int index_of_min = x; for(int y=x; y<n; y++){ if(array[index_of_min]<array[y]){ index_of_min = y; int temp = array[x]; array[x] = array[index_of_min]; array[index_of_min] = temp; y++ y = 5; y < n 5 < 8 true, enters for array[index_of_max] < array [y] 99 < 1 false, not in if y++ y = 6; y < n 5 < 8 true, enters for array[index_of_max] < array [y] 99 < 3 false, not in if CONTINUED IN NEXT PAGE Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 36

37 Continued Selection Sort Code Analisys Array Elements: Start Order = 12, 9, 4, 99, 120, 1, 3, 10 public static void selection_srt(int array[], int n){ y++ y = 7; y < n 7 < 8 true, enters for array[index_of_max] < array [y] 99 < 10 false, not in if y++ y = 8; y < n 8 < 8 false, not in for So after 7 runs, the for loop stops and we have: index_of_max = 3 and x = 1; temp = array[1] temp = 9 array[x] = array[index_of_max] array[1] = 99 array[index_of_max] = temp array[3] = 9 new array[ ] = {120, 99, 4, 9, 12, 1, 3, 10 for(int x=0; x<n; x++){ int index_of_min = x; for(int y=x; y<n; y++){ if(array[index_of_min]<array[y]){ index_of_min = y; int temp = array[x]; array[x] = array[index_of_min]; array[index_of_min] = temp; Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 37

38 Selection Sort Code Analisys Array Elements: Start Order = 12, 9, 4, 99, 120, 1, 3, 10 array[ ] = {120, 99, 4, 9, 12, 1, 3, 10 public static void selection_srt(int array[], int n){ x++ x = 2; x < n 2 < 8 true, enters for y = x y = 2; index_of_max = x y < n 2 < 8 true, enters for index_of_max = 2; array[inder_of_max] < array [y] 4 < 4 false, not in if y++ y = 3; y < n 3 < 8 true, enters for array[index_of_max] < array [y] 4 < 9 true, enters index_of_max = y index_of_max = 3 y++ y = 4; y < n 4 < 8 true, enters for array[index_of_max] < array [y] 9 < 12 true, enters if index_of_max = y index_of_max = 4 y++ y = 5; y < n 5 < 8 true, enters for array[index_of_max] < array [y] 12 < 1 false, not in if y++ y = 6; y < n 6 < 8 true, enters for array[index_of_max] < array [y] 12 < 3 false, not in if y++ y = 7; y < n 7 < 8 true, enters for array[index_of_max] < array [y] 12 < 10 false, not in if CONTINUED IN NEXT PAGE for(int x=0; x<n; x++){ int index_of_min = x; for(int y=x; y<n; y++){ if(array[index_of_min]<array[y]){ index_of_min = y; int temp = array[x]; array[x] = array[index_of_min]; array[index_of_min] = temp; Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 38

39 Continued Selection Sort Code Analisys Array Elements: Start Order = 12, 9, 4, 99, 120, 1, 3, 10 public static void selection_srt(int array[], int n){ y++ y = 8; y < n 8 < 8 false, not in for for(int x=0; x<n; x++){ int index_of_min = x; for(int y=x; y<n; y++){ if(array[index_of_min]<array[y]){ index_of_min = y; So after 6 runs, the for loop stops and we have: index_of_max = 4 and x = 2 temp = array[2] temp = 4 array[x] = array[index_of_max] array[2] = 12 array[index_of_max] = temp array[4] = 4 int temp = array[x]; array[x] = array[index_of_min]; array[index_of_min] = temp; new array[ ] = {120, 99, 12, 9, 4, 1, 3, 10 Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 39

40 Selection Sort Code Analisys Array Elements: Start Order = 12, 9, 4, 99, 120, 1, 3, 10 array[ ] = {120, 99, 12, 9, 4, 1, 3, 10 public static void selection_srt(int array[], int n){ x++ x = 3; x < n 3 < 8 true, enters for y = x y = 3; index_of_max = x y < n 3 < 8 true, enters for index_of_max = 3; array[inder_of_max] < array [y] 9 < 9 false, not in if y++ y = 4; y < n 4 < 8 true, enters for array[index_of_max] < array [y] 9 < 4 false, not in if y++ y = 5; y < n 5 < 8 true, enters for array[index_of_max] < array [y] 9 < 1 false, not in if y++ y = 6; y < n 6 < 8 true, enters for array[index_of_max] < array [y] 9 < 3 false, not in if y++ y = 7; y < n 7 < 8 true, enters for array[index_of_max] < array [y] 9 < 10 true, enters if index_of_max = y index_of_max = 7 for(int x=0; x<n; x++){ int index_of_min = x; for(int y=x; y<n; y++){ if(array[index_of_min]<array[y]){ index_of_min = y; int temp = array[x]; array[x] = array[index_of_min]; array[index_of_min] = temp; CONTINUED IN NEXT PAGE Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 40

41 Continued Selection Sort Code Analisys Array Elements: Start Order = 12, 9, 4, 99, 120, 1, 3, 10 public static void selection_srt(int array[], int n){ y++ y = 8; y < n 8 < 8 false, not in for for(int x=0; x<n; x++){ int index_of_min = x; for(int y=x; y<n; y++){ if(array[index_of_min]<array[y]){ index_of_min = y; So after 5 runs, the for loop stops and we have: index_of_max = 7 and x = 3 temp = array[3] temp = 9 array[x] = array[index_of_max] array[3] = 10 array[index_of_max] = temp array[7] = 9 int temp = array[x]; array[x] = array[index_of_min]; array[index_of_min] = temp; new array[ ] = {120, 99, 12, 10, 4, 1, 3, 9 Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 41

42 Selection Sort Code Analisys Array Elements: Start Order = 12, 9, 4, 99, 120, 1, 3, 10 array[ ] = {120, 99, 12, 10, 4, 1, 3, 9 public static void selection_srt(int array[], int n){ x++ x = 4; x < n 4 < 8 true, enters for y = x y = 4; index_of_max = x y < n 4 < 8 true, enters for index_of_max = 4; array[inder_of_max] < array [y] 4 < 4 false, not in if y++ y = 5; y < n 5 < 8 true, enters for array[index_of_max] < array [y] 4 < 1 false, not in if y++ y = 6; y < n 6 < 8 true, enters for array[index_of_max] < array [y] 4 < 3 false, not in if y++ y = 7; y < n 7 < 8 true, enters for array[index_of_max] < array [y] 4 < 9 true, enters if index_of_max = y index_of_max = 7 y++ y = 8; y < n 8 < 8 false, not in for So after 4 runs, the for loop stops and we have: index_of_max = 7 and x = 4 for(int x=0; x<n; x++){ int index_of_min = x; for(int y=x; y<n; y++){ if(array[index_of_min]<array[y]){ index_of_min = y; int temp = array[x]; array[x] = array[index_of_min]; array[index_of_min] = temp; temp = array[4] temp = 4 array[x] = array[index_of_max] array[4] = 9 array[index_of_max] = temp array[7] = 4 new array[ ] = {120, 99, 12, 10, 9, 1, 3, 4 Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 42

43 Selection Sort Code Analisys Array Elements: Start Order = 12, 9, 4, 99, 120, 1, 3, 10 array[ ] = {120, 99, 12, 10, 9, 1, 3, 4 public static void selection_srt(int array[], int n){ x++ x = 5; x < n 5 < 8 true, enters for y = x y = 5; index_of_max = x y < n 5 < 8 true, enters for index_of_max = 5; array[inder_of_max] < array [y] 1 < 1 false, not in if y++ y = 6; y < n 6 < 8 true, enters for array[index_of_max] < array [y] 1 < 3 true, enters if index_of_max = y index_of_max = 6 y++ y = 7; y < n 7 < 8 true, enters for array[index_of_max] < array [y] 3 < 4 true, enters if index_of_max = y index_of_max = 7 y++ y = 8; y < n 8 < 8 false, not in for for(int x=0; x<n; x++){ int index_of_min = x; for(int y=x; y<n; y++){ if(array[index_of_min]<array[y]){ index_of_min = y; int temp = array[x]; array[x] = array[index_of_min]; array[index_of_min] = temp; So after 3 runs, the for loop stops and we have: index_of_max = 7 and x = 5 temp = array[5] temp = 1 array[x] = array[index_of_max] array[5] = 4 array[index_of_max] = temp array[7] = 1 new array[ ] = {120, 99, 12, 10, 9, 4, 3, 1 Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 43

44 Selection Sort Code Analisys Array Elements: Start Order = 12, 9, 4, 99, 120, 1, 3, 10 array[ ] = {120, 99, 12, 10, 9, 4, 3, 1 public static void selection_srt(int array[], int n){ x++ x = 6; x < n 6 < 8 true, enters for y = x y = 6; index_of_max = x y < n 6 < 8 true, enters for index_of_max = 6; array[inder_of_max] < array [y] 3 < 3 false, not in if y++ y = 7; y < n 7 < 8 true, enters for array[index_of_max] < array [y] 3 < 1 false, not in if y++ y = 8; y < n 8 < 8 false, not in for for(int x=0; x<n; x++){ int index_of_min = x; for(int y=x; y<n; y++){ if(array[index_of_min]<array[y]){ index_of_min = y; int temp = array[x]; array[x] = array[index_of_min]; array[index_of_min] = temp; So after 2 runs, the for loop stops and we have: index_of_max = 6 and x = 6 temp = array[6] temp = 3 array[x] = array[index_of_max] array[6] = 3 array[index_of_max] = temp array[6] = 3 new array[ ] = {120, 99, 12, 10, 9, 4, 3, 1 Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 44

45 Selection Sort Code Analisys Array Elements: Start Order = 12, 9, 4, 99, 120, 1, 3, 10 array[ ] = {120, 99, 12, 10, 9, 4, 3, 1 public static void selection_srt(int array[], int n){ x++ x = 7; x < n 7 < 8 true, enters for y = x y = 7; index_of_max = x y < n 7 < 8 true, enters for index_of_max = 7; array[inder_of_max] < array [y] 1 < 1 false, not in if y++ y = 8; y < n 8 < 8 false, not in for for(int x=0; x<n; x++){ int index_of_min = x; for(int y=x; y<n; y++){ if(array[index_of_min]<array[y]){ index_of_min = y; int temp = array[x]; array[x] = array[index_of_min]; array[index_of_min] = temp; So after 1 run, the for loop stops and we have: index_of_max = 7 and x = 7 temp = array[7] temp = 1 array[x] = array[index_of_max] array[7] = 1 array[index_of_max] = temp array[7] = 1 new array[ ] = {120, 99, 12, 10, 9, 4, 3, 1 Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 45

46 Selection Sort Code Analisys Array Elements: Start Order = 12, 9, 4, 99, 120, 1, 3, 10 array[ ] = {120, 99, 12, 10, 9, 4, 3, 1 public static void selection_srt(int array[], int n){ This for loop 8 runs 8 times tottaly in this case with the 8 size array[ ]. This for loop runs 36 times tottaly in this case with the 8 size array[ ]. Sorted array[ ] = {120, 99, 12, 10, 9, 4, 3, 1 It s sorted descending. If we wanted the array to be sorted ascending we should change the < comparison symbol to: > inside the if statement in the second for loop. for(int x=0; x<n; x++){ int index_of_min = x; for(int y=x; y<n; y++){ if(array[index_of_min]<array[y]){ index_of_min = y; int temp = array[x]; array[x] = array[index_of_min]; array[index_of_min] = temp; Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 46

47 Visual Paradigms Selection Sort Animation (with source code line by line visualization Selection Sort in Java Applets Centre Animated Sorting Algorithms: Selection Sort Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 47

48 Bibliography Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 48

49 Ασκήσεις Άσκηση 1 1. Μετατρέψτε τον κώδικα του select ώστε να ταξινομεί χρησιμοποιώντας την μέγιστη τιμή αντί της ελάχιστης (βλέπε slide «Selection Sort visual paradigm 2 using the maximum value»). Άσκηση 2 1. Μετατρέψτε τον κώδικα ενός από τους αλγορίθμους (π.χ. Select) έτσι ώστε να έχετε μια main που να καλεί ανάλογα με την επιλογή σας από την οθόνη όλους τους αλγόριθμους. 2. Για το ίδιο array αριθμών (μεγέθους 500 στοιχείων) εκτελεστέ ταξινόμηση και με τους 4 αλγόριθμους. Συγκρίνετε τον αριθμό των επαναλήψεων που χρειάζεται κάθε αλγόριθμος για να ταξινομήσει το array. 3. Κάντε το ίδιο για ένα array: 1. με μικρό αριθμό elements (1000 elements) 2. με μέτριο αριθμό elements (5000 elements) 3. με μεγάλο αριθμό elements (10000 elements) Μάθημα: Δομές Δεδομένων & Αλγόριθμοι (Εργαστήριο) Καθηγητής: Δρ. Βιδάκης Νίκος Slide 49

ΔΟΜΕΣ ΔΕΔΟΜΕΝΩΝ & ΑΛΓΟΡΙΘΜΟΙ ΕΡΓΑΣΤΗΡΙΟ

ΔΟΜΕΣ ΔΕΔΟΜΕΝΩΝ & ΑΛΓΟΡΙΘΜΟΙ ΕΡΓΑΣΤΗΡΙΟ ΔΟΜΕΣ ΔΕΔΟΜΕΝΩΝ & ΑΛΓΟΡΙΘΜΟΙ ΕΡΓΑΣΤΗΡΙΟ Κωδικός Θ: ΤΠ3001, Κωδικός Ε: ΤΠ3101 (ΜΕΥ/Υ) Ώρες (Θ - Ε): 4-2 Προαπαιτούμενα: Δρ. ΒΙΔΑΚΗΣ ΝΙΚΟΣ ΕΡΓΑΣΤΗΡΙΟ 4 Ταξινόμηση με 1. Bubble Sort 2. Quick Sort Bubble Sort

Διαβάστε περισσότερα

Πρόβλημα 1: Αναζήτηση Ελάχιστης/Μέγιστης Τιμής

Πρόβλημα 1: Αναζήτηση Ελάχιστης/Μέγιστης Τιμής Πρόβλημα 1: Αναζήτηση Ελάχιστης/Μέγιστης Τιμής Να γραφεί πρόγραμμα το οποίο δέχεται ως είσοδο μια ακολουθία S από n (n 40) ακέραιους αριθμούς και επιστρέφει ως έξοδο δύο ακολουθίες από θετικούς ακέραιους

Διαβάστε περισσότερα

ΔΟΜΕΣ ΔΕΔΟΜΕΝΩΝ & ΑΛΓΟΡΙΘΜΟΙ ΕΡΓΑΣΤΗΡΙΟ

ΔΟΜΕΣ ΔΕΔΟΜΕΝΩΝ & ΑΛΓΟΡΙΘΜΟΙ ΕΡΓΑΣΤΗΡΙΟ ΔΟΜΕΣ ΔΕΔΟΜΕΝΩΝ & ΑΛΓΟΡΙΘΜΟΙ ΕΡΓΑΣΤΗΡΙΟ Κωδικός Θ: ΤΠ3001, Κωδικός Ε: ΤΠ3101 (ΜΕΥ/Υ) Ώρες (Θ - Ε): 4-2 Προαπαιτούμενα: Δρ. ΒΙΔΑΚΗΣ ΝΙΚΟΣ ΕΡΓΑΣΤΗΡΙΟ 6 Στοίβα (Stack) Stack Introduction Stack is one of the

Διαβάστε περισσότερα

ΤΕΧΝΙΚΕΣ ΑΝΤΙΚΕΙΜΕΝΟΣΤΡΑΦΟΥΣ ΠΡΟΓΡΑΜΜΑΤΙΣΜΟΥ. Πίνακες Κλάσεις και Αντικείμενα

ΤΕΧΝΙΚΕΣ ΑΝΤΙΚΕΙΜΕΝΟΣΤΡΑΦΟΥΣ ΠΡΟΓΡΑΜΜΑΤΙΣΜΟΥ. Πίνακες Κλάσεις και Αντικείμενα ΤΕΧΝΙΚΕΣ ΑΝΤΙΚΕΙΜΕΝΟΣΤΡΑΦΟΥΣ ΠΡΟΓΡΑΜΜΑΤΙΣΜΟΥ Πίνακες Κλάσεις και Αντικείμενα Μαθήματα από το πρώτο εργαστήριο Έλεγχος ισότητας για Strings: Διαβάζουμε το String option και θέλουμε ένα loop να συνεχίσει

Διαβάστε περισσότερα

ΔΟΜΕΣ ΔΕΔΟΜΕΝΩΝ & ΑΛΓΟΡΙΘΜΟΙ ΕΡΓΑΣΤΗΡΙΟ

ΔΟΜΕΣ ΔΕΔΟΜΕΝΩΝ & ΑΛΓΟΡΙΘΜΟΙ ΕΡΓΑΣΤΗΡΙΟ ΔΟΜΕΣ ΔΕΔΟΜΕΝΩΝ & ΑΛΓΟΡΙΘΜΟΙ ΕΡΓΑΣΤΗΡΙΟ Κωδικός Θ: ΤΠ3001, Κωδικός Ε: ΤΠ3101 (ΜΕΥ/Υ) Ώρες (Θ - Ε): 4-2 Προαπαιτούμενα: Δρ. ΒΙΔΑΚΗΣ ΝΙΚΟΣ ΕΡΓΑΣΤΗΡΙΟ 7 Ουρά (Queue) Queue Μάθημα: Δομές Δεδομένων & Αλγόριθμοι

Διαβάστε περισσότερα

ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 24/3/2007

ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 24/3/2007 Οδηγίες: Να απαντηθούν όλες οι ερωτήσεις. Όλοι οι αριθμοί που αναφέρονται σε όλα τα ερωτήματα μικρότεροι του 10000 εκτός αν ορίζεται διαφορετικά στη διατύπωση του προβλήματος. Αν κάπου κάνετε κάποιες υποθέσεις

Διαβάστε περισσότερα

ΗΥ-150. Ταξινόµηση και Αναζήτηση

ΗΥ-150. Ταξινόµηση και Αναζήτηση ΗΥ-150 Ταξινόµηση και Αναζήτηση To πρόβληµα της Αναζήτησης οθέντος δεδοµένων, λ.χ. σε Πίνακα (P) Ψάχνω να βρω κάποιο συγκεκριµένο στοιχείο (key) Αν ο πίνακας δεν είναι ταξινοµηµένος Γραµµική Αναζήτηση

Διαβάστε περισσότερα

Διάλεξη 09: Αλγόριθμοι Ταξινόμησης I

Διάλεξη 09: Αλγόριθμοι Ταξινόμησης I Διάλεξη 09: Αλγόριθμοι Ταξινόμησης I Στην ενότητα αυτή θα μελετηθούν τα εξής επιμέρους θέματα: - Οι αλγόριθμοι ταξινόμησης: Α. SelectionSort Ταξινόμηση με Επιλογή Β. InsertionSort Ταξινόμηση με Εισαγωγή

Διαβάστε περισσότερα

ΔΟΜΕΣ ΔΕΔΟΜΕΝΩΝ & ΑΛΓΟΡΙΘΜΟΙ ΕΡΓΑΣΤΗΡΙΟ

ΔΟΜΕΣ ΔΕΔΟΜΕΝΩΝ & ΑΛΓΟΡΙΘΜΟΙ ΕΡΓΑΣΤΗΡΙΟ ΔΟΜΕΣ ΔΕΔΟΜΕΝΩΝ & ΑΛΓΟΡΙΘΜΟΙ ΕΡΓΑΣΤΗΡΙΟ Κωδικός Θ: ΤΠ3001, Κωδικός Ε: ΤΠ3101 (ΜΕΥ/Υ) Ώρες (Θ - Ε): 4-2 Προαπαιτούμενα: Δρ. ΒΙΔΑΚΗΣ ΝΙΚΟΣ ΕΡΓΑΣΤΗΡΙΟ 3 Sequential & Binary Search Σειριακή & Δυαδική Αναζήτηση

Διαβάστε περισσότερα

ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 19/5/2007

ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 19/5/2007 Οδηγίες: Να απαντηθούν όλες οι ερωτήσεις. Αν κάπου κάνετε κάποιες υποθέσεις να αναφερθούν στη σχετική ερώτηση. Όλα τα αρχεία που αναφέρονται στα προβλήματα βρίσκονται στον ίδιο φάκελο με το εκτελέσιμο

Διαβάστε περισσότερα

ΚΥΠΡΙΑΚΟΣ ΣΥΝΔΕΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY 21 ος ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ Δεύτερος Γύρος - 30 Μαρτίου 2011

ΚΥΠΡΙΑΚΟΣ ΣΥΝΔΕΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY 21 ος ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ Δεύτερος Γύρος - 30 Μαρτίου 2011 Διάρκεια Διαγωνισμού: 3 ώρες Απαντήστε όλες τις ερωτήσεις Μέγιστο Βάρος (20 Μονάδες) Δίνεται ένα σύνολο από N σφαιρίδια τα οποία δεν έχουν όλα το ίδιο βάρος μεταξύ τους και ένα κουτί που αντέχει μέχρι

Διαβάστε περισσότερα

ΤΕΧΝΙΚΕΣ ΑΝΤΙΚΕΙΜΕΝΟΣΤΡΑΦΟΥΣ ΠΡΟΓΡΑΜΜΑΤΙΣΜΟΥ. Εισαγωγή στη Java III

ΤΕΧΝΙΚΕΣ ΑΝΤΙΚΕΙΜΕΝΟΣΤΡΑΦΟΥΣ ΠΡΟΓΡΑΜΜΑΤΙΣΜΟΥ. Εισαγωγή στη Java III ΤΕΧΝΙΚΕΣ ΑΝΤΙΚΕΙΜΕΝΟΣΤΡΑΦΟΥΣ ΠΡΟΓΡΑΜΜΑΤΙΣΜΟΥ Εισαγωγή στη Java III Το if-else statement Το if-else statement δουλεύει καλά όταν στο condition θέλουμε να περιγράψουμε μια επιλογή με δύο πιθανά ενδεχόμενα.

Διαβάστε περισσότερα

FORTRAN & Αντικειμενοστραφής Προγραμματισμός ΣΝΜΜ 2017

FORTRAN & Αντικειμενοστραφής Προγραμματισμός ΣΝΜΜ 2017 FORTRAN & Αντικειμενοστραφής Προγραμματισμός ΣΝΜΜ 2017 M7 Δομές δεδομένων: Πίνακες - Ασκήσεις Γεώργιος Παπαλάμπρου Επικ. Καθηγητής ΕΜΠ Εργαστήριο Ναυτικής Μηχανολογίας george.papalambrou@lme.ntua.gr ΕΜΠ/ΣΝΜΜ

Διαβάστε περισσότερα

Προαπαιτούμενες Ασκήσεις 5 ου Εργαστηρίου. Dose stoixeio (integer) : 25 Found stoixeio in position 7 Dose stoixeio (integer) :94 Value not found

Προαπαιτούμενες Ασκήσεις 5 ου Εργαστηρίου. Dose stoixeio (integer) : 25 Found stoixeio in position 7 Dose stoixeio (integer) :94 Value not found Α. Πρώτη προαπαιτούµενη Κάθε οµάδα θα πρέπει να δηµιουργήσει τον ζητούµενο παρακάτω πίνακα και α. να εµφανίσει τα στοιχεία του, β. να τυπώσει τον µέσο όρο των στοιχείων του, γ. να ταξινοµήσει τα στοιχεία

Διαβάστε περισσότερα

Section 8.3 Trigonometric Equations

Section 8.3 Trigonometric Equations 99 Section 8. Trigonometric Equations Objective 1: Solve Equations Involving One Trigonometric Function. In this section and the next, we will exple how to solving equations involving trigonometric functions.

Διαβάστε περισσότερα

The Simply Typed Lambda Calculus

The Simply Typed Lambda Calculus Type Inference Instead of writing type annotations, can we use an algorithm to infer what the type annotations should be? That depends on the type system. For simple type systems the answer is yes, and

Διαβάστε περισσότερα

Physical DB Design. B-Trees Index files can become quite large for large main files Indices on index files are possible.

Physical DB Design. B-Trees Index files can become quite large for large main files Indices on index files are possible. B-Trees Index files can become quite large for large main files Indices on index files are possible 3 rd -level index 2 nd -level index 1 st -level index Main file 1 The 1 st -level index consists of pairs

Διαβάστε περισσότερα

Π.Μ.. ΣΜΖΜΑΣΟ ΠΛΖΡΟΦΟΡΗΚΖ ΓΗΠΛΧΜΑΣΗΚΖ ΔΡΓΑΗΑ. Υπνινγηζηηθή ζύγθξηζε ησλ αιγνξίζκσλ Heap Sort θαη Weak Heap Sort. Βαζηιεία Φνξκόδε Α.Μ.

Π.Μ.. ΣΜΖΜΑΣΟ ΠΛΖΡΟΦΟΡΗΚΖ ΓΗΠΛΧΜΑΣΗΚΖ ΔΡΓΑΗΑ. Υπνινγηζηηθή ζύγθξηζε ησλ αιγνξίζκσλ Heap Sort θαη Weak Heap Sort. Βαζηιεία Φνξκόδε Α.Μ. Π.Μ.. ΣΜΖΜΑΣΟ ΠΛΖΡΟΦΟΡΗΚΖ ΓΗΠΛΧΜΑΣΗΚΖ ΔΡΓΑΗΑ Υπνινγηζηηθή ζύγθξηζε ησλ αιγνξίζκσλ Heap Sort θαη Weak Heap Sort. Βαζηιεία Φνξκόδε Α.Μ. 43/11 Δπηβιέπσλ Καζεγεηήο: ακαξάο Νηθφιανο, Δπ. Καζεγεηήο Σκήκα Δθαξκνζκέλεο

Διαβάστε περισσότερα

3.4 SUM AND DIFFERENCE FORMULAS. NOTE: cos(α+β) cos α + cos β cos(α-β) cos α -cos β

3.4 SUM AND DIFFERENCE FORMULAS. NOTE: cos(α+β) cos α + cos β cos(α-β) cos α -cos β 3.4 SUM AND DIFFERENCE FORMULAS Page Theorem cos(αβ cos α cos β -sin α cos(α-β cos α cos β sin α NOTE: cos(αβ cos α cos β cos(α-β cos α -cos β Proof of cos(α-β cos α cos β sin α Let s use a unit circle

Διαβάστε περισσότερα

Δομές Δεδομένων. Δημήτρης Μιχαήλ. Υλοποίηση Δυαδικού Σωρού σε γλώσσα Java. Τμήμα Πληροφορικής και Τηλεματικής Χαροκόπειο Πανεπιστήμιο

Δομές Δεδομένων. Δημήτρης Μιχαήλ. Υλοποίηση Δυαδικού Σωρού σε γλώσσα Java. Τμήμα Πληροφορικής και Τηλεματικής Χαροκόπειο Πανεπιστήμιο Δομές Δεδομένων Υλοποίηση Δυαδικού Σωρού σε γλώσσα Java Δημήτρης Μιχαήλ Τμήμα Πληροφορικής και Τηλεματικής Χαροκόπειο Πανεπιστήμιο Σωρός Μεγίστου ως ΑΤΔ Ένας σωρός μεγίστου (max heap) είναι ένας ΑΤΔ που

Διαβάστε περισσότερα

ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 6/5/2006

ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 6/5/2006 Οδηγίες: Να απαντηθούν όλες οι ερωτήσεις. Ολοι οι αριθμοί που αναφέρονται σε όλα τα ερωτήματα είναι μικρότεροι το 1000 εκτός αν ορίζεται διαφορετικά στη διατύπωση του προβλήματος. Διάρκεια: 3,5 ώρες Καλή

Διαβάστε περισσότερα

derivation of the Laplacian from rectangular to spherical coordinates

derivation of the Laplacian from rectangular to spherical coordinates derivation of the Laplacian from rectangular to spherical coordinates swapnizzle 03-03- :5:43 We begin by recognizing the familiar conversion from rectangular to spherical coordinates (note that φ is used

Διαβάστε περισσότερα

ΑΤΕΙ ΘΕΣΣΑΛΟΝΙΚΗΣ ΤΜΗΜΑ ΜΗΧΑΝΙΚΩΝ ΠΛΗΡΟΦΟΡΙΚΗΣ Αλγοριθμική και Προγραμματισμός. Παναγιώτης Σφέτσος. sfetsos@it.teithe.gr

ΑΤΕΙ ΘΕΣΣΑΛΟΝΙΚΗΣ ΤΜΗΜΑ ΜΗΧΑΝΙΚΩΝ ΠΛΗΡΟΦΟΡΙΚΗΣ Αλγοριθμική και Προγραμματισμός. Παναγιώτης Σφέτσος. sfetsos@it.teithe.gr ΑΤΕΙ ΘΕΣΣΑΛΟΝΙΚΗΣ ΤΜΗΜΑ ΜΗΧΑΝΙΚΩΝ ΠΛΗΡΟΦΟΡΙΚΗΣ Αλγοριθμική και Προγραμματισμός Παναγιώτης Σφέτσος sfetsos@it.teithe.gr Π ί ν α κ ε ς - A r r a y s Είναι χώροι της μνήμης για προσωρινή αποθήκευση δεδομένων

Διαβάστε περισσότερα

Αλγόριθμοι Ταξινόμησης Μέρος 3

Αλγόριθμοι Ταξινόμησης Μέρος 3 Αλγόριθμοι Ταξινόμησης Μέρος 3 Μανόλης Κουμπαράκης 1 Ταξινόμηση με Ουρά Προτεραιότητας Θα παρουσιάσουμε τώρα δύο αλγόριθμους ταξινόμησης που χρησιμοποιούν μια ουρά προτεραιότητας για την υλοποίηση τους.

Διαβάστε περισσότερα

Instruction Execution Times

Instruction Execution Times 1 C Execution Times InThisAppendix... Introduction DL330 Execution Times DL330P Execution Times DL340 Execution Times C-2 Execution Times Introduction Data Registers This appendix contains several tables

Διαβάστε περισσότερα

Διάλεξη 17η: Ταξινόμηση και Αναζήτηση

Διάλεξη 17η: Ταξινόμηση και Αναζήτηση Διάλεξη 17η: Ταξινόμηση και Αναζήτηση Τμήμα Επιστήμης Υπολογιστών, Πανεπιστήμιο Κρήτης Εισαγωγή στην Επιστήμη Υπολογιστών Πρατικάκης (CSD) Ταξινόμηση CS100, 2016-2017 1 / 10 Το πρόβλημα της Αναζήτησης

Διαβάστε περισσότερα

ANSWERSHEET (TOPIC = DIFFERENTIAL CALCULUS) COLLECTION #2. h 0 h h 0 h h 0 ( ) g k = g 0 + g 1 + g g 2009 =?

ANSWERSHEET (TOPIC = DIFFERENTIAL CALCULUS) COLLECTION #2. h 0 h h 0 h h 0 ( ) g k = g 0 + g 1 + g g 2009 =? Teko Classes IITJEE/AIEEE Maths by SUHAAG SIR, Bhopal, Ph (0755) 3 00 000 www.tekoclasses.com ANSWERSHEET (TOPIC DIFFERENTIAL CALCULUS) COLLECTION # Question Type A.Single Correct Type Q. (A) Sol least

Διαβάστε περισσότερα

Overview. Transition Semantics. Configurations and the transition relation. Executions and computation

Overview. Transition Semantics. Configurations and the transition relation. Executions and computation Overview Transition Semantics Configurations and the transition relation Executions and computation Inference rules for small-step structural operational semantics for the simple imperative language Transition

Διαβάστε περισσότερα

Διδάσκων: Κωνσταντίνος Κώστα Διαφάνειες: Δημήτρης Ζεϊναλιπούρ ΕΠΛ 035 Δομές Δεδομένων και Αλγόριθμοι για Ηλ. Μηχ. και Μηχ. Υπολ.

Διδάσκων: Κωνσταντίνος Κώστα Διαφάνειες: Δημήτρης Ζεϊναλιπούρ ΕΠΛ 035 Δομές Δεδομένων και Αλγόριθμοι για Ηλ. Μηχ. και Μηχ. Υπολ. Διάλεξη 13: Αλγόριθμοι Ταξινόμησης Στην ενότητα αυτή θα μελετηθούν τα εξής επιμέρους θέματα: Οι αλγόριθμοι ταξινόμησης SelectionSort, InsertionSort, Στις ερχόμενες διαλέξεις θα δούμε τους αλγόριθμους Mergesort,

Διαβάστε περισσότερα

Σημειώσεις δεύτερης εβδομάδας

Σημειώσεις δεύτερης εβδομάδας Σημειώσεις δεύτερης εβδομάδας 1. Δυαδική αναζήτηση: /* BINARY SEARCH */ /* use sorted input */ #include int main() { int c, first, last, middle, n, search, array[100]; printf("enter number of

Διαβάστε περισσότερα

Απόκριση σε Μοναδιαία Ωστική Δύναμη (Unit Impulse) Απόκριση σε Δυνάμεις Αυθαίρετα Μεταβαλλόμενες με το Χρόνο. Απόστολος Σ.

Απόκριση σε Μοναδιαία Ωστική Δύναμη (Unit Impulse) Απόκριση σε Δυνάμεις Αυθαίρετα Μεταβαλλόμενες με το Χρόνο. Απόστολος Σ. Απόκριση σε Δυνάμεις Αυθαίρετα Μεταβαλλόμενες με το Χρόνο The time integral of a force is referred to as impulse, is determined by and is obtained from: Newton s 2 nd Law of motion states that the action

Διαβάστε περισσότερα

2 Composition. Invertible Mappings

2 Composition. Invertible Mappings Arkansas Tech University MATH 4033: Elementary Modern Algebra Dr. Marcel B. Finan Composition. Invertible Mappings In this section we discuss two procedures for creating new mappings from old ones, namely,

Διαβάστε περισσότερα

Homework 3 Solutions

Homework 3 Solutions Homework 3 Solutions Igor Yanovsky (Math 151A TA) Problem 1: Compute the absolute error and relative error in approximations of p by p. (Use calculator!) a) p π, p 22/7; b) p π, p 3.141. Solution: For

Διαβάστε περισσότερα

ΠΑΝΕΠΙΣΤΗΜΙΟ ΚΥΠΡΟΥ - ΤΜΗΜΑ ΠΛΗΡΟΦΟΡΙΚΗΣ ΕΠΛ 133: ΑΝΤΙΚΕΙΜΕΝΟΣΤΡΕΦΗΣ ΠΡΟΓΡΑΜΜΑΤΙΣΜΟΣ ΕΡΓΑΣΤΗΡΙΟ 3 Javadoc Tutorial

ΠΑΝΕΠΙΣΤΗΜΙΟ ΚΥΠΡΟΥ - ΤΜΗΜΑ ΠΛΗΡΟΦΟΡΙΚΗΣ ΕΠΛ 133: ΑΝΤΙΚΕΙΜΕΝΟΣΤΡΕΦΗΣ ΠΡΟΓΡΑΜΜΑΤΙΣΜΟΣ ΕΡΓΑΣΤΗΡΙΟ 3 Javadoc Tutorial ΕΡΓΑΣΤΗΡΙΟ 3 Javadoc Tutorial Introduction Το Javadoc είναι ένα εργαλείο που παράγει αρχεία html (παρόμοιο με τις σελίδες στη διεύθυνση http://docs.oracle.com/javase/8/docs/api/index.html) από τα σχόλια

Διαβάστε περισσότερα

HOMEWORK 4 = G. In order to plot the stress versus the stretch we define a normalized stretch:

HOMEWORK 4 = G. In order to plot the stress versus the stretch we define a normalized stretch: HOMEWORK 4 Problem a For the fast loading case, we want to derive the relationship between P zz and λ z. We know that the nominal stress is expressed as: P zz = ψ λ z where λ z = λ λ z. Therefore, applying

Διαβάστε περισσότερα

ΕΙΣΑΓΩΓΗ ΣΤΗ ΣΤΑΤΙΣΤΙΚΗ ΑΝΑΛΥΣΗ

ΕΙΣΑΓΩΓΗ ΣΤΗ ΣΤΑΤΙΣΤΙΚΗ ΑΝΑΛΥΣΗ ΕΙΣΑΓΩΓΗ ΣΤΗ ΣΤΑΤΙΣΤΙΚΗ ΑΝΑΛΥΣΗ ΕΛΕΝΑ ΦΛΟΚΑ Επίκουρος Καθηγήτρια Τµήµα Φυσικής, Τοµέας Φυσικής Περιβάλλοντος- Μετεωρολογίας ΓΕΝΙΚΟΙ ΟΡΙΣΜΟΙ Πληθυσµός Σύνολο ατόµων ή αντικειµένων στα οποία αναφέρονται

Διαβάστε περισσότερα

ΗΥ-150. Προγραμματισμός

ΗΥ-150. Προγραμματισμός ΗΥ-150 Ταξινόμηση και Αναζήτηση To πρόβλημα της Αναζήτησης Δοθέντος δεδομένων, λ.χ. σε Πίνακα (P) Ψάχνω να βρω κάποιο συγκεκριμένο στοιχείο (key) Αν ο πίνακας δεν είναι ταξινομημένος Γραμμική Αναζήτηση

Διαβάστε περισσότερα

EE512: Error Control Coding

EE512: Error Control Coding EE512: Error Control Coding Solution for Assignment on Finite Fields February 16, 2007 1. (a) Addition and Multiplication tables for GF (5) and GF (7) are shown in Tables 1 and 2. + 0 1 2 3 4 0 0 1 2 3

Διαβάστε περισσότερα

Συστήματα Διαχείρισης Βάσεων Δεδομένων

Συστήματα Διαχείρισης Βάσεων Δεδομένων ΕΛΛΗΝΙΚΗ ΔΗΜΟΚΡΑΤΙΑ ΠΑΝΕΠΙΣΤΗΜΙΟ ΚΡΗΤΗΣ Συστήματα Διαχείρισης Βάσεων Δεδομένων Φροντιστήριο 9: Transactions - part 1 Δημήτρης Πλεξουσάκης Τμήμα Επιστήμης Υπολογιστών Tutorial on Undo, Redo and Undo/Redo

Διαβάστε περισσότερα

ΑΛΓΟΡΙΘΜΟΙ Άνοιξη I. ΜΗΛΗΣ

ΑΛΓΟΡΙΘΜΟΙ  Άνοιξη I. ΜΗΛΗΣ ΑΛΓΟΡΙΘΜΟΙ http://eclass.aueb.gr/courses/inf161/ Άνοιξη 2016 - I. ΜΗΛΗΣ ΠΑΡΑΔΕΙΓΜΑΤΑ ΑΛΓΟΡΙΘΜΩΝ ΚΑΙ ΠΟΛΥΠΛΟΚΟΤΗΤΑΣ ΑΛΓΟΡΙΘΜΟΙ - ΑΝΟΙΞΗ 2016 - Ι. ΜΗΛΗΣ - 03 - EXAMPLES ALG & COMPL 1 Example: GCD συνάρτηση

Διαβάστε περισσότερα

Στόχοι και αντικείμενο ενότητας. Πέρασμα Πίνακα σε Συνάρτηση (συν.) Πέρασμα Πίνακα σε Συνάρτηση. #8.. Ειδικά Θέματα Αλγορίθμων

Στόχοι και αντικείμενο ενότητας. Πέρασμα Πίνακα σε Συνάρτηση (συν.) Πέρασμα Πίνακα σε Συνάρτηση. #8.. Ειδικά Θέματα Αλγορίθμων Στόχοι και αντικείμενο ενότητας Πέρασμα Πίνακα σε Συνάρτηση #8.. Ειδικά Θέματα Αλγορίθμων Προβλήματα Αναζήτησης Γραμμική Αναζήτηση (Linear Search) Ενημέρωση Μέτρηση Δυαδική Αναζήτηση (Binary Search) Προβλήματα

Διαβάστε περισσότερα

Δομές Δεδομένων - Εργαστήριο 5. Ουρές Προτεραιότητας

Δομές Δεδομένων - Εργαστήριο 5. Ουρές Προτεραιότητας Ουρές Προτεραιότητας Ουρά Προτεραιότητας (Priority Queue) Μια συλλογή αντικειμένων που χαρακτηρίζονται από μια συγκρίσιμη προτεραιότητα. Έχει την λογική εικόνα μιας δομής δεδομένων όπου, αντικείμενα εισέρχονται

Διαβάστε περισσότερα

ST5224: Advanced Statistical Theory II

ST5224: Advanced Statistical Theory II ST5224: Advanced Statistical Theory II 2014/2015: Semester II Tutorial 7 1. Let X be a sample from a population P and consider testing hypotheses H 0 : P = P 0 versus H 1 : P = P 1, where P j is a known

Διαβάστε περισσότερα

C.S. 430 Assignment 6, Sample Solutions

C.S. 430 Assignment 6, Sample Solutions C.S. 430 Assignment 6, Sample Solutions Paul Liu November 15, 2007 Note that these are sample solutions only; in many cases there were many acceptable answers. 1 Reynolds Problem 10.1 1.1 Normal-order

Διαβάστε περισσότερα

int Α[] = {4, 16, 22, 12, 9, 15, 10}; { 4, 9, 10, 12, 15, 16, 22 } Α[0]=4, Α[1]=9, Α[2]=10 { 4, 16,22, 12, 9, 15, 10} { 4, 12, 16, 22, 9, 15,16, 22 }

int Α[] = {4, 16, 22, 12, 9, 15, 10}; { 4, 9, 10, 12, 15, 16, 22 } Α[0]=4, Α[1]=9, Α[2]=10 { 4, 16,22, 12, 9, 15, 10} { 4, 12, 16, 22, 9, 15,16, 22 } ΤΑΞΙΝΟΜΗΣΗ- ΑΣΚΗΣΕΙΣ Οι μέθοδοι ταξινόμησης INSERTION, SELECTION και BUBBLE SORT με την ολοκλήρωσή τους θα έχουν σε κάθε θέση του πίνακα το σωστό στοιχείο x (ταξινόμηση με αύξουσα σειρά δηλ. στην θέση

Διαβάστε περισσότερα

ΕΛΛΗΝΙΚΗ ΔΗΜΟΚΡΑΤΙΑ ΠΑΝΕΠΙΣΤΗΜΙΟ ΚΡΗΤΗΣ. Ψηφιακή Οικονομία. Διάλεξη 7η: Consumer Behavior Mαρίνα Μπιτσάκη Τμήμα Επιστήμης Υπολογιστών

ΕΛΛΗΝΙΚΗ ΔΗΜΟΚΡΑΤΙΑ ΠΑΝΕΠΙΣΤΗΜΙΟ ΚΡΗΤΗΣ. Ψηφιακή Οικονομία. Διάλεξη 7η: Consumer Behavior Mαρίνα Μπιτσάκη Τμήμα Επιστήμης Υπολογιστών ΕΛΛΗΝΙΚΗ ΔΗΜΟΚΡΑΤΙΑ ΠΑΝΕΠΙΣΤΗΜΙΟ ΚΡΗΤΗΣ Ψηφιακή Οικονομία Διάλεξη 7η: Consumer Behavior Mαρίνα Μπιτσάκη Τμήμα Επιστήμης Υπολογιστών Τέλος Ενότητας Χρηματοδότηση Το παρόν εκπαιδευτικό υλικό έχει αναπτυχθεί

Διαβάστε περισσότερα

Srednicki Chapter 55

Srednicki Chapter 55 Srednicki Chapter 55 QFT Problems & Solutions A. George August 3, 03 Srednicki 55.. Use equations 55.3-55.0 and A i, A j ] = Π i, Π j ] = 0 (at equal times) to verify equations 55.-55.3. This is our third

Διαβάστε περισσότερα

Main source: "Discrete-time systems and computer control" by Α. ΣΚΟΔΡΑΣ ΨΗΦΙΑΚΟΣ ΕΛΕΓΧΟΣ ΔΙΑΛΕΞΗ 4 ΔΙΑΦΑΝΕΙΑ 1

Main source: Discrete-time systems and computer control by Α. ΣΚΟΔΡΑΣ ΨΗΦΙΑΚΟΣ ΕΛΕΓΧΟΣ ΔΙΑΛΕΞΗ 4 ΔΙΑΦΑΝΕΙΑ 1 Main source: "Discrete-time systems and computer control" by Α. ΣΚΟΔΡΑΣ ΨΗΦΙΑΚΟΣ ΕΛΕΓΧΟΣ ΔΙΑΛΕΞΗ 4 ΔΙΑΦΑΝΕΙΑ 1 A Brief History of Sampling Research 1915 - Edmund Taylor Whittaker (1873-1956) devised a

Διαβάστε περισσότερα

ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 11/3/2006

ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 11/3/2006 ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 11/3/26 Οδηγίες: Να απαντηθούν όλες οι ερωτήσεις. Ολοι οι αριθμοί που αναφέρονται σε όλα τα ερωτήματα μικρότεροι το 1 εκτός αν ορίζεται διαφορετικά στη διατύπωση

Διαβάστε περισσότερα

Second Order RLC Filters

Second Order RLC Filters ECEN 60 Circuits/Electronics Spring 007-0-07 P. Mathys Second Order RLC Filters RLC Lowpass Filter A passive RLC lowpass filter (LPF) circuit is shown in the following schematic. R L C v O (t) Using phasor

Διαβάστε περισσότερα

department listing department name αχχουντσ ϕανε βαλικτ δδσϕηασδδη σδηφγ ασκϕηλκ τεχηνιχαλ αλαν ϕουν διξ τεχηνιχαλ ϕοην µαριανι

department listing department name αχχουντσ ϕανε βαλικτ δδσϕηασδδη σδηφγ ασκϕηλκ τεχηνιχαλ αλαν ϕουν διξ τεχηνιχαλ ϕοην µαριανι She selects the option. Jenny starts with the al listing. This has employees listed within She drills down through the employee. The inferred ER sttricture relates this to the redcords in the databasee

Διαβάστε περισσότερα

VBA ΣΤΟ WORD. 1. Συχνά, όταν ήθελα να δώσω ένα φυλλάδιο εργασίας με ασκήσεις στους μαθητές έκανα το εξής: Version 25-7-2015 ΗΜΙΤΕΛΗΣ!!!!

VBA ΣΤΟ WORD. 1. Συχνά, όταν ήθελα να δώσω ένα φυλλάδιο εργασίας με ασκήσεις στους μαθητές έκανα το εξής: Version 25-7-2015 ΗΜΙΤΕΛΗΣ!!!! VBA ΣΤΟ WORD Version 25-7-2015 ΗΜΙΤΕΛΗΣ!!!! Μου παρουσιάστηκαν δύο θέματα. 1. Συχνά, όταν ήθελα να δώσω ένα φυλλάδιο εργασίας με ασκήσεις στους μαθητές έκανα το εξής: Εγραφα σε ένα αρχείο του Word τις

Διαβάστε περισσότερα

Εργαστήριο 7: Ο αλγόριθμος ταξινόμησης Radix Sort

Εργαστήριο 7: Ο αλγόριθμος ταξινόμησης Radix Sort Εργαστήριο 7: Ο αλγόριθμος ταξινόμησης Radix Sort Στην ενότητα αυτή θα μελετηθούν τα εξής επιμέρους θέματα: -Ο αλγόριθμος ταξινόμησης Radix Sort -Δυο εκδοχές: Most Significant Digit (MSD) και Least Significant

Διαβάστε περισσότερα

11/23/2014. Στόχοι. Λογισμικό Υπολογιστή

11/23/2014. Στόχοι. Λογισμικό Υπολογιστή ονάδα Δικτύων και Επικοινωνιών ΗΥ Τομέας Πληροφορικής, αθηματικών και Στατιστικής ΓΕΩΠΟΙΚΟ ΠΑΕΠΙΣΤΗΙΟ ΑΘΗΩ Εισαγωγή στην Επιστήμη των ΗΥ άθημα-4 url: http://openeclass.aua.gr (AOA0) Λογισμικό Υπολογιστή

Διαβάστε περισσότερα

ΕΡΓΑΣΤΗΡΙΟ 5 ΣΗΜΕΙΩΣΕΙΣ

ΕΡΓΑΣΤΗΡΙΟ 5 ΣΗΜΕΙΩΣΕΙΣ ΠΑΝΕΠΙΣΤΗΜΙΟ ΘΕΣΣΑΛΙΑΣ ΤΜΗΜΑ ΠΛΗΡΟΦΟΡΙΚΗΣ ΑΚΑΔΗΜΑΪΚΟ ΕΤΟΣ 2017-2018 ΧΕΙΜΕΡΙΝΟ ΕΞΑΜΗΝΟ ΜΑΘΗΜΑ: ΔΟΜΕΣ ΔΕΔΟΜΕΝΩΝ Ουρές ΕΡΓΑΣΤΗΡΙΟ 5 ΣΗΜΕΙΩΣΕΙΣ Μια ουρά αποτελεί μια δομή δεδομένων στη λογική του First-in

Διαβάστε περισσότερα

ΑΛΓΟΡΙΘΜΟΙ Άνοιξη I. ΜΗΛΗΣ

ΑΛΓΟΡΙΘΜΟΙ  Άνοιξη I. ΜΗΛΗΣ ΑΛΓΟΡΙΘΜΟΙ http://eclass.aueb.gr/courses/inf161/ Άνοιξη 216 - I. ΜΗΛΗΣ ΔΥΝΑΜΙΚΟΣ ΠΡΟΓΡΑΜΜΑΤΙΣΜΟΣ ΑΛΓΟΡΙΘΜΟΙ - ΑΝΟΙΞΗ 216 - Ι. ΜΗΛΗΣ 9 DP II 1 Dynamic Programming ΓΕΝΙΚΗ ΙΔΕΑ 1. Ορισμός υπο-προβλήματος/ων

Διαβάστε περισσότερα

Εργαστήριο Ανάπτυξης Εφαρμογών Βάσεων Δεδομένων. Εξάμηνο 7 ο

Εργαστήριο Ανάπτυξης Εφαρμογών Βάσεων Δεδομένων. Εξάμηνο 7 ο Εργαστήριο Ανάπτυξης Εφαρμογών Βάσεων Δεδομένων Εξάμηνο 7 ο Procedures and Functions Stored procedures and functions are named blocks of code that enable you to group and organize a series of SQL and PL/SQL

Διαβάστε περισσότερα

Δημιουργία Λογαριασμού Διαχείρισης Business Telephony Create a Management Account for Business Telephony

Δημιουργία Λογαριασμού Διαχείρισης Business Telephony Create a Management Account for Business Telephony Δημιουργία Λογαριασμού Διαχείρισης Business Telephony Create a Management Account for Business Telephony Ελληνικά Ι English 1/7 Δημιουργία Λογαριασμού Διαχείρισης Επιχειρηματικής Τηλεφωνίας μέσω της ιστοσελίδας

Διαβάστε περισσότερα

ΤΕΧΝΙΚΕΣ ΑΝΤΙΚΕΙΜΕΝΟΣΤΡΑΦΟΥΣ ΠΡΟΓΡΑΜΜΑΤΙΣΜΟΥ. Κλάσεις και αντικείμενα στην Java Strings Πίνακες

ΤΕΧΝΙΚΕΣ ΑΝΤΙΚΕΙΜΕΝΟΣΤΡΑΦΟΥΣ ΠΡΟΓΡΑΜΜΑΤΙΣΜΟΥ. Κλάσεις και αντικείμενα στην Java Strings Πίνακες ΤΕΧΝΙΚΕΣ ΑΝΤΙΚΕΙΜΕΝΟΣΤΡΑΦΟΥΣ ΠΡΟΓΡΑΜΜΑΤΙΣΜΟΥ Κλάσεις και αντικείμενα στην Java Strings Πίνακες ΚΛΑΣΕΙΣ ΚΑΙ ΑΝΤΙΚΕΙΜΕΝΑ Κλάση Μια κλάση είναι μία αφηρημένη περιγραφή αντικειμένων με κοινά χαρακτηριστικά

Διαβάστε περισσότερα

Αντικειμενοστρεφής Προγραμματισμός Διάλεξη 6 : ΠΙΝΑΚΕΣ

Αντικειμενοστρεφής Προγραμματισμός Διάλεξη 6 : ΠΙΝΑΚΕΣ Αντικειμενοστρεφής Προγραμματισμός Διάλεξη 6 : ΠΙΝΑΚΕΣ Κων. Κόκκινος ΠΙΝΑΚΕΣ (ARRAYS) Είναι χώροι της μνήμης για προσωρινή αποθήκευση δεδομένων του ίδιου τύπου. Οι πίνακες είναι δομές δεδομένων που τις

Διαβάστε περισσότερα

14 Lesson 2: The Omega Verb - Present Tense

14 Lesson 2: The Omega Verb - Present Tense Lesson 2: The Omega Verb - Present Tense Day one I. Word Study and Grammar 1. Most Greek verbs end in in the first person singular. 2. The present tense is formed by adding endings to the present stem.

Διαβάστε περισσότερα

Capacitors - Capacitance, Charge and Potential Difference

Capacitors - Capacitance, Charge and Potential Difference Capacitors - Capacitance, Charge and Potential Difference Capacitors store electric charge. This ability to store electric charge is known as capacitance. A simple capacitor consists of 2 parallel metal

Διαβάστε περισσότερα

Δομές Δεδομένων και Αλγόριθμοι

Δομές Δεδομένων και Αλγόριθμοι Δομές Δεδομένων και Αλγόριθμοι Χρήστος Γκόγκος ΤΕΙ Ηπείρου Χειμερινό Εξάμηνο 2014-2015 Παρουσίαση 22 Counting sort, bucket sort και radix sort 1 / 16 Ιδιότητες αλγορίθμων ταξινόμησης ευστάθεια (stable

Διαβάστε περισσότερα

Partial Differential Equations in Biology The boundary element method. March 26, 2013

Partial Differential Equations in Biology The boundary element method. March 26, 2013 The boundary element method March 26, 203 Introduction and notation The problem: u = f in D R d u = ϕ in Γ D u n = g on Γ N, where D = Γ D Γ N, Γ D Γ N = (possibly, Γ D = [Neumann problem] or Γ N = [Dirichlet

Διαβάστε περισσότερα

Other Test Constructions: Likelihood Ratio & Bayes Tests

Other Test Constructions: Likelihood Ratio & Bayes Tests Other Test Constructions: Likelihood Ratio & Bayes Tests Side-Note: So far we have seen a few approaches for creating tests such as Neyman-Pearson Lemma ( most powerful tests of H 0 : θ = θ 0 vs H 1 :

Διαβάστε περισσότερα

9.09. # 1. Area inside the oval limaçon r = cos θ. To graph, start with θ = 0 so r = 6. Compute dr

9.09. # 1. Area inside the oval limaçon r = cos θ. To graph, start with θ = 0 so r = 6. Compute dr 9.9 #. Area inside the oval limaçon r = + cos. To graph, start with = so r =. Compute d = sin. Interesting points are where d vanishes, or at =,,, etc. For these values of we compute r:,,, and the values

Διαβάστε περισσότερα

Surface Mount Multilayer Chip Capacitors for Commodity Solutions

Surface Mount Multilayer Chip Capacitors for Commodity Solutions Surface Mount Multilayer Chip Capacitors for Commodity Solutions Below tables are test procedures and requirements unless specified in detail datasheet. 1) Visual and mechanical 2) Capacitance 3) Q/DF

Διαβάστε περισσότερα

The challenges of non-stable predicates

The challenges of non-stable predicates The challenges of non-stable predicates Consider a non-stable predicate Φ encoding, say, a safety property. We want to determine whether Φ holds for our program. The challenges of non-stable predicates

Διαβάστε περισσότερα

Approximation of distance between locations on earth given by latitude and longitude

Approximation of distance between locations on earth given by latitude and longitude Approximation of distance between locations on earth given by latitude and longitude Jan Behrens 2012-12-31 In this paper we shall provide a method to approximate distances between two points on earth

Διαβάστε περισσότερα

Block Ciphers Modes. Ramki Thurimella

Block Ciphers Modes. Ramki Thurimella Block Ciphers Modes Ramki Thurimella Only Encryption I.e. messages could be modified Should not assume that nonsensical messages do no harm Always must be combined with authentication 2 Padding Must be

Διαβάστε περισσότερα

(C) 2010 Pearson Education, Inc. All rights reserved.

(C) 2010 Pearson Education, Inc. All rights reserved. Connectionless transmission with datagrams. Connection-oriented transmission is like the telephone system You dial and are given a connection to the telephone of fthe person with whom you wish to communicate.

Διαβάστε περισσότερα

ΠΛΗ111. Ανοιξη Μάθηµα 9 ο. Ταξινόµηση. Τµήµα Ηλεκτρονικών Μηχανικών και Μηχανικών Υπολογιστών Πολυτεχνείο Κρήτης

ΠΛΗ111. Ανοιξη Μάθηµα 9 ο. Ταξινόµηση. Τµήµα Ηλεκτρονικών Μηχανικών και Μηχανικών Υπολογιστών Πολυτεχνείο Κρήτης ΠΛΗ111 οµηµένος Προγραµµατισµός Ανοιξη 2005 Μάθηµα 9 ο Ταξινόµηση Τµήµα Ηλεκτρονικών Μηχανικών και Μηχανικών Υπολογιστών Πολυτεχνείο Κρήτης Ταξινόµηση Εισαγωγή Selection sort Insertion sort Bubble sort

Διαβάστε περισσότερα

ΑΡΙΣΤΟΤΕΛΕΙΟ ΠΑΝΕΠΙΣΤΗΜΙΟ ΘΕΣΣΑΛΟΝΙΚΗΣ ΤΜΗΜΑ ΟΔΟΝΤΙΑΤΡΙΚΗΣ ΕΡΓΑΣΤΗΡΙΟ ΟΔΟΝΤΙΚΗΣ ΚΑΙ ΑΝΩΤΕΡΑΣ ΠΡΟΣΘΕΤΙΚΗΣ

ΑΡΙΣΤΟΤΕΛΕΙΟ ΠΑΝΕΠΙΣΤΗΜΙΟ ΘΕΣΣΑΛΟΝΙΚΗΣ ΤΜΗΜΑ ΟΔΟΝΤΙΑΤΡΙΚΗΣ ΕΡΓΑΣΤΗΡΙΟ ΟΔΟΝΤΙΚΗΣ ΚΑΙ ΑΝΩΤΕΡΑΣ ΠΡΟΣΘΕΤΙΚΗΣ ΑΡΙΣΤΟΤΕΛΕΙΟ ΠΑΝΕΠΙΣΤΗΜΙΟ ΘΕΣΣΑΛΟΝΙΚΗΣ ΤΜΗΜΑ ΟΔΟΝΤΙΑΤΡΙΚΗΣ ΕΡΓΑΣΤΗΡΙΟ ΟΔΟΝΤΙΚΗΣ ΚΑΙ ΑΝΩΤΕΡΑΣ ΠΡΟΣΘΕΤΙΚΗΣ ΣΥΓΚΡΙΤΙΚΗ ΜΕΛΕΤΗ ΤΗΣ ΣΥΓΚΡΑΤΗΤΙΚΗΣ ΙΚΑΝΟΤΗΤΑΣ ΟΡΙΣΜΕΝΩΝ ΠΡΟΚΑΤΑΣΚΕΥΑΣΜΕΝΩΝ ΣΥΝΔΕΣΜΩΝ ΑΚΡΙΒΕΙΑΣ

Διαβάστε περισσότερα

Calculating the propagation delay of coaxial cable

Calculating the propagation delay of coaxial cable Your source for quality GNSS Networking Solutions and Design Services! Page 1 of 5 Calculating the propagation delay of coaxial cable The delay of a cable or velocity factor is determined by the dielectric

Διαβάστε περισσότερα

Homework 8 Model Solution Section

Homework 8 Model Solution Section MATH 004 Homework Solution Homework 8 Model Solution Section 14.5 14.6. 14.5. Use the Chain Rule to find dz where z cosx + 4y), x 5t 4, y 1 t. dz dx + dy y sinx + 4y)0t + 4) sinx + 4y) 1t ) 0t + 4t ) sinx

Διαβάστε περισσότερα

ΜΥΥ105: Εισαγωγή στον Προγραμματισμό. Αναζήτηση και Ταξινόμηση Χειμερινό Εξάμηνο 2016

ΜΥΥ105: Εισαγωγή στον Προγραμματισμό. Αναζήτηση και Ταξινόμηση Χειμερινό Εξάμηνο 2016 ΜΥΥ105: Εισαγωγή στον Προγραμματισμό Αναζήτηση και Ταξινόμηση Χειμερινό Εξάμηνο 2016 Αναζήτηση και Ταξινόμηση Βασικές λειτουργίες σε προγράμματα Αναζήτηση (searching): Βρες ένα ζητούμενο στοιχείο σε μια

Διαβάστε περισσότερα

CHAPTER 25 SOLVING EQUATIONS BY ITERATIVE METHODS

CHAPTER 25 SOLVING EQUATIONS BY ITERATIVE METHODS CHAPTER 5 SOLVING EQUATIONS BY ITERATIVE METHODS EXERCISE 104 Page 8 1. Find the positive root of the equation x + 3x 5 = 0, correct to 3 significant figures, using the method of bisection. Let f(x) =

Διαβάστε περισσότερα

ΠΛΗΡΟΦΟΡΙΚΗ Ι JAVA Τμήμα θεωρίας με Α.Μ. σε 3, 7, 8 & 9 22/11/07

ΠΛΗΡΟΦΟΡΙΚΗ Ι JAVA Τμήμα θεωρίας με Α.Μ. σε 3, 7, 8 & 9 22/11/07 Ακαδ έτος 2007-2008 ΠΛΗΡΟΦΟΡΙΚΗ Ι Φερεντίνος 22/11/07 ΠΛΗΡΟΦΟΡΙΚΗ Ι JAVA Τμήμα θεωρίας με ΑΜ σε 3, 7, 8 & 9 22/11/07 Παράδειγμα με if/else if και user input: import javautil*; public class Grades public

Διαβάστε περισσότερα

Phys460.nb Solution for the t-dependent Schrodinger s equation How did we find the solution? (not required)

Phys460.nb Solution for the t-dependent Schrodinger s equation How did we find the solution? (not required) Phys460.nb 81 ψ n (t) is still the (same) eigenstate of H But for tdependent H. The answer is NO. 5.5.5. Solution for the tdependent Schrodinger s equation If we assume that at time t 0, the electron starts

Διαβάστε περισσότερα

Matrices and Determinants

Matrices and Determinants Matrices and Determinants SUBJECTIVE PROBLEMS: Q 1. For what value of k do the following system of equations possess a non-trivial (i.e., not all zero) solution over the set of rationals Q? x + ky + 3z

Διαβάστε περισσότερα

Math 6 SL Probability Distributions Practice Test Mark Scheme

Math 6 SL Probability Distributions Practice Test Mark Scheme Math 6 SL Probability Distributions Practice Test Mark Scheme. (a) Note: Award A for vertical line to right of mean, A for shading to right of their vertical line. AA N (b) evidence of recognizing symmetry

Διαβάστε περισσότερα

Galatia SIL Keyboard Information

Galatia SIL Keyboard Information Galatia SIL Keyboard Information Keyboard ssignments The main purpose of the keyboards is to provide a wide range of keying options, so many characters can be entered in multiple ways. If you are typing

Διαβάστε περισσότερα

Συστήματα Διαχείρισης Βάσεων Δεδομένων

Συστήματα Διαχείρισης Βάσεων Δεδομένων ΕΛΛΗΝΙΚΗ ΔΗΜΟΚΡΑΤΙΑ ΠΑΝΕΠΙΣΤΗΜΙΟ ΚΡΗΤΗΣ Συστήματα Διαχείρισης Βάσεων Δεδομένων Φροντιστήριο 5: Tutorial on External Sorting Δημήτρης Πλεξουσάκης Τμήμα Επιστήμης Υπολογιστών TUTORIAL ON EXTERNAL SORTING

Διαβάστε περισσότερα

SCHOOL OF MATHEMATICAL SCIENCES G11LMA Linear Mathematics Examination Solutions

SCHOOL OF MATHEMATICAL SCIENCES G11LMA Linear Mathematics Examination Solutions SCHOOL OF MATHEMATICAL SCIENCES GLMA Linear Mathematics 00- Examination Solutions. (a) i. ( + 5i)( i) = (6 + 5) + (5 )i = + i. Real part is, imaginary part is. (b) ii. + 5i i ( + 5i)( + i) = ( i)( + i)

Διαβάστε περισσότερα

Εισαγωγή στη γλώσσα προγραμματισμού JAVA. Δομές Δεδομένων Διδάσκων: Π.Α. Μήτκας Τομέας Ηλεκτρονικής και Υπολογιστών

Εισαγωγή στη γλώσσα προγραμματισμού JAVA. Δομές Δεδομένων Διδάσκων: Π.Α. Μήτκας Τομέας Ηλεκτρονικής και Υπολογιστών Εισαγωγή στη γλώσσα προγραμματισμού JAVA Δομές Δεδομένων Διδάσκων: Π.Α. Μήτκας Τομέας Ηλεκτρονικής και Υπολογιστών Το πρώτο φλιτζάνι Java Λίστα με τα απαραίτητα Το πρώτο μου πρόγραμμα(hello World) Συνεχίζοντας

Διαβάστε περισσότερα

Πολλές φορές έχουμε πολλές μεταβλητές του ίδιου τύπου που συσχετίζονται και θέλουμε να τις βάλουμε μαζί.

Πολλές φορές έχουμε πολλές μεταβλητές του ίδιου τύπου που συσχετίζονται και θέλουμε να τις βάλουμε μαζί. ΠΙΝΑΚΕΣ Πίνακες Πολλές φορές έχουμε πολλές μεταβλητές του ίδιου τύπου που συσχετίζονται και θέλουμε να τις βάλουμε μαζί. Τα ονόματα των φοιτητών σε μία τάξη Οι βαθμοί ενός φοιτητή για όλα τα εργαστήρια.

Διαβάστε περισσότερα

Οδηγίες Αγοράς Ηλεκτρονικού Βιβλίου Instructions for Buying an ebook

Οδηγίες Αγοράς Ηλεκτρονικού Βιβλίου Instructions for Buying an ebook Οδηγίες Αγοράς Ηλεκτρονικού Βιβλίου Instructions for Buying an ebook Βήμα 1: Step 1: Βρείτε το βιβλίο που θα θέλατε να αγοράσετε και πατήστε Add to Cart, για να το προσθέσετε στο καλάθι σας. Αυτόματα θα

Διαβάστε περισσότερα

ΤΕΧΝΙΚΕΣ ΑΝΤΙΚΕΙΜΕΝΟΣΤΡΑΦΟΥΣ ΠΡΟΓΡΑΜΜΑΤΙΣΜΟΥ. Εισαγωγή στη Java II

ΤΕΧΝΙΚΕΣ ΑΝΤΙΚΕΙΜΕΝΟΣΤΡΑΦΟΥΣ ΠΡΟΓΡΑΜΜΑΤΙΣΜΟΥ. Εισαγωγή στη Java II ΤΕΧΝΙΚΕΣ ΑΝΤΙΚΕΙΜΕΝΟΣΤΡΑΦΟΥΣ ΠΡΟΓΡΑΜΜΑΤΙΣΜΟΥ Εισαγωγή στη Java II Strings Η κλάση String είναι προκαθορισμένη κλάση της Java που μας επιτρέπει να χειριζόμαστε αλφαριθμητικά. Ο τελεστής + μας επιτρέπει

Διαβάστε περισσότερα

Μηχανική Μάθηση Hypothesis Testing

Μηχανική Μάθηση Hypothesis Testing ΕΛΛΗΝΙΚΗ ΔΗΜΟΚΡΑΤΙΑ ΠΑΝΕΠΙΣΤΗΜΙΟ ΚΡΗΤΗΣ Μηχανική Μάθηση Hypothesis Testing Γιώργος Μπορμπουδάκης Τμήμα Επιστήμης Υπολογιστών Procedure 1. Form the null (H 0 ) and alternative (H 1 ) hypothesis 2. Consider

Διαβάστε περισσότερα

ΤΕΧΝΙΚΕΣ ΑΝΤΙΚΕΙΜΕΝΟΣΤΡΑΦΟΥΣ ΠΡΟΓΡΑΜΜΑΤΙΣΜΟΥ. Εισαγωγή στη Java

ΤΕΧΝΙΚΕΣ ΑΝΤΙΚΕΙΜΕΝΟΣΤΡΑΦΟΥΣ ΠΡΟΓΡΑΜΜΑΤΙΣΜΟΥ. Εισαγωγή στη Java ΤΕΧΝΙΚΕΣ ΑΝΤΙΚΕΙΜΕΝΟΣΤΡΑΦΟΥΣ ΠΡΟΓΡΑΜΜΑΤΙΣΜΟΥ Εισαγωγή στη Java Είσοδος Χρησιμοποιούμε την κλάση Scanner της Java import java.util.scanner; Αρχικοποιείται με το ρεύμα εισόδου: Scanner in = new Scanner(System.in);

Διαβάστε περισσότερα

HY150a Φροντιστήριο 3 24/11/2017

HY150a Φροντιστήριο 3 24/11/2017 HY150a Φροντιστήριο 3 24/11/2017 1 Assignment 3 Overview Το πρόγραμμα ζητείται να διαβάζει μια λίστα δεδομένων που περιγράφει τα διαθέσιμα τμήματα μνήμης (blocks) ενός ΗΥ. Το πρόγραμμα ζητείται να μεταφορτώνει

Διαβάστε περισσότερα

Areas and Lengths in Polar Coordinates

Areas and Lengths in Polar Coordinates Kiryl Tsishchanka Areas and Lengths in Polar Coordinates In this section we develop the formula for the area of a region whose boundary is given by a polar equation. We need to use the formula for the

Διαβάστε περισσότερα

Solutions to Exercise Sheet 5

Solutions to Exercise Sheet 5 Solutions to Eercise Sheet 5 jacques@ucsd.edu. Let X and Y be random variables with joint pdf f(, y) = 3y( + y) where and y. Determine each of the following probabilities. Solutions. a. P (X ). b. P (X

Διαβάστε περισσότερα

ΤΕΧΝΙΚΕΣ ΑΝΤΙΚΕΙΜΕΝΟΣΤΡΑΦΟΥΣ ΠΡΟΓΡΑΜΜΑΤΙΣΜΟΥ. Εισαγωγή στη Java

ΤΕΧΝΙΚΕΣ ΑΝΤΙΚΕΙΜΕΝΟΣΤΡΑΦΟΥΣ ΠΡΟΓΡΑΜΜΑΤΙΣΜΟΥ. Εισαγωγή στη Java ΤΕΧΝΙΚΕΣ ΑΝΤΙΚΕΙΜΕΝΟΣΤΡΑΦΟΥΣ ΠΡΟΓΡΑΜΜΑΤΙΣΜΟΥ Εισαγωγή στη Java Βρόγχοι Το if-then Statement Στην Java το if-then statement έχει το εξής συντακτικό Η παρένθεση είναι απαραίτητη if (condition) if-code block

Διαβάστε περισσότερα

Every set of first-order formulas is equivalent to an independent set

Every set of first-order formulas is equivalent to an independent set Every set of first-order formulas is equivalent to an independent set May 6, 2008 Abstract A set of first-order formulas, whatever the cardinality of the set of symbols, is equivalent to an independent

Διαβάστε περισσότερα

Finite Field Problems: Solutions

Finite Field Problems: Solutions Finite Field Problems: Solutions 1. Let f = x 2 +1 Z 11 [x] and let F = Z 11 [x]/(f), a field. Let Solution: F =11 2 = 121, so F = 121 1 = 120. The possible orders are the divisors of 120. Solution: The

Διαβάστε περισσότερα

Econ 2110: Fall 2008 Suggested Solutions to Problem Set 8 questions or comments to Dan Fetter 1

Econ 2110: Fall 2008 Suggested Solutions to Problem Set 8  questions or comments to Dan Fetter 1 Eon : Fall 8 Suggested Solutions to Problem Set 8 Email questions or omments to Dan Fetter Problem. Let X be a salar with density f(x, θ) (θx + θ) [ x ] with θ. (a) Find the most powerful level α test

Διαβάστε περισσότερα

ΤΕΧΝΙΚΕΣ ΑΝΤΙΚΕΙΜΕΝΟΣΤΡΑΦΟΥΣ ΠΡΟΓΡΑΜΜΑΤΙΣΜΟΥ. Εισαγωγή στη Java III

ΤΕΧΝΙΚΕΣ ΑΝΤΙΚΕΙΜΕΝΟΣΤΡΑΦΟΥΣ ΠΡΟΓΡΑΜΜΑΤΙΣΜΟΥ. Εισαγωγή στη Java III ΤΕΧΝΙΚΕΣ ΑΝΤΙΚΕΙΜΕΝΟΣΤΡΑΦΟΥΣ ΠΡΟΓΡΑΜΜΑΤΙΣΜΟΥ Εισαγωγή στη Java III Ισότητα Strings class StringTest public static void main(string args[]) String x1 = "java"; String y1 = "java"; System.out.println("1.

Διαβάστε περισσότερα

ΠΛΗΡΟΦΟΡΙΚΗ Ι JAVA Τμήμα θεωρίας με Α.Μ. σε 3, 7, 8 & 9 25/10/07

ΠΛΗΡΟΦΟΡΙΚΗ Ι JAVA Τμήμα θεωρίας με Α.Μ. σε 3, 7, 8 & 9 25/10/07 ΠΛΗΡΟΦΟΡΙΚΗ Ι JAVA Τμήμα θεωρίας με Α.Μ. σε 3, 7, 8 & 9 25/10/07 Αριθμητική στο δυαδικό σύστημα (γενικά) Συμπληρωματικά για δυαδικό σύστημα Η πρόσθεση στηρίζεται στους κανόνες: 0 + 0 = 0, 0 + 1 = 1, 1

Διαβάστε περισσότερα

Προγραμματισμός Η/Υ. Ενότητα 8: Ειδικά Θέματα Αλγορίθμων

Προγραμματισμός Η/Υ. Ενότητα 8: Ειδικά Θέματα Αλγορίθμων Προγραμματισμός Η/Υ Ενότητα 8: Ειδικά Θέματα Αλγορίθμων Νίκος Καρακαπιλίδης, Καθηγητής Δημήτρης Σαραβάνος, Καθηγητής Πολυτεχνική Σχολή Τμήμα Μηχανολόγων & Αεροναυπηγών Μηχανικών Σκοποί ενότητας Κατανόηση

Διαβάστε περισσότερα