-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSortingAlgorithmsDemo.java
More file actions
32 lines (23 loc) · 896 Bytes
/
Copy pathSortingAlgorithmsDemo.java
File metadata and controls
32 lines (23 loc) · 896 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import java.util.ArrayList;
public class SortingAlgorithmsDemo {
public static void main(String[] args) {
ArrayList<Integer> input = new ArrayList<>();
input.add(8);
input.add(1);
input.add(23);
input.add(7);
input.add(55);
input.add(-1);
input.add(88);
Context bubbleContext = new Context(new BubbleSort());
bubbleContext.executeStrategy(input);
Context selectionContext = new Context(new SelectionSort());
selectionContext.executeStrategy(input);
Context insertionContext = new Context(new InsertionSort());
insertionContext.executeStrategy(input);
Context mergeContext = new Context(new MergeSort());
mergeContext.executeStrategy(input);
Context quickContext = new Context(new QuickSort());
quickContext.executeStrategy(input);
}
}