Enable contrast version

# Tutor profile: John Z.

John Z.
Teaching Assistant for Computer Science and Masters Student

## Questions

### Subject:Web Development

TutorMe
Question:

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

John Z.

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

TutorMe
Question:

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

John Z.

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)

TutorMe
Question:

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.

John Z.

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})$$).

## FAQs

What is a lesson?
A lesson is virtual lesson space on our platform where you and a tutor can communicate. You'll have the option to communicate using video/audio as well as text chat. You can also upload documents, edit papers in real time and use our cutting-edge virtual whiteboard.
How do I begin a lesson?
If the tutor is currently online, you can click the "Start Lesson" button above. If they are offline, you can always send them a message to schedule a lesson.
Who are TutorMe tutors?
Many of our tutors are current college students or recent graduates of top-tier universities like MIT, Harvard and USC. TutorMe has thousands of top-quality tutors available to work with you.
BEST IN CLASS SINCE 2015
TutorMe homepage