Enable contrast version

# Tutor profile: Gaurav K.

Inactive
Gaurav K.
Computer Science and Programming Tutor for 3 years
Tutor Satisfaction Guarantee

## Questions

### Subject:Python Programming

TutorMe
Question:

What are dictionaries in python? Explain its usage with an example.

Inactive
Gaurav K.

Dictionaries are data structures in python that are used to store key-value pairs. Their behavior is similar to maps in C++. We will understand dictionaries using a small example. You are on a shopping spree and want to store the count of all fruits that you bought. We can store items as dictionary keys and their counts as the values. fruit_dict = {} ## Define a dictionary ## Adding elements in the dictionary one by one ## if 'apple' is the key, 5 is the value associated to it. fruit_dict['apple'] = 5 fruit_dict['mango'] = 8 fruit_dict['orange'] = 4 fruit_dict['banana'] = 9 fruit_dict['grape'] = 6 ## Listing down all the keys key_list = fruit_dict.keys() ## Removing a key from a dictionary del key_list['apple'] ### Modifying a value for a particular key fruit_dict['apple'] = fruit_dict['apple'] + 10 These were some of the basic operations using a python dictionary.

### Subject:Computer Science (General)

TutorMe
Question:

Elaborate on the concept of recursion which is widely used in the field of computer science.

Inactive
Gaurav K.

Recursion is a widely used method in programming where a function calls itself. A recursive code is highly intuitive and uses lesser lines of code. Although, the time complexity of recursive functions might be higher compared to their iterative counterparts. We will take a small example that computes the power of a number to understand recursion. We need to find pow(a,x) where a is the base and x is the exponent. int pow(int a, int x) { if (x == 0) return 1; // Base condition return a * pow(a, x-1); // Recursive step } This function has two steps: a) First step is the base case which stops the recursive function from going into an infinite loop. b) The recursive step calls the same function with changed parameters. As is evident, pow() function gets called with x- 1 as parameter. pow(a,x-1) computes the x -1 th power of a. When multiplied with a, it returns the xth power of 'a'. So, this recursive function can compute the power of a number.

### Subject:C++ Programming

TutorMe
Question:

Explain the concepts of pointers in C++ programming language.

Inactive
Gaurav K.

Pointers are memory addresses that point to the value present at that address. A pointer can be defined for any data type in C++ including structures. For example, consider this fragment of code: int val = 23; int * ptr = & val; "val" is an integer box having a value of 23. ptr is a pointer that stores the address of the variable "val" as an ampersand sign (&) before any variable denotes its address. When we are given a pointer of a variable, we can deference it to get the value stored at that address. So, int valNew = *ptr; 'valNew' will be equal to 'val'.

## Contact tutor

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

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