Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
:confused:
C++
 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?
C++
 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.
Posted
Updated 14-Dec-10 18:31pm
v2

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
 
Share this answer
 
v3
Comments
[no name] 15-Dec-10 17:23pm    
I cleaned up the formatting a bit for you.
Dalek Dave 15-Dec-10 18:43pm    
Good Answer
Henry Minute 15-Dec-10 18:59pm    
@DD: It's not an answer. It's a code snippet from the OP posted in the wrong place.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900