summaryrefslogtreecommitdiff
path: root/prolog/problems/trees/insertbt_3/common.py
blob: f8ef0044ebbe979d0991a5b641b2f5a41d072045 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# coding=utf-8

id = 138
number = 48
visible = True
facts = None

solution = '''\
deleteBT138(X, b(nil, X, nil), nil).
deleteBT138(X, b(b(Ls, E, Rs), X, R), b(L, E, R)) :-
  deleteBT138(E, b(Ls, E, Rs), L).
deleteBT138(X, b(L, X, b(Ls, E, Rs)), b(L, E, R)) :-
  deleteBT138(E, b(Ls, E, Rs), R).
deleteBT138(X, b(L, E, R), b(L1, E, R)) :-
  deleteBT138(X, L, L1).
deleteBT138(X, b(L, E, R), b(L, E, R1)) :-
  deleteBT138(X, R, R1).

insertBT(X, T, NewT) :-
  deleteBT138(X, NewT, T).
'''