Что наиболее эффективно для алгоритма скорости для решения следующей проблемы?
Для 6 массивов D1, D2, D3, D4, D5 и D6, каждый из которых содержит 6 чисел, таких как:
D1[0] = number              D2[0] = number      ......       D6[0] = number
D1[1] = another number      D2[1] = another number           ....
.....                       ....                ......       ....
D1[5] = yet another number  ....                ......       ....
Учитывая второй массив ST1, содержащий 1 номер:
ST1[0] = 6
Учитывая третий массив ans, содержащий 6 чисел:
ans[0] = 3, ans[1] = 4, ans[2] = 5, ......ans[5] = 8
Используя в качестве индекса для массивов D1, D2, D3, D4, D5 и D6 число, которое идет от 0, к числу, хранящемуся в ST1 [0] минус один, в этом примере 6, поэтому от 0 до 6 -1, сравните массив ans с каждым массивом D. Результат должен быть 0, если одно или несколько чисел ans не найдены ни в одном D в одном и том же индексе и должны быть равны 1, если все числа ans найдены в некотором D в одном и том же индексе. То есть, возвращаем 0, если некоторые ans [i] не равны ни одному D N [i] и возвращают 1, если каждый ans [i] равен некоторому D N [i ].
Мой алгоритм до сих пор: 
Я старался держать все как можно больше.
EML  := ST1[0]   //number contained in ST1[0]   
EML1 := 0        //start index for the arrays D 
While EML1 < EML
   if D1[ELM1] = ans[0] 
     goto two
   if D2[ELM1] = ans[0] 
     goto two
   if D3[ELM1] = ans[0] 
     goto two
   if D4[ELM1] = ans[0] 
     goto two
   if D5[ELM1] = ans[0] 
     goto two
   if D6[ELM1] = ans[0] 
     goto two
   ELM1 = ELM1 + 1
return 0     //If the ans[0] number is not found in either D1[0-6], D2[0-6].... D6[0-6] return 0 which will then exclude ans[0-6] numbers
two:
EML1 := 0      start index for arrays Ds 
While EML1 < EML
   if D1[ELM1] = ans[1] 
     goto three
   if D2[ELM1] = ans[1] 
     goto three
   if D3[ELM1] = ans[1] 
     goto three
   if D4[ELM1] = ans[1] 
     goto three
   if D5[ELM1] = ans[1] 
     goto three
   if D6[ELM1] = ans[1] 
     goto three
   ELM1 = ELM1 + 1
return 0    //If the ans[1] number is not found in either D1[0-6], D2[0-6]....  D6[0-6]  return 0 which will then exclude ans[0-6] numbers
three:
EML1 := 0      start index for arrays Ds 
While EML1 < EML
   if D1[ELM1] = ans[2] 
     goto four
   if D2[ELM1] = ans[2] 
     goto four
   if D3[ELM1] = ans[2] 
     goto four
   if D4[ELM1] = ans[2] 
     goto four
   if D5[ELM1] = ans[2] 
     goto four
   if D6[ELM1] = ans[2] 
     goto four
   ELM1 = ELM1 + 1
return 0   //If the ans[2] number is not found in either D1[0-6], D2[0-6]....  D6[0-6]  return 0 which will then exclude ans[0-6] numbers
four:
EML1 := 0      start index for arrays Ds 
While EML1 < EML
   if D1[ELM1] = ans[3] 
     goto five
   if D2[ELM1] = ans[3] 
     goto five
   if D3[ELM1] = ans[3] 
     goto five
   if D4[ELM1] = ans[3] 
     goto five
   if D5[ELM1] = ans[3] 
     goto five
   if D6[ELM1] = ans[3] 
     goto five
   ELM1 = ELM1 + 1
return 0 //If the ans[3] number is not found in either D1[0-6], D2[0-6]....  D6[0-6]  return 0 which will then exclude ans[0-6] numbers
five:
EML1 := 0      start index for arrays Ds 
While EML1 < EML
   if D1[ELM1] = ans[4] 
     goto six
   if D2[ELM1] = ans[4] 
     goto six
   if D3[ELM1] = ans[4] 
     goto six
   if D4[ELM1] = ans[4] 
     goto six
   if D5[ELM1] = ans[4] 
     goto six
   if D6[ELM1] = ans[4] 
     goto six
   ELM1 = ELM1 + 1
return 0  //If the ans[4] number is not found in either D1[0-6], D2[0-6]....  D6[0-6]  return 0 which will then exclude ans[0-6] numbers
six:
EML1 := 0      start index for arrays Ds 
While EML1 < EML
   if D1[ELM1] = ans[5] 
     return 1            ////If the ans[1] number is not found in either D1[0-6].....  
   if D2[ELM1] = ans[5]      return 1 which will then include ans[0-6] numbers
     return 1
   if D3[ELM1] = ans[5] 
     return 1
   if D4[ELM1] = ans[5] 
     return 1
   if D5[ELM1] = ans[5] 
     return 1
   if D6[ELM1] = ans[5] 
     return 1
   ELM1 = ELM1 + 1
return 0 
Как язык выбора, он был бы чистым c
