快速sort一個字符串 && 快速尋找子串 Sort a list of string and search for a substring in a string

1. 快速sort一個list,list裏面的元素都是string eg: ["ab","is","cs","iw"] 我們需要每一位每一位的比較,如果使用quick sort對每一位來排序,複雜度太高了。 首先介紹:key-indexed counting:(0(n))時間 首先得到出現的字母的頻率,按照字母順序來存儲 然後將count[i+1] = count[i] + count[i+1]
相關文章
相關標籤/搜索