lispp31

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

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

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,

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern