summaryrefslogtreecommitdiff
path: root/coding-exercises/2/62.rkt
diff options
context:
space:
mode:
authorMike Vink <mike1994vink@gmail.com>2023-03-27 21:58:09 +0200
committerMike Vink <mike1994vink@gmail.com>2023-03-27 21:58:09 +0200
commit5254a0befde355fca2711033f77047cf0bb5c08f (patch)
treeb6d07966babf647cd930bf82077f2d31985a8018 /coding-exercises/2/62.rkt
parentac1bf1b75868c873037f742b727e79ee5a97bae2 (diff)
moar
Diffstat (limited to 'coding-exercises/2/62.rkt')
-rw-r--r--coding-exercises/2/62.rkt3
1 files changed, 2 insertions, 1 deletions
diff --git a/coding-exercises/2/62.rkt b/coding-exercises/2/62.rkt
index 705dcbd..a1be49e 100644
--- a/coding-exercises/2/62.rkt
+++ b/coding-exercises/2/62.rkt
@@ -1,6 +1,8 @@
#lang racket
;; In each branch of the problem we either terminate the process or we reduce the problem to a subproblem with set - (car set)
+;; O(n)
+;; need to iterate like this to prevent duplicates?
(define (union-set set1 set2)
(cond ((and (null? set1) (null? set2)) '())
((null? set1) (cons (car set2) (union-set set1 (cdr set2))))
@@ -12,4 +14,3 @@
(define test-list (list 1 2))
(define test-list2 (list 4 5 6 7))
(union-set test-list test-list2)
-