Enable contrast version

# Tutor profile: Harshit A.

Inactive
Harshit A.
Machine Learning Engineer
Tutor Satisfaction Guarantee

## Questions

### Subject:Python Programming

TutorMe
Question:

What is list comprehension in python?

Inactive
Harshit A.
Answer:

List comprehension is a simple and elegant way of creating lists in Python. List comprehensions are not only simple but are also efficient in terms of performance. The syntax for list comprehension is one-liner: my_list_comprehension = [expression for_loop conditions] my_list_comprehension = [x**2 for x in range(20) if x%2==0 else 0]

### Subject:Machine Learning

TutorMe
Question:

What do you mean by the Bias-Variance tradeoff?

Inactive
Harshit A.
Answer:

Before going into explaining the tradeoff between bias and variance, let us explain what exactly are bias and variance and then we will see what is the tradeoff and why there is a need for it. a) Bias: As the name suggests bias is a result of wrong assumptions such as the data is linear when it is really quadratic. It leads to models underfitting the data which implies the model is not able to capture the trend of the data which leads to less accurate models. b) Variance: Variance is a result of the high sensitivity of the model towards data due to large number of features, for example, a high degree polynomial model. The models with high variance fail to generalize because of overfitting. Now, if you want to increase the complexity of the model it leads to an increase in Variance and decrease in Bias. Conversely, if you are reducing the increasing the bias, the variance is decreasing. So, you need to find a middle ground for training the model. That's why it's called a tradeoff.

### Subject:C++ Programming

TutorMe
Question:

Explain the concept of Pointers in C++.

Inactive
Harshit A.
Answer:

Before going into the definition of pointers, I will try to go through these three questions and answer them so that you can better understand the concept of pointer: a) What happens when you declare a variable? b) What is the 'address of'(&) operator? c) What is the dereference operator (*)? a) When you declare a variable say : int myVar ; and the above statement gets executed what happens is a memory space gets allocated i.e. set aside from RAM and it has a unique address so that whenever the program sees the variable a, it knows where to look. b) The 'address of (&)' operator: This operator allows us to see the memory address of the variable, for ex: #include <iostream> void main() { int a = 5; cout<<"Value of a is"<< a <<endl; //this line prints value of a cout<<"address of a is"<< &a <<endl; //this line prints the address of the variable a return 0; } Result: 5 0037AF4 c) The dereference operator allows us to access the value at a memory address. #include <iostream> void main() { int a = 5; cout<<"Value of a is"<< a <<endl; //this line prints value of a cout<<"address of a is"<< &a <<endl; //this line prints the address of the variable a cout<<"Value at address (&a)<< *(&a) << ; //this line prints the value at address &a return 0; } Result: 5 0037AF4 5 Now that we understand address-of and dereference operators, pointers can now be easily understood. Pointers are basically variables that hold memory addresses as their values. So if I jot down an analogy for a pointer, Pointer is analogous to a friend who has the address of another friend. Pointers can be declared as: int *ptr; float *ptr; Also please don't confuse the asterisk in pointer declaration to dereference operator. It's just the syntax to declare a pointer. Assigning a pointer int a = 5; int *ptr; ptr = &a ; //pointer ptr holds the address of variable a. cout<<*ptr<<endl; //prints the value of a, here we are using dereference operator That means pointer ptr points to variable a, hence the name pointer. I hope this makes sense. Pointers are considered to be one of the tricky yet powerful concepts of C++, but if understood properly they hold a very simple concept

## Contact tutor

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

## 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.
BEST IN CLASS SINCE 2015
TutorMe homepage
Made in California by Zovio
© 2013 - 2021 TutorMe, LLC
High Contrast Mode
On
Off