Add all 23 GoF design pattern implementations

This commit is contained in:
2026-07-25 10:50:29 +05:30
commit f5688a6b32
164 changed files with 4371 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
package strategy;
public class BubbleSort implements SortStrategy {
@Override
public void sort(int[] data) {
System.out.println(" [BubbleSort] O(n²) — small arrays only");
for (int i = 0; i < data.length - 1; i++)
for (int j = 0; j < data.length - 1 - i; j++)
if (data[j] > data[j + 1]) { int t = data[j]; data[j] = data[j+1]; data[j+1] = t; }
}
@Override public String getName() { return "BubbleSort"; }
}