java - Number and string sorting Al -
i want sort number+string combination sorting based on number combination. can suggest optimal solution?
say strings are:
12 masdf
4 oasd
44 twer
and on. sorting based on numbers 12, 4, 44 , after sorting have show full alphanumeric strings.
as program run on thousands of data don't want split string , compare number on each iteration. plan extract numbers , take in array , sort array. after sorting done, want put numbers associated strings , keep in string array show. should done in c++. algorithms should applied - insertion sort, quick sort, merge sort, etc.
create class store full string , number. make class comparable
. convert list of string list of class. sort list using sort method relevant. iterate list , print string fields.
sorry, answer java, since tagged java. replace/remove comparable
whatever c++.
Comments
Post a Comment