src/struct.c
//sorts the list of file in descending order by file occurrences
sorts the list of file in descending order by file occurrences
sorts the list of file in descending order by file occurrences
void sortFileByOccurrences(fPath *head){
    int swapped;
    fPath *ptr1;
    fPath *lptr = NULL;
    if(head == NULL) return;
    do{
        swapped = 0;
        ptr1 = head;
        while(ptr1->next != lptr){
            if(ptr1->fileOccurrences < ptr1->next->fileOccurrences){
                swapfPath(ptr1, ptr1->next);
                swapped = 1;
            }
            ptr1 = ptr1->next;
        }
        lptr = ptr1;
    }while(swapped);
}
void sortFileByOccurrences ( fPath * head ) { int swapped ; fPath * ptr1 ; fPath * lptr = NULL ; if ( head == NULL ) return ; do { swapped = 0 ; ptr1 = head ; while ( ptr1 -> next != lptr ) { if ( ptr1 -> fileOccurrences < ptr1 -> next -> fileOccurrences ) { swapfPath ( ptr1 , ptr1 -> next ) ; swapped = 1 ; } ptr1 = ptr1 -> next ; } lptr = ptr1 ; } while ( swapped ) ; }
sorts the list of file in descending order by file occurrences
sorts the list of file in descending order by file occurrences
//checking for empty list