nguyenducdh10th
Bạn có muốn phản ứng với tin nhắn này? Vui lòng đăng ký diễn đàn trong một vài cú nhấp chuột hoặc đăng nhập để tiếp tục.
Latest topics
» Transparency On Prices Required From All Health Care Sectors, Not Only Physicians, Letter States
InsertSort (Sắp xếp bằng chèn trực tiếp) EmptyWed Aug 03, 2011 4:48 pm by Khách viếng thăm

» Refog Kelogger wont work on machine with Net Protector Antivirus?
InsertSort (Sắp xếp bằng chèn trực tiếp) EmptyWed Aug 03, 2011 5:28 am by Khách viếng thăm

» play popular vegas slots
InsertSort (Sắp xếp bằng chèn trực tiếp) EmptyWed Aug 03, 2011 2:59 am by Khách viếng thăm

» fish oil heart health
InsertSort (Sắp xếp bằng chèn trực tiếp) EmptyTue Aug 02, 2011 11:48 pm by Khách viếng thăm

» hi i am using micromax 3g modem. i am clueless how to use it in Linux environment?
InsertSort (Sắp xếp bằng chèn trực tiếp) EmptyTue Aug 02, 2011 8:14 am by Khách viếng thăm

» гинекологические больницы отзывы
InsertSort (Sắp xếp bằng chèn trực tiếp) EmptyMon Aug 01, 2011 12:13 pm by Khách viếng thăm

» how i can made a backup of bootable USB.?
InsertSort (Sắp xếp bằng chèn trực tiếp) EmptyMon Aug 01, 2011 2:48 am by Khách viếng thăm

» To which directory or path do we need to install the modules in drupal through filezilla?
InsertSort (Sắp xếp bằng chèn trực tiếp) EmptySat Jul 30, 2011 9:29 pm by Khách viếng thăm

» Should I upgrade my hardware for my computer?
InsertSort (Sắp xếp bằng chèn trực tiếp) EmptySat Jul 30, 2011 1:27 pm by Khách viếng thăm

Thống Kê
Hiện có 1 người đang truy cập Diễn Đàn, gồm: 0 Thành viên, 0 Thành viên ẩn danh và 1 Khách viếng thăm

Không

[ View the whole list ]


Số người truy cập cùng lúc nhiều nhất là 15 người, vào ngày Tue Apr 30, 2024 3:29 pm

InsertSort (Sắp xếp bằng chèn trực tiếp)

Go down

InsertSort (Sắp xếp bằng chèn trực tiếp) Empty InsertSort (Sắp xếp bằng chèn trực tiếp)

Bài gửi  Admin Wed Dec 01, 2010 10:23 am

//Minh hoa InsertSort chen truc tiep
//Nguoi viet: Le Nguyen Duc
//Minh hoa thuat: InsertSort (Sap xep bang chen truc tiep)
int Mang[20]={10,9,8,7,6,5,4,3,2,1};
void InsertSort(int mang[],int n)
{ int pos,i,x,vt;
for(i=1;i<n;i++)
{
//gan gia tri phan tu thu i se duoc chen vao vi tri pos
x=mang[i];
pos=i;
//tim vi tri chen x
while(pos>0&&x<mang[pos-1])
pos=pos-1;
for(vt=i;vt>=pos;vt--)
mang[vt]=mang[vt-1];
// chen x vao vi tri pos
mang[pos]=x;
}
}
void inday(int mang[],int n)
{
int j;
for(j=0;j<n;j++)
printf("%d ",mang[j]);
}
void main()
{
clrscr();
printf("Day truoc khi sap xep\n");
inday(Mang,10);
printf("\nDay sau khi sap xep\n");
InsertSort(Mang,10);
inday(Mang,10);
getch();
}
Admin
Admin
Admin

Tổng số bài gửi : 38
Join date : 20/11/2010

https://nguyenducdh10th.forumvi.com

Về Đầu Trang Go down

Về Đầu Trang

- Similar topics

 
Permissions in this forum:
Bạn không có quyền trả lời bài viết