Sie sind auf Seite 1von 2

A quick sort works as follows: The algorithm selects an The merge sort algorithm can be described recursively as

element, called the pivot, in the array. It divides the follows: The algorithm divides the array into two halves and
array into two parts, so that all the elements in the first applies a merge sort on each half recursively.
part are less than or equal to the pivot and all the After the two halves are sorted, merge them.
elements in the second part are greater than the pivot.
The quick sort algorithm is then recursively applied to
the first part and then the second part import static org.junit.Assert.*;
import org.junit.Test;
public class Test_Person {
Bubble sort: swaps neighbouring elements if they are @Test
not in order public void testPerson() {
Person person1 = new Person();
Insertion sort: The insertion-sort algorithm sorts a list assertTrue(person1 != null);
of values by repeatedly inserting a new }
element into a sorted sublist until the whole list is @Test
sorted public void testPerson2(){
Person person2 = new Person("joe",22,
"oxford");
assertEquals("joe", person2.getName());
}
@Test
public void testPerson3(){
Person person3 = new Person("joe",22,
"oxford");
assertEquals("oxford",
person3.getHomeTown());
}
@Test
public void testPerson4(){
Person person4 = new Person("joe", 22 ,
"oxford");
assertEquals(22, person4.getAge());
}
@Test
public void testPerson5(){
Person person5 = new Person();
person5.setName("joe");
assertEquals("joe", person5.getName());
}
@Test
public void testPerson6(){
Person person6 = new Person();
person6.setHomeTown("oxford");
assertEquals("oxford",
person6.getHomeTown());
}
@Test
public void testPerson7(){
Person person7 = new Person();
person7.setAge(22);
assertEquals(22, person7.getAge());
}

}
Javafx Eventhandler<T extends Event> -
Jafx extends javafx.application.application implements source.setOnAction(handler)
start Event is an object created from source event
Bind is defined in property interface Root class of event java.util.EventObject
Abstract node defines many properties common to all
nodes Root class of javafx event class- javafx.event.event
Panes-basic class for layout panes
Lambda expression simplify event hand. Coding
Stackpane: on top of each other at center
Flow pane: row by row horizontally or column by col. Vert. Mouse event, Key Event, Node interaction
Grid pane: Two dimensional grid(column x row)
Bordor pane: top, right, botton, left and center Abstract class animation for animations
Hbox: on single row vbox: on single column Functional interface has only 1 abstract method(SAM)
Node>shape>(text,line,shapes)
Line(startx,starty,endx,endy)
Recursion: method that invokes itself
Basecase, subproblem, recursive call
Abstract class label is base class for label,Butoon, checkbox & public class RecursiveSelectionSort {
radiobutton 2 public static void sort(double[] list) {
3 sort(list, 0, list.length - 1); // Sort the entire list
Label: Display area for short text, node
4}
Checkbox- isSelected() method
6 private static void sort(double[] list, int low, int high) {
Radiobutton subclass of togglebutton 7 if (low < high) {
Textfield subclass of TextInputControl int indexOfMin = low;
Text field (enter/display a string) double min = list[low];
Text area (enter/display multiple lines of text) for (int i = low + 1; i <= high; i++) {
Combox aka choicelist/dropdown is generic <T> if (list[i] < min) {
Listview Is like combobox but allows user to select single or min = list[i];
multiple values, also generic<T> indexOfMin = i;
Scrollbar enables user to select from range of values }
Slider similar to scrollbar but has more properties/forms }
Mediaclass: obtain source of media list[indexOfMin] = list[low];
mediaView: to view media list[low] = min;
sort(list, low + 1, high);
}
public static long factorial(int n) { }
if (n == 0) // Base case }
return 1; public class RecursiveBinarySearch {
else 2 public static int recursiveBinarySearch(int[] list, int key)
return n * factorial(n - 1); // Recursive call {
} 3 int low = 0;
} 4 int high = list.length - 1;
if (index == 0) 5 return recursiveBinarySearch(list, key, low, high);
return 0; 6}
else if (index == 1) 7
return 1; 8 private static int recursiveBinarySearch(int[] list, int
else key,
return fib(index - 1) + fib(index - 2); 9 int low, int high) {
10 if (low > high) // The list has been exhausted without a
match
public abstract class Field<T> { 11 return -low - 1;
private T value; 12
// + constructor(s) 13 int mid = (low + high) / 2;
public T get() { 14 if (key < list[mid])
return value; 15 return recursiveBinarySearch(list, key, low, mid - 1);
} 16 else if (key == list[mid])
public void set(T value) { 17 return mid;
this.value = value; 18 else
19 return recursiveBinarySearch(list, key, mid + 1, high);
}
20 }
}
21 }
You cannot create an instance using a generic type parameter.
You cannot create an array using a generic type parameter.
You cannot use a generic type parameter of a class in a static
context.
Generic type parameters cannot be used in exception classes

Das könnte Ihnen auch gefallen