class LinkedList
{
char data;
LinkedList next;
}
void DynamicSort(LinkedList q)
{
LinkedList p=q;
int i,j,k=0;
char t;
while(p!=null)
{
k++;
p=p.next;
}
p=q;
for(i=0;i<k-1;i++)
{
for(j=0;j<k-i-1;j++)
{
if(p.data>p.next.data)
{
t=p.data;
p.data=p.next.data;
p.next.data=t;
}
p=p.next;
}
p=q;
}
}
Dynamic Array Sorting
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- Create One-dimensional dynamic array #include #include ...
- Q: Say you have an array for which the ith element is the...
- Q: Given an integer array nums, find the sum of the eleme...
- array_values返回数组中所有值array_keys返回数组所有的keyarray_search在数组中搜...