lispp31 - Programming Project #3 Fall 2011 CMSC 420 Hanan...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Fall 2011 Programming Project #3 CMSC 420 Hanan Samet Program the following 11 functions in LISP. Make sure you test them thoroughly. Pay particular attention to the efficiency of your solutions. Test data will be mailed to you. Turn in a run that includes both a pretty printing of your functions and the execution of said functions on the test data. 1. Ordered lists of numbers (with duplicates): (a) Write a function mergelists[x, y] which takes two ordered lists x and y , and makes one ordered list from them, for example, mergelists[’(2 3 4), ’(1 4)] = (1 2 3 4 4) . Your algorithm should run in time proportional to the number of elements in the two lists. (b) Using mergelists , write a function sortlist[l] which takes an unordered list l and makes an ordered list of it, for example, sortlist[’(1 7 3 5 3)] = (1 3 3 5 7) . For an initial list of n elements, your algorithm should run in O ( n log n ) time and not O ( n 2 ) time. (c) Write a predicate dup[l] which indicates if any atom occurs more than once in an unordered list l , for example,
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

lispp31 - Programming Project #3 Fall 2011 CMSC 420 Hanan...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online