こんにちは、私は2D char配列を持っているCコードを持っています -
names[100][20] //Currently maximum 100 names, each of 19 characters supported
この配列は、名前を持ついくつかのロジックによって埋められます。実際に見つかった名前の総数 (100 個未満の名前である可能性があります) を変数 names_found で追跡しています。
ここで、存在する可能性のある重複した名前を削除したいと思います。私がやろうとしていることは、次のようなものです。
for(i=0;i<names_found;i++)
{
for(j=i+1;j<names_found;j++)
{
//Then compare(strcmp) each string/name with every other.
//e.g. if there were 4 names the comparisons done would be
//{name[0],name[1]},{name[0],name[2]},{name[0],name[3]}
//{name[1],name[2]} , {name[1],name[3]}
//& {name[2],name[3]}
//And then some more logic to remove duplicate based on result of strcmp results. Don't know what this logic would look like to store the result in place, in same 2D character buffer?
}
重複した単語を削除するこのロジック
は、機能的に正しいですか?
速度を最適化するにはどうすればよいですか。
より良い/より高速なソリューション。