链接列表和结构成员 [英] Linked List and structure members
本文介绍了链接列表和结构成员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
:confused:
typedef struct people
{
char FirstName[20];
char LastName [20];
}person;
person *p_people;
person people
如何访问上述结构的成员?
How do I access the members of the above structure?
typedef struct people
{
char *FirstName;
char *LastName [20];
}person;
person *p_people;
person people
如何访问上述结构的成员?
我正在尝试编写一个函数,该函数查找链接列表的最小值,该最小值返回列表的名字和姓氏的链接列表值,因此我可以进行插入排序.有人可以写出最小值的代码吗?
非常感谢.
How do I access the members of the above structure?
I am trying to write a function that find the minimum value of the Linked List that returns the Linked List value of First and Last Name of List so I can do an insertion sort. Could someone please write the code for minimum value?
Thank you very much.
推荐答案
selection (int a[],int N)
{
int i, j, min, t;
for(i=1;i<n;i++){>
// how do I this with above structure to find the minimum value?
min=i;
for(j=i+1;j<=N;j++){
if(a[j]){
// how do I do this with structures to find the minimum value?
min = j;
t = a[min];
a[min] = a[i];
a[i] = t;
//convert this so it''ll work on a linked list
还有以下算法:
Also the following algorithm:
insertion(int a[], int N)
{
int i,j,v;
for(i=2;i<=N;i++){
v=a[i];j=i;
while(a[j-1]>v){
a[j] = a[j-1];
j--;
a[j]=v;
}
}
}
如何转换上面的两种,以便它们可以在链表上使用?
约翰
How to convert the two sorts above so they will work on a linked list?
John
^ ]
这篇关于链接列表和结构成员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文