skip to main | skip to sidebar

Trixy Programming

attempts to solve technical problems

Sunday, December 21, 2008

Merge List in Scheme


(define (merge a b)
(if (null? a)
b
(if (null? b)
a
(if (< (length (car a)) (length (car b)))
(append (list (car a)) (merge (cdr a) b))
(append (list (car b)) (merge (cdr b) a))
))))
Posted by Justin Beck at 10:21 PM

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

About Justin

Justin's Website

Blog Archive

  • ►  2009 (5)
    • ►  December (4)
    • ►  July (1)
  • ▼  2008 (15)
    • ▼  December (15)
      • Generating Control Logic for 5 stage pipeline Proc...
      • Lazy List in Ruby
      • Make Sublists in Scheme
      • Tree Map Scheme
      • Valid and Equal Binary Tree Scheme
      • Extend Function Scheme
      • Subsets function in Scheme
      • Distrib function Scheme
      • Merge List in Scheme
      • Binary Search Tree in Java
      • Sorted Arraylist in Java
      • Queue in Java
      • Stack in Java
      • Double Linked List in Java
      • Priority Queue in Java using ArrayList
  • ►  2007 (30)
    • ►  October (5)
    • ►  September (16)
    • ►  August (9)