Question: Write a function function createTable (f, n), which supplies a table for a Boolean formula ff with nn inputs, which contains the output of the

a in Write a function function create Table (f, n), which returns a table for a Boolean formula f with n inputs, which for each u jeder Input contains the output of the formula. In the program code, the function f takes an array of Boolean values of the lengths as a parameter opposite. For example, the Boolean formula becomes a V (1-b) c) as a TScript function on function f(x) return x[] or ((not x[1]) and X[2]) X[2]); expressed The truth table should be returned as a nested n-dimensional array. Each individual array has two indexes, with index o being for be Index o for false and index 1 stands for true. The corresponding value of the formula is stored in the innermost araya The above example becomes the following al wird das folgende three-dimensional array with a total of 8 values expected as return (line breaks and comments only to clarity the logic)ichung der Logik) [false, true}, [false, false) # false or ((not false) and false) = false se #false or ((not false) and true) = truere # false or ((not true) and false) = falselse #false or ((not true) and true) = false alte [true, true) (true, true) #true or ((not false) and false) = trueue #true or ((not false) and true) = truetrue # true or ((not true) and false) = true =true #true or ((not true) and true) = true =true For any values a, b, c (0,1) it should have the property that the call of the formula Formel f([a == 1, b == 1, C == 1]) gives the same result as createTable(1, 3)(a) [b][cl] Hints: 15 You can use the last property to check the correctness of your solution Grauon Your solution should work for any ns 0, not just for n = 3 variables. Variablen A recursive approach may be used to build the nested arrays, ani Note that the input to function f is an array of Boolean values, not an array of values and 1. Accordingly, your und false im zurckgegebenen Array onthalten, so wie es im Risti ntsprechend soll Ihre
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
