Skip to content

Instantly share code, notes, and snippets.

@lizixroy
Created July 28, 2016 03:11
Show Gist options
  • Save lizixroy/ca3f828a3a7065a4f72d6f956beb6e81 to your computer and use it in GitHub Desktop.
Save lizixroy/ca3f828a3a7065a4f72d6f956beb6e81 to your computer and use it in GitHub Desktop.
for col in 0...wordCount - 1 {
for row in (0...wordCount - 1).reverse() {
var t = row
while t + 1 <= col {
let arr1 = table[row][t]
let arr2 = table[t + 1][col]
if arr1.count == 0 || arr2.count == 0 {
t += 1
continue
}
if let nonTerminals = language.recognize(arr1: arr1, arr2: arr2) {
for nonTerminal in nonTerminals {
table[row][col].append(nonTerminal)
}
}
t += 1
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment