C programming sorting an array of structs based on 4 strings -



C programming sorting an array of structs based on 4 strings -

edit: forgot mention begins circular linked list! need sort array of contact structs, defined below, in next order:

last name first name email phone number

how go this, in efficient way? which sorting method best fit, in terms of big o order?

here struct definition:

struct contact { char firstname[256], lastname[256], email[256], phonenumber[256]; struct contact *pprev; struct contact *pnext; };

it looks info organized in list (due pprev , pnext). qsort() cannot used on lists.

for lists mergesort way go: long list contains more 1 element, split 2 lists, sort each of them, merge 2 sorted lists one: since both lists sorted heads have compared. compare heads of 2 lists, remove smaller 1 , append sorted list.

complexity o(n*log n)

c arrays string sorting struct

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -