Tài liệu ôn thi tổng hợp | Đại học Ngoại Ngữ - Tin Học thành phố Hồ Chí Minh

Tài liệu ôn thi tổng hợp | Đại học Ngoại Ngữ - Tin Học thành phố Hồ Chí Minh được sưu tầm và soạn thảo dưới dạng file PDF để gửi tới các bạn sinh viên cùng tham khảo, ôn tập đầy đủ kiến thức, chuẩn bị cho các buổi học thật tốt. Mời bạn đọc đón xem

Sinh viên
using CTDLGT_BT1;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace BT1_CTDLGT
{
internal class MangSinhVien
{
List<SinhVien> ListSinhVien = ;private null
public MangSinhVien()
{
ListSinhVien = List<SinhVien>();new
}
Nhap ()public void
{
SinhVien sv = SinhVien();new
do
{
sv.Nhap();
(KTMaSoSinhVien(sv.GetMaSo(), sv) == )if true
{
Console.WriteLine("Vui long nhap lai vi ma so sinh vien trung lap !");
Console.WriteLine();
}
} (KTMaSoSinhVien(sv.GetMaSo(), sv) == while true);
sv.XepLoai();
ListSinhVien.Add(sv);
Console.WriteLine();
}
KTMaSoSinhVien( ms, SinhVien sv)public bool string
{
(SinhVien a ListSinhVien)foreach in
{
if(a.GetMaSo()==ms)
{
;return true
}
}
;return false
}
SoLuongSinhVien()public int
{
Count = 0;int
(ListSinhVien != )if null
{
Count = ListSinhVien.Count;
}
Count;return
}
Xuat(List<SinhVien> listSV)public void
{
(listSV != && listSV.Count > 0)if null
{
(SinhVien sv listSV)foreach in
{
sv.XepLoai();
sv.Xuat();
Console.WriteLine();
}
}
}
List<SinhVien> getListSinhVien()public
{
ListSinhVien;return
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Security.Permissions;
using System.Text;
using System.Threading.Tasks;
namespace CTDLGT_BT1
{
class SinhVien
{
maSo;private string
hoTen;private string
chuyenNganh;private string
namSinh;private int
diemTB;private float
loai;private string
() { }public SinhVien
maSo, hoTen, chuyenNganh, namSinh, diemTB)public SinhVien(string string string int float
{
.maSo = maSo;this
.hoTen = hoTen;this
.chuyenNganh = chuyenNganh;this
.namSinh = namSinh;this
.diemTB = diemTB;this
}
(SinhVien sv) { }public SinhVien
SetMaSo( ms)public void string
{
.maSo = ms;this
}
GetMaSo()public string
{
return this.maSo;
}
SetHoTen( ht)public void string
{
.hoTen = ht;this
}
GetHoTen()public string
{
return this.hoTen;
}
SetChuyenNganh( cn)public void string
{
.chuyenNganh = cn;this
}
GetchuyenNganh()public string
{
return this.chuyenNganh;
}
SetNamSinh( ns)public void int
{
.namSinh = ns;this
}
GetNamSinh()public int
{
return this.namSinh;
}
SetDiemTB( dtb)public void float
{
.diemTB = dtb;this
}
GetDiemTB()public float
{
return this.diemTB;
}
SetLoai( l)public void string
{
.loai = l;this
}
GetLoai()public string
{
return this.loai;
}
XepLoai()public void
{
(diemTB < 5)if
{
loai = ;"kem"
}
else if(diemTB>=5&&diemTB<7)
{
loai = ;"Trung binh"
}
else if(diemTB>=7&&diemTB<8)
{
loai = ;"Kha"
}
else
{
loai = ;"Gioi"
}
}
Nhap()public void
{
Console.Write("Ma so: ");
.maSo = Console.ReadLine();this
Console.Write("Ho ten: ");
.hoTen = Console.ReadLine();this
Console.Write("Chuyen Nganh: ");
.chuyenNganh= Console.ReadLine();this
Console.Write("Nam sinh: ");
.namSinh = this int.Parse(Console.ReadLine());
)if this true(KiemTraNamSinh( .namSinh)==
{
Console.WriteLine("Nam sinh: true");
}
else
{
Console.WriteLine("Nam sinh: false");
}
Console.Write("Diem trung binh: ");
this float.diemTB= .Parse(Console.ReadLine());
(KiemTraDiemTB(diemTB)== )if true
{
Console.WriteLine("diem tb: true");
}
else
{
Console.WriteLine("diem tb: false");
}
}
Xuat()public void
{
Console.Write(" | Ma so: "+maSo);
Console.Write(" | Ho ten: "+hoTen);
Console.Write(" | Chuyen Nganh: "+chuyenNganh);
Console.Write(" | Nam sinh: "+namSinh);
Console.Write(" | Diem trung binh: "+diemTB);
Console.Write(" | Loai: "+loai);
}
KiemTraNamSinh( ns)public bool int
{
if(DateTime.Now.Year-ns<17||DateTime.Now.Year-ns>70)
{
;return false
}
;return true
}
KiemTraDiemTB( dtb)public bool float
{
if(dtb>10||diemTB<0)
{
;return false
}
;return true
}
}
}
using CTDLGT_BT1;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace BT1_CTDLGT
{
internal class Program
{
TestSinhVien()static void
{
SinhVien svA= SinhVien();new
svA.Nhap();
Console.WriteLine("Thong tin sinh vien A:");
svA.XepLoai();
svA.Xuat();
SinhVien svB = SinhVien( , , , 2000, 7F);new "18DH001" "Lam Thanh Ngoc" "CNPM"
}
TestMangSinhVien()static void
{
MangSinhVien dssv = MangSinhVien();new
dssv.Nhap();
Console.WriteLine("Danh sach sinh vien");
dssv.Xuat(dssv.getListSinhVien());
}
Main( [] args)static void string
{
MangSinhVien dssv = MangSinhVien();new
Console.Write("Nhap so luong sinh vien muon them vao danh sach: ");
sl = int int.Parse(Console.ReadLine());
i=1;i<=sl;i++)for int(
{
Console.WriteLine("sinh vien thu {0}:",i);
dssv.Nhap();
}
Console.WriteLine("\nDanh sach sinh vien: ");
dssv.Xuat(dssv.getListSinhVien());
Console.ReadKey();
}
}
}
Bài int array
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace CTDLGT_BT2
{
internal class IntArray
{
[] arr;private int
SetArr( [] a)public void int
{
.arr = a;this
}
[] GetArr()public int
{
return this.arr;
}
index]public int this int[
{
=> arr[index] = value;set
=> arr[index];get
}
() { }public IntArray
k)public IntArray(int
{
arr = new int[k];
Random r = Random();new
( i = 0; i < k; i++)for int
{
arr[i] = r.Next(1, 200);
}
}
[] a)public IntArray(int
{
.arr = this new int[a.Length];
( i = 0; i < a.Length; i++)for int
{
.arr[i] = a[i];this
}
}
(IntArray obj)public IntArray
{
.arr = this new int[obj.arr.Length];
( i = 0; i < obj.arr.Length; i++)for int
{
.arr[i] = obj.arr[i];this
}
}
KiemTraKT( n)public bool int
{
(n > 0 && n <= 200)if
{
;return true
}
;return false
}
Nhap()public void
{
( i = 0; i < arr.Length; i++)for int
{
Console.Write($"a[{i}]= ");
arr[i] = int.Parse(Console.ReadLine());
}
}
Xuat()public void
{
( i = 0; i < arr.Length; i++)for int
{
Console.Write(arr[i] + " ");
}
Console.WriteLine();
}
TimTuanTu( x)public int int
{
( i = 0; i < arr.Length; i++)for int
{
(arr[i] == x)if
{
i;return
}
}
-1;return
}
TimNhiPhan( x)public int int
{
l = 0;int
r = arr.Length - 1;int
(l <= r)while
{
m = (l + r) / 2;int
(arr[m] == x)if
{
m;return
}
(x > arr[m])else if
{
l = m + 1;
}
else
{
r = m - 1;
}
}
Console.WriteLine("Khong xuat hien !");
-1;return
}
Swap( a, b)public void ref int ref int
{
tam = a;int
a = b;
b = tam;
}
InterchangeSort()public void
{
( i = 0; i < arr.Length - 1; i++)for int
{
( j = i + 1; j < arr.Length; j++)for int
{
(arr[i] > arr[j])if
{
Swap( arr[i], arr[j]);ref ref
}
}
}
}
BubbleSort()public void
{
( i = 0; i < arr.Length - 1; i++)for int
{
( j = 0; j < arr.Length - 1 - i; j++)for int
{
(arr[j] > arr[j + 1])if
{
Swap( arr[j], arr[j + 1]);ref ref
}
}
}
}
SelectionSort()public void
{
( i = 0; i < arr.Length - 1; i++)for int
{
min = i;int
( j = i + 1; j < arr.Length; j++)for int
{
(arr[j] < arr[min])if
{
min = j;
}
}
Swap( arr[i], arr[min]);ref ref
}
}
InsertionSort()public void
{
n = arr.Length;int
( i = 1; i < n; ++i)for int
{
key = arr[i];int
j = i - 1;int
(j >= 0 && arr[j] > key)while
{
arr[j + 1] = arr[j];
j = j - 1;
}
arr[j + 1] = key;
}
}
QuickSort( left, right)public void int int
{
(left < right)if
{
pivot = Partition(left, right);int
(pivot > 1)if
{
QuickSort(left, pivot - 1);
}
(pivot + 1 < right)if
{
QuickSort(pivot + 1, right);
}
}
}
Partition( left, right)private int int int
{
pivot = arr[left];int
( )while true
{
(arr[left] < pivot)while
{
left++;
}
(arr[right] > pivot)while
{
right--;
}
(left < right)if
{
(arr[left] == arr[right]) right;if return
temp = arr[left];int
arr[left] = arr[right];
arr[right] = temp;
}
else
{
right;return
}
}
}
ShellSort()public void
{
i, j, pos, temp;int
pos = 3;
(pos > 0)while
{
(i = 0; i <arr.Length; i++)for
{
j = i;
temp =arr[i];
((j >= pos) && (arr[j - pos] > temp))while
{
arr[j] = arr[j - pos];
j = j - pos;
}
arr[j] = temp;
}
(pos / 2 != 0)if
pos = pos / 2;
(pos == 1)else if
pos = 0;
else
pos = 1;
}
}
ShakerSort()public void
{
l = 0;int
r = arr.Length - 1;int
k = 0;int
(l < r)while
{
( i = l; i < r; i++)for int
{
(arr[i] > arr[i + 1])if
{
Swap( arr[i], arr[i + 1]);ref ref
k = i;
}
}
r = k;
( i = r; i > l; i--)for int
{
(arr[i] < arr[i - 1])if
{
Swap( arr[i], arr[i - 1]);ref ref
k = i;
}
}
l = k;
}
}
[] MergeSort(public int int[]arr)
{
[] left;int
[] right;int
[] result = int new int[arr.Length];
(arr.Length <= 1)if
arr;return
midPoint = arr.Length / 2;int
left = new int[midPoint];
(arr.Length % 2 == 0)if
right = new int[midPoint];
else
right = [midPoint + 1];new int
( i = 0; i < midPoint; i++)for int
left[i] = arr[i];
x = 0;int
( i = midPoint; i < arr.Length; i++)for int
{
right[x] = arr[i];
x++;
}
left = MergeSort(left);
right = MergeSort(right);
result = Merge(left, right);
result;return
}
[] Merge( [] left, [] right)private int int int
{
resultLength = right.Length + left.Length;int
[] result = int new int[resultLength];
//
indexLeft = 0, indexRight = 0, indexResult = 0;int
(indexLeft < left.Length || indexRight < right.Length)while
{
(indexLeft < left.Length && indexRight < right.Length)if
{
(left[indexLeft] <= right[indexRight])if
{
result[indexResult] = left[indexLeft];
indexLeft++;
indexResult++;
}
else
{
result[indexResult] = right[indexRight];
indexRight++;
indexResult++;
}
}
(indexLeft < left.Length)else if
{
result[indexResult] = left[indexLeft];
indexLeft++;
indexResult++;
}
(indexRight < right.Length)else if
{
result[indexResult] = right[indexRight];
indexRight++;
indexResult++;
}
}
result;return
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CTDLGT_BT2
{
internal class Program
{
Main( [] args)static void string
{
//interchang sort
Console.OutputEncoding = Encoding.Unicode;
Console.WriteLine("Mảng chưa được xắp xếp");
IntArray a = IntArray(7);new
a.Xuat();
a.InterchangeSort();
Console.WriteLine("Mảng sau khi được xắp xếp bằng Interchange Sort: ");
a.Xuat();
Console.WriteLine();
//bubble sort
Console.WriteLine( ); ;"Mảng chưa được xắp xếp"
IntArray b = IntArray(7);new
b.Xuat();
b.BubbleSort();
Console.WriteLine("Mảng sau khi được xắp xếp bằng Bubble Sort: ");
b.Xuat();
Console.WriteLine();
//selection sort
Console.WriteLine("Mảng chưa được xắp xếp");
IntArray c = IntArray(7);new
c.Xuat();
c.SelectionSort();
Console.WriteLine("Mảng sau khi được xắp xếp bằng Seclection Sort: ");
c.Xuat();
Console.WriteLine();
//Isertion sort
Console.WriteLine("Mảng chưa được xắp xếp");
IntArray d = IntArray(7);new
d.Xuat();
| 1/34

Preview text:

Sinh viên using CTDLGT_BT1; using System;
using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; namespace BT1_CTDLGT { internal class MangSinhVien {
private List ListSinhVien = null; public MangSinhVien() { ListSinhVien = new List(); } public void Nhap () { SinhVien sv = new SinhVien(); do { sv.Nhap();
if (KTMaSoSinhVien(sv.GetMaSo(), sv) == true) {
Console.WriteLine("Vui long nhap lai vi ma so sinh vien trung lap !"); Console.WriteLine(); }
} while (KTMaSoSinhVien(sv.GetMaSo(), sv) == true); sv.XepLoai(); ListSinhVien.Add(sv); Console.WriteLine(); }
public bool KTMaSoSinhVien(string ms, SinhVien sv) {
foreach(SinhVien a in ListSinhVien) { if(a.GetMaSo()==ms) { return true; } } return false; } public int SoLuongSinhVien() { int Count = 0; if (ListSinhVien != null) { Count = ListSinhVien.Count; } return Count; } public void Xuat(List listSV) {
if (listSV != null && listSV.Count > 0) {
foreach (SinhVien sv in listSV) { sv.XepLoai(); sv.Xuat(); Console.WriteLine(); } } } public List getListSinhVien() { return ListSinhVien; } } } using System;
using System.Collections.Generic; using System.Linq;
using System.Runtime.CompilerServices;
using System.Security.Permissions; using System.Text; using System.Threading.Tasks; namespace CTDLGT_BT1 { class SinhVien { private string maSo; private string hoTen; private string chuyenNganh; private int namSinh; private float diemTB; private string loai; public SinhVien() { }
public SinhVien(string maSo, string hoTen, string chuyenNganh, int namSinh, float diemTB) { this.maSo = maSo; this.hoTen = hoTen;
this.chuyenNganh = chuyenNganh; this.namSinh = namSinh; this.diemTB = diemTB; }
public SinhVien(SinhVien sv) { }
public void SetMaSo(string ms) { this.maSo = ms; } public string GetMaSo() { return this.maSo; }
public void SetHoTen(string ht) { this.hoTen = ht; } public string GetHoTen() { return this.hoTen; }
public void SetChuyenNganh(string cn) { this.chuyenNganh = cn; }
public string GetchuyenNganh() { return this.chuyenNganh; }
public void SetNamSinh(int ns) { this.namSinh = ns; } public int GetNamSinh() { return this.namSinh; }
public void SetDiemTB(float dtb) { this.diemTB = dtb; } public float GetDiemTB() { return this.diemTB; } public void SetLoai(string l) { this.loai = l; } public string GetLoai() { return this.loai; } public void XepLoai() { if (diemTB < 5) { loai = "kem"; }
else if(diemTB>=5&&diemTB<7) { loai = "Trung binh"; }
else if(diemTB>=7&&diemTB<8) { loai = "Kha"; } else { loai = "Gioi"; } } public void Nhap() { Console.Write("Ma so: ");
this.maSo = Console.ReadLine(); Console.Write("Ho ten: ");
this.hoTen = Console.ReadLine();
Console.Write("Chuyen Nganh: ");
this.chuyenNganh= Console.ReadLine(); Console.Write("Nam sinh: ");
this.namSinh = int.Parse(Console.ReadLine());
if(KiemTraNamSinh(this.namSinh)==true) {
Console.WriteLine("Nam sinh: true"); } else {
Console.WriteLine("Nam sinh: false"); }
Console.Write("Diem trung binh: ");
this.diemTB=float.Parse(Console.ReadLine());
if (KiemTraDiemTB(diemTB)==true) {
Console.WriteLine("diem tb: true"); } else {
Console.WriteLine("diem tb: false"); } } public void Xuat() {
Console.Write(" | Ma so: "+maSo);
Console.Write(" | Ho ten: "+hoTen);
Console.Write(" | Chuyen Nganh: "+chuyenNganh);
Console.Write(" | Nam sinh: "+namSinh);
Console.Write(" | Diem trung binh: "+diemTB);
Console.Write(" | Loai: "+loai); }
public bool KiemTraNamSinh(int ns) {
if(DateTime.Now.Year-ns<17||DateTime.Now.Year-ns>70) { return false; } return true; }
public bool KiemTraDiemTB(float dtb) { if(dtb>10||diemTB<0) { return false; } return true; } } } using CTDLGT_BT1; using System;
using System.Collections.Generic; using System.Linq;
using System.Security.Cryptography; using System.Text; using System.Threading.Tasks; namespace BT1_CTDLGT { internal class Program { static void TestSinhVien() { SinhVien svA=new SinhVien(); svA.Nhap();
Console.WriteLine("Thong tin sinh vien A:"); svA.XepLoai(); svA.Xuat();
SinhVien svB = new SinhVien("18DH001", "Lam Thanh Ngoc", "CNPM", 2000, 7F); }
static void TestMangSinhVien() {
MangSinhVien dssv = new MangSinhVien(); dssv.Nhap();
Console.WriteLine("Danh sach sinh vien");
dssv.Xuat(dssv.getListSinhVien()); }
static void Main(string[] args) {
MangSinhVien dssv = new MangSinhVien();
Console.Write("Nhap so luong sinh vien muon them vao danh sach: ");
int sl = int.Parse(Console.ReadLine()); for(int i=1;i<=sl;i++) {
Console.WriteLine("sinh vien thu {0}:",i); dssv.Nhap(); }
Console.WriteLine("\nDanh sach sinh vien: ");
dssv.Xuat(dssv.getListSinhVien()); Console.ReadKey(); } } } Bài int array using System;
using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; namespace CTDLGT_BT2 { internal class IntArray { private int[] arr; public void SetArr(int[] a) { this.arr = a; } public int[] GetArr() { return this.arr; } public int this[int index] { set => arr[index] = value; get => arr[index]; } public IntArray() { } public IntArray(int k) { arr = new int[k]; Random r = new Random();
for (int i = 0; i < k; i++) { arr[i] = r.Next(1, 200); } } public IntArray(int[] a) { this.arr = new int[a.Length];
for (int i = 0; i < a.Length; i++) { this.arr[i] = a[i]; } } public IntArray(IntArray obj) {
this.arr = new int[obj.arr.Length];
for (int i = 0; i < obj.arr.Length; i++) { this.arr[i] = obj.arr[i]; } } public bool KiemTraKT(int n) {
if (n > 0 && n <= 200) { return true; } return false; } public void Nhap() {
for (int i = 0; i < arr.Length; i++) { Console.Write($"a[{i}]= ");
arr[i] = int.Parse(Console.ReadLine()); } } public void Xuat() {
for (int i = 0; i < arr.Length; i++) { Console.Write(arr[i] + " "); } Console.WriteLine(); } public int TimTuanTu(int x) {
for (int i = 0; i < arr.Length; i++) { if (arr[i] == x) { return i; } } return -1; } public int TimNhiPhan(int x) { int l = 0; int r = arr.Length - 1; while (l <= r) { int m = (l + r) / 2; if (arr[m] == x) { return m; } else if (x > arr[m]) { l = m + 1; } else { r = m - 1; } }
Console.WriteLine("Khong xuat hien !"); return -1; }
public void Swap(ref int a, ref int b) { int tam = a; a = b; b = tam; } public void InterchangeSort() {
for (int i = 0; i < arr.Length - 1; i++) {
for (int j = i + 1; j < arr.Length; j++) { if (arr[i] > arr[j]) { Swap(ref arr[i], ref arr[j]); } } } } public void BubbleSort() {
for (int i = 0; i < arr.Length - 1; i++) {
for (int j = 0; j < arr.Length - 1 - i; j++) { if (arr[j] > arr[j + 1]) {
Swap(ref arr[j], ref arr[j + 1]); } } } } public void SelectionSort() {
for (int i = 0; i < arr.Length - 1; i++) { int min = i;
for (int j = i + 1; j < arr.Length; j++) { if (arr[j] < arr[min]) { min = j; } }
Swap(ref arr[i], ref arr[min]); } } public void InsertionSort() { 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 = j - 1; } arr[j + 1] = key; } }
public void QuickSort(int left, int right) { if (left < right) {
int pivot = Partition(left, right); if (pivot > 1) { QuickSort(left, pivot - 1); } if (pivot + 1 < right) { QuickSort(pivot + 1, right); } } }
private int Partition(int left, int right) { int pivot = arr[left]; while (true) { while (arr[left] < pivot) { left++; } while (arr[right] > pivot) { right--; } if (left < right) {
if (arr[left] == arr[right]) return right; int temp = arr[left]; arr[left] = arr[right]; arr[right] = temp; } else { return right; } } } public void ShellSort() { int i, j, pos, temp; pos = 3; while (pos > 0) { for (i = 0; i { j = i; temp =arr[i];
while ((j >= pos) && (arr[j - pos] > temp)) { arr[j] = arr[j - pos]; j = j - pos; } arr[j] = temp; } if (pos / 2 != 0) pos = pos / 2; else if (pos == 1) pos = 0; else pos = 1; } } public void ShakerSort() { int l = 0; int r = arr.Length - 1; int k = 0; while (l < r) {
for (int i = l; i < r; i++) { if (arr[i] > arr[i + 1]) {
Swap( ref arr[i],ref arr[i + 1]); k = i; } } r = k;
for (int i = r; i > l; i--) { if (arr[i] < arr[i - 1]) {
Swap( ref arr[i],ref arr[i - 1]); k = i; } } l = k; } }
public int[] MergeSort(int[]arr) { int[] left; int[] right;
int[] result = new int[arr.Length]; if (arr.Length <= 1) return arr;
int midPoint = arr.Length / 2; left = new int[midPoint]; if (arr.Length % 2 == 0) right = new int[midPoint]; else
right = new int[midPoint + 1];
for (int i = 0; i < midPoint; i++) left[i] = arr[i]; int x = 0;
for (int i = midPoint; i < arr.Length; i++) { right[x] = arr[i]; x++; } left = MergeSort(left); right = MergeSort(right); result = Merge(left, right); return result; }
private int[] Merge(int[] left, int[] right) {
int resultLength = right.Length + left.Length;
int[] result = new int[resultLength]; //
int indexLeft = 0, indexRight = 0, indexResult = 0;
while (indexLeft < left.Length || indexRight < right.Length) {
if (indexLeft < left.Length && indexRight < right.Length) {
if (left[indexLeft] <= right[indexRight]) {
result[indexResult] = left[indexLeft]; indexLeft++; indexResult++; } else {
result[indexResult] = right[indexRight]; indexRight++; indexResult++; } }
else if (indexLeft < left.Length) {
result[indexResult] = left[indexLeft]; indexLeft++; indexResult++; }
else if (indexRight < right.Length) {
result[indexResult] = right[indexRight]; indexRight++; indexResult++; } } return result; } } } using System;
using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CTDLGT_BT2 { internal class Program {
static void Main(string[] args) { //interchang sort
Console.OutputEncoding = Encoding.Unicode;
Console.WriteLine("Mảng chưa được xắp xếp"); IntArray a = new IntArray(7); a.Xuat(); a.InterchangeSort();
Console.WriteLine("Mảng sau khi được xắp xếp bằng Interchange Sort: "); a.Xuat(); Console.WriteLine(); //bubble sort
Console.WriteLine("Mảng chưa được xắp xếp"); ; IntArray b =new IntArray(7); b.Xuat(); b.BubbleSort();
Console.WriteLine("Mảng sau khi được xắp xếp bằng Bubble Sort: "); b.Xuat(); Console.WriteLine(); //selection sort
Console.WriteLine("Mảng chưa được xắp xếp"); IntArray c = new IntArray(7); c.Xuat(); c.SelectionSort();
Console.WriteLine("Mảng sau khi được xắp xếp bằng Seclection Sort: "); c.Xuat(); Console.WriteLine(); //Isertion sort
Console.WriteLine("Mảng chưa được xắp xếp"); IntArray d = new IntArray(7); d.Xuat();