Table of Contents

EPGY - Day 4

Morning

Question of the day: I am given 1000 random integers between 0 and 100. What is the least number of steps it will take you to sort the list of numbers?

House Keeping

Review

Big O

Lisp

More recursion

(defun merge-sort (list)
  (if (small list) list
    (merge-lists
		(merge-sort (left-half list))
		(merge-sort (right-half list)))))
 
(defun right-half (list)
  (last list (ceiling (/ (length list) 2))))
(defun left-half (list)
  (ldiff list (right-half list)))
 
(defun small (list)
  (or (null list) (null (cdr list))))
 
(defun merge-lists (list1 list2)
  (merge 'list list1 list2 #'<))
 
(print (merge-sort '(2 4 1 2 4 2 3 1)))

Deeper into Datastructs:

NP-Complete Problems

Big O

Afternoon