I have linked list and struct like this...
struct list{
float price;
float password;
char name[20];
}
User writes price and names in linked list. I have sorted linked list with merge sort by price... My problem is-> When user write 2 equal price then program must sort sort this equal price by name...How to do this? I sorted by price...This is sort for price...
From linked list i have move price to int array[] and this is first argument for merge sort...How to implement name to sort 2 equal prices if user write this?
numbers ->float array (price)t
temp -> empty array
polje_sifra -> this is passwor but this is not important..I use this for better sorting...
void merge(float numbers[], float temp[],float polje_sifra[], int left, int mid, int right)
{
float *temp2 = new float[br_unesenih_el(glava)];
int i, left_end, num_elements, tmp_pos;
left_end = mid - 1;
tmp_pos = left;
num_elements = right - left + 1;
for (i=0; i <= num_elements; i++)
{
numbers[right] = temp[right];
polje_sifra[right] = temp2[right];
right = right - 1;
}
}
void m_sort(float numbers[], float temp[],float polje_sifra[], int left, int right)
{
int mid;