Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
21
Task/Ackermann-function/PL-SQL/ackermann-function.sql
Normal file
21
Task/Ackermann-function/PL-SQL/ackermann-function.sql
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
DECLARE
|
||||
|
||||
FUNCTION ackermann(pi_m IN NUMBER,
|
||||
pi_n IN NUMBER) RETURN NUMBER IS
|
||||
BEGIN
|
||||
IF pi_m = 0 THEN
|
||||
RETURN pi_n + 1;
|
||||
ELSIF pi_n = 0 THEN
|
||||
RETURN ackermann(pi_m - 1, 1);
|
||||
ELSE
|
||||
RETURN ackermann(pi_m - 1, ackermann(pi_m, pi_n - 1));
|
||||
END IF;
|
||||
END ackermann;
|
||||
|
||||
BEGIN
|
||||
FOR n IN 0 .. 6 LOOP
|
||||
FOR m IN 0 .. 3 LOOP
|
||||
dbms_output.put_line('A(' || m || ',' || n || ') = ' || ackermann(m, n));
|
||||
END LOOP;
|
||||
END LOOP;
|
||||
END;
|
||||
Loading…
Add table
Add a link
Reference in a new issue