namespace CreatingMethods
static void nhap_n(out int [] a, ref int n)
Console.Write("Nhap vao so luong phan tu cua mang: ");
n = int.Parse(Console.ReadLine());
} while (n > 50000 || n < 1);
Random rd = new Random();
for (int i = 0; i < a.Length; i++)
static void PrintArray(int[] a)
Console.WriteLine("Cac phan tu cua mang:");
for (int i = 0; i < a.Length; i++)
Console.Write(" {0} ", a[i]);
static void swap(ref int a, ref int b)
static void bubblesort(int[] a)
for (int i = 0; i < a.Length - 1; i++)
for (int j = 0; j < a.Length - i - 1; j++)
swap(ref a[j], ref a[j + 1]);
static void intercahnge_sort(int[] a)
for (int i = 0; i < a.Length - 1; i++)
for (int j = i + 1; j < a.Length; j++)
swap(ref a[i], ref a[j]);
static void Main(string[] args)
Console.WriteLine(" Phan tu cua mang sau khi dung bubble sort sap xep: ");
for (int i = 0; i < a.Length; i++)
Console.Write($" {a[i]}");
Console.WriteLine(" Phan tu cua mang sau khi interchange sort sap xep: ");
for (int i = 0; i < a.Length; i++)
Console.Write($" {a[i]}");