From 95e2fe57f6e4639f6ae9f1fef368829d5090dbf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ale=C5=A1=20Smodi=C5=A1?= Date: Tue, 18 Aug 2015 16:06:19 +0200 Subject: Exported all problems from the SQLite database into the new directory structure. --- prolog/problems/trees/insertbt_3/en.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 prolog/problems/trees/insertbt_3/en.py (limited to 'prolog/problems/trees/insertbt_3/en.py') diff --git a/prolog/problems/trees/insertbt_3/en.py b/prolog/problems/trees/insertbt_3/en.py new file mode 100644 index 0000000..202df0a --- /dev/null +++ b/prolog/problems/trees/insertbt_3/en.py @@ -0,0 +1,15 @@ +id = 138 +name = 'insertBT/3' +slug = 'insert an element into a binary tree' + +description = '''\ +

insertBT(X, T, NewT): the binary tree NewT is obtained from T by inserting the element X at a certain position. This is the opposite of the predicate deleteBT/3. Your code should generate all valid solutions.

+
+  ?- insertBT(2, b(nil,1,nil), T).
+    T = b(b(nil,1,nil),2,nil) ;
+    T = b(nil,2,b(nil,1,nil)) ;
+    T = b(b(nil,2,nil),1,nil) ;
+    T = b(nil,1,b(nil,2,nil)).
+
''' + +hint = {} -- cgit v1.2.1