Bear Wear Application Photos
I applied for a modeling position with UCLA's clothing line "Bear Wear" and had to send a photo with my application. These are a few of the photos I had a friend take on campus to send in with the application.
Surprisingly enough of the hundreds of people that applied I was one of five guys selected for the position!
Fibonacci Number
The following is code I wrote while taking CS 161 at UCLA. This code calculates the Nth number in the Fibonacci Number sequence and is implemented in Lisp. Lisp is quite handy for this type of inherently recursive task.
The former solution, FIB, follows the same model as the sequence is mathematically defined: F(1) = 1 and F(N) = F(N-1) + F(N-2). The big-O of this function however is approximately O(N^2). The latter solution, FASTFIB, only uses one recursive call rather than two, keeping track of the last two numbers to calculate the next. It therefore only has a big-O of approximately O(N).
; FIB takes one integer N and returns the ; nth number in the Fibonacci sequence defined: ; FIB(N) = FIB(N-1) + FIB(N-2) ; and FIB of 1, 2, and 3 are 1, 1, and 2 respectively ; ; Inputs: N - a positive integer ; Output: the Nth Fibonacci Number (defun FIB (N) (cond ((<= N 2) 1) (t (+ (FIB (- N 1)) (FIB (- N 2)))))) ; LAST2 takes one integer N and returns a list ; containing the N-1th and Nth Fibonacci numbers ; respectively ; ; Inputs: N - a positive integer ; Output: a list containing the (N-1)th and Nth ; Fibonacci numbers (defun LAST2 (N) (cond ((<= N 2) (list 1 1)) (t (let ((prev2 (LAST2 (- N 1)))) (list (cadr prev2) (+ (car prev2) (cadr prev2))))))) ; FASTFIB is the same as FIB except it uses auxilary ; function LAST2 too compute the Nth Fibonacci Number ; in approximately N additions ; ; Inputs: N - a positive integer ; Output: the Nth Fibonacci Number (defun FASTFIB (N) (cadr (LAST2 N))) |
Download: Fibonacci.lsp





