# Tutor profile: John Z.

## Questions

### Subject: Web Development

What are the three main types of files that are transferred from a webserver to a webbrowser and what are they used for?

HTML - Hyper Text Markup Language - all of the content of the webpage that will be rendered by the browser. Contains text and other metadata including what other files should be loaded in. It is the first file that is loaded when making a GET request to a website. CSS - Cascading Style Sheet - How the elements in the page will be rendered. It is the color, spacing, styles, etc of each element. JS - JavaScript - adds more complex and interactive functionality to your site. A programming language also used in some web frameworks

### Subject: Python Programming

Use dynamic programming to implement the Fibonacci function that returns the $$n^{th}$$ term. For reference: https://en.wikipedia.org/wiki/Fibonacci_number

def fib(n): # we are going to keep track of the last 2 computations that we have made # this is the dynamic programming portion of this function first, second = 0, 1 # initialize f(0) and f(1) for _ in range(n): first, second = second, first + second # first = f(n - 1), second = f(n-1) + f(n-2) return first

### Subject: Computer Science (General)

Given a list of numbers in an array $$A$$ of length $$n$$, describe an algorithm that can order these numbers in a way such that $$a_1 \le a_2 \le a_3 ... a_n$$ in $$O(n\lg(n))$$ time.

Heapsort We start with the $$heapify$$ operation which constructs a maximum heap. This can be done in $$O(n)$$ time (can be shown through a series expansion of time complexity). Then, we introduce the pop heap operation. We take the root, and swap it with the last element of the heap in $$O(1)$$ time also reducing the number of elements we consider to be in the heap by 1. Then, we rebuild the heap with a down-shift operation that sends the root as far down as it can go while maintaining the heap structure. Worse case, it is sent to the bottom which is an $$O(\lg(n))$$ run time because of how the array is structured. We do $$n$$ of these operations to sort the entire array of numbers giving a run time of $$O(n\lg(N))$$ while being in-place unlike mergesort which uses a auxiliary array, and unlike quicksort, has a lower worst case run time (quicksort's worst case is $$O(n^{2})$$).