Enable contrast version

Tutor profile: Ameet R.

Inactive
Ameet R.
Undergraduate researcher at Center for Information Technology Research in the Interest of Society, UC Berkeley
Tutor Satisfaction Guarantee

Questions

Subject: Python Programming

TutorMe
Question:

Why is it that when I do this: a = [1,2,3] b=a b.append(4) a is now [1,2,3,4], but I never change it? On the contrary, when I do the same for numbers, it doesn't seem to change. For example: a = 1 b=a b+=1 Now, a=1, b=2?

Inactive
Ameet R.
Answer:

In Python (and quite a few other languages), there's a concept called mutability. The basic data types (int, float, bool, string, tuple, etc) are immutable. More advanced data structures (list, set, custom objects) are usually mutable. A mutable object can change its state or contents and immutable objects cannot. So, when you create a list (as is done in the first part of the question), a only contains a pointer to the object in memory. When you define b=a, you pass the pointer that a has onto b. Now any changes you make on the list from EITHER a or b will affect both since they are both influencing the underlying object in memory that the pointer that they both have is pointing to. On the other hand, in the second example, $$a=1$$ is defining an integer that is equal to 1. Then, when you set b=a, you copy that 1 and set it to b. Now, both a and b are equal to 1, but they are held in different places in memory. You can quickly check this by checking the id. In the first example, id(a) == id(b) = True In the second example, id(a)==id(b)==False (The function id(*)) returns the memory address of the object). Now, when you increase b in the second part, a is unaffected because they are held in different places in memory.

Subject: Linear Algebra

TutorMe
Question:

Is $$R^n$$ finite dimensional?

Inactive
Ameet R.
Answer:

A vector space is called finite dimensional if some list of vectors in it spans the space. Some list of vectors spans the space if $$\text{span}(v_1,\cdots, v_m) = V)$$, where $$V=R^n$$ is the list of vectors. Thus, $$R^n$$ is finite dimensional because $$((1,0,0\cdots, 0), (0,1,\cdots,0), \cdots, (0,\cdots, 1))$$ spans $$R^n$$. The span is the set of all linear combinations of the list of vectors. That is, $$\text{span}(v_1,\cdots,v_m)= \{a_1v_1 + \cdots a_mv_m : a_1,\cdots, a_m \in F\}$$. Hence, we can create all of the vectors in $$R^n$$ by adding some number of vectors within the span and multiplying it by some constant within $$R$$. Since, we have $$n<\infty$$ vectors within the span, $$R^n$$ is finite dimensional.

Subject: Computer Science (General)

TutorMe
Question:

If it is possible to draw a reduction from the Max Flow Algorithm to a Rudrata Cycle, then does $$P=NP$$?

Inactive
Ameet R.
Answer:

Not necessarily. I like to think of reductions as a question of solvability. That is, by reducing problem $$A$$ to problem $$B$$, you are saying that problem $$A$$ can be solved in the time complexity used by problem $$B$$. However, this is not a lower bound on the complexity, since it is possible to reduce a $$P$$ problem to a $$NP$$ problem. This makes sense, as $$P\subset NP$$. In this specific problem, we draw a reduction from a popular polynomial time algorithm, Max Flow to a popular $$NP$$ problem, Rudrata cycle. We are effectively saying that Max Flow can be solved with a more computationally intensive problem. However, this doesn't say anything about Rudrata Cycle itself, so we can't say that $$P=NP$$ just from this. However, if we were to switch the statement and say Rudrata reduces to Max Flow, then we would be saying that a non-polynomial problem can be solved with a polynomial algorithm, implying that $$P=NP$$.

Contact tutor

Send a message explaining your
needs and Ameet will reply soon.
Contact Ameet

Request lesson

Ready now? Request a lesson.
Start Lesson

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.