Enable contrast version

# Tutor profile: Adarsh M.

Inactive
Adarsh M.
Student at Rensselaer Polytechnic Institute (Computer Science/Information Technology & Web Science major)
Tutor Satisfaction Guarantee

## Questions

### Subject:Python Programming

TutorMe
Question:

Suppose you are trying to understand how the population of two types of animals will evolve over time. You have bunnies and foxes. Unfortunately, foxes like to eat bunnies. So, even though the bunny population grows every year when baby bunnies are born, it also goes down because some of them are eaten. Would the fox population keep increasing in size until there are no bunnies left? Not so. The fox population is directly linked to the bunny population, their main food source. What will happen over time if you start with a given population of bunnies and foxes? Who will win out? Will they balance each other? Suppose $$bpop$$ and $$fpop$$ are the population of bunnies and foxes currently. Then, next year’s population of bunnies (bpop_next) and foxes (fpop_next) are given by: bpop_next = $$(10*bpop)/(1+0.1*bpop) - 0.05*bpop*fpop$$ fpop_next = $$0.4 * fpop + 0.02 * fpop * bpop$$ What will be the population of bunnies and foxes next year? Your program first should read the population of bunnie and foxes using raw_input, compute and print the next years’ population for both based on this current value. Now, for the final challenge, use Year 2 values to find year 3 populations of bunnies and foxes. Do not create new variables, just use the same variables you currently have. Once you figure this out, you can repeat this part 2 more times to find the population in Year 5.

Inactive
Adarsh M.
Answer:

## Function to determine the next year's bunny and fox population def bunny_pop(bpop,fpop): bpop_next = max(0,(10*bpop)/(1+0.1*bpop) - 0.05*bpop*fpop) return int(bpop_next) def fox_pop(bpop,fpop): fpop_next = max(0,0.4 * fpop + 0.02 * fpop * bpop) return int(fpop_next) ## Initial bunny and fox population bpop = int(raw_input("Number of bunnies: ")) fpop = int(raw_input("Number of foxes: ")) ## Table for bunny and fox population for 5 years print "Year 1:", bpop, fpop print "Year 2:", bunny_pop(bpop,fpop), fox_pop(bpop,fpop) print "Year 3:", bunny_pop(bunny_pop(bpop,fpop), fox_pop(bpop,fpop)), fox_pop(bunny_pop(bpop,fpop), fox_pop(bpop,fpop)) print "Year 4:", bunny_pop(bunny_pop(bunny_pop(bpop,fpop), fox_pop(bpop,fpop)), fox_pop(bunny_pop(bpop,fpop), fox_pop(bpop,fpop))), fox_pop(bunny_pop(bunny_pop(bpop,fpop), fox_pop(bpop,fpop)), fox_pop(bunny_pop(bpop,fpop), fox_pop(bpop,fpop))) print "year 5:", bunny_pop(bunny_pop(bunny_pop(bunny_pop(bpop,fpop), fox_pop(bpop,fpop)), fox_pop(bunny_pop(bpop,fpop), fox_pop(bpop,fpop))), fox_pop(bunny_pop(bunny_pop(bpop,fpop), fox_pop(bpop,fpop)), fox_pop(bunny_pop(bpop,fpop), fox_pop(bpop,fpop)))), fox_pop(bunny_pop(bunny_pop(bunny_pop(bpop,fpop), fox_pop(bpop,fpop)), fox_pop(bunny_pop(bpop,fpop), fox_pop(bpop,fpop))), fox_pop(bunny_pop(bunny_pop(bpop,fpop), fox_pop(bpop,fpop)), fox_pop(bunny_pop(bpop,fpop), fox_pop(bpop,fpop))))

### Subject:Calculus

TutorMe
Question:

Calculate the area enclosed by the graphs of $$f(y) = y^2 − 1$$ and $$g(y) = y^2 − \frac{1}{8}y^4 + 1$$.

Inactive
Adarsh M.
Answer:

$$\int_{-2}^2 (2 - \frac{1}{8}y^4)\mathrm{d}y$$ $$= \frac{16}{5} - (-\frac{16}{5})$$ $$= \frac{32}{5}$$

### Subject:C++ Programming

TutorMe
Question:

Create a C++ that EFFICIENTLY checks if a string of length $$n$$ is a palindrome.

Inactive
Adarsh M.
Answer:

#include <iostream> #include <algorithm> #include <string> int main() { std::string word; std::cin >> word; if (equal(word.begin(), word.begin() + word.size()/2, word.rbegin())) std::cout << "\n" + word + " is a palindrome." << endl; else std::cout << "\n" + word + " is not a palindrome." << endl; }

## Contact tutor

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

## 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.