Skip to content

Instantly share code, notes, and snippets.

View maycuatroi1's full-sized avatar

Nguyễn Anh Bình maycuatroi1

View GitHub Profile
public class RadixSort {
public static void radixSort(int[] arr) {
if (arr.length == 0) {
return;
}
// Find the maximum number to know number of digits
int max = getMax(arr);
import java.util.ArrayList;
import java.util.Collections;
public class BucketSort {
public static void bucketSort(int[] arr) {
if (arr.length == 0) {
return;
}
public class HeapSort {
public static void heapSort(int[] arr) {
int n = arr.length;
// Build max heap (rearrange array)
for (int i = n / 2 - 1; i >= 0; i--) {
heapify(arr, n, i);
}
public class BubbleSort {
public static void bubbleSort(int[] arr) {
int n = arr.length;
boolean swapped;
for (int i = 0; i < n - 1; i++) {
swapped = false;
for (int j = 0; j < n - i - 1; j++) {
// https://www.youtube.com/watch?v=WYrMGRJ9qFE
public class MergeSort {
// Gộp 2 mảng con đã được sắp xếp
public static void merge(int[] arr, int left, int mid, int right) {
// tính kích thước 2 mảng con
int n1 = mid - left + 1; // Array trái
int n2 = right - mid; // Array phải
// Tạo mảng tạm
public class MergeSort {
// Gộp 2 mảng con đã được sắp xếp
public static void merge(int[] arr, int left, int mid, int right) {
// tính kích thước 2 mảng con
int n1 = mid - left + 1; // Array trái
int n2 = right - mid; // Array phải
// Tạo mảng tạm
int[] L = new int[n1];
int[] R = new int[n2];
// https://www.youtube.com/watch?v=uf_DyA_Ku7A
public class QuickSort {
// Helper method để hoán đổi hai phần tử
private static void swap(int[] arr, int i, int j) {
int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
public class InsertionSort {
private static int[] insertionSort(int[] arr) {
int n = arr.length;
for (int i = 1; i < n; i++) {
int key = arr[i];
int j = i - 1;
while (j >= 0 && arr[j] > key) {
arr[j + 1] = arr[j];
j--;
public class SelectionSort{
public static int[] selectionSort(int[] arr) {
int n = arr.length;
for (int i = 0; i < n - 1; i++) {
int minIndex = i;
for (int j = i + 1; j < n; j++) {
if (arr[j] < arr[minIndex]) {
minIndex = j;
}
// Comprehensive malware analysis script
const fs = require('fs');
console.log('=== VIRUS.JS MALWARE ANALYSIS ===\n');
// Read the file
const code = fs.readFileSync('virus.js', 'utf8');
// Analysis results
const analysis = {