We use cookies to give you the best experience possible. By continuing we’ll assume you’re on board with our cookie policy

Recursion Lesson

essay
The whole doc is available only for registered users
  • Pages: 6
  • Word count: 1315
  • Category: Service

A limited time offer! Get a custom sample essay written according to your requirements urgent 3h delivery guaranteed

Order Now

The first problem which is the cost of tuition and parking in Porterville College is recursive since the nth value depends on the previous (or n-1) values. The recursive function for the problem is the following:

F(n) = F(n-1) + kn

where n = number of years      and      k = multiple factor of n per 5 years

Using the function, the questions raised can then be answered. Table 1 shows the solution for years 2010, 2015, and 2020.

Table 1. Cost of tuition and parking in Porterville College.

Year No. of Years since 1987 (n) Function F(n) Cost of Tuition and Parking
1987 0 F(n) $1,200
1988 1 F(n-1) + 82n $1,264
1989 2 F(n-1) + 82n $1,392
1990 3 F(n-1) + 82n $1,584
1991 4 F(n-1) + 82n $1,840
1992 5 F(n-1) + 82n $2,160
1993 6 F(n-1) + 92n $2,646
1994 7 F(n-1) + 92n $3,213
1995 8 F(n-1) + 92n $3,861
1996 9 F(n-1) + 92n $4,590
1997 10 F(n-1) + 92n $5,400
1998 11 F(n-1) + 102n $6,500
1999 12 F(n-1) + 102n $7,700
2000 13 F(n-1) + 102n $9,000
2001 14 F(n-1) + 102n $10,400
2002 15 F(n-1) + 102n $11,900
2003 16 F(n-1) + 112n $13,836
2004 17 F(n-1) + 112n $15,893
2005 18 F(n-1) + 112n $18,071
2006 19 F(n-1) + 112n $20,370
2007 20 F(n-1) + 112n $22,790
2008 21 F(n-1) + 122n $25,814
2009 22 F(n-1) + 122n $28,982
2010 23 F(n-1) + 122n $32,294
2011 24 F(n-1) + 122n $35,750
2012 25 F(n-1) + 122n $39,350
2013 26 F(n-1) + 132n $43,744
2014 27 F(n-1) + 132n $48,307
2015 28 F(n-1) + 132n $53,039
2016 29 F(n-1) + 132n $57,940
2017 30 F(n-1) + 132n $63,010
2018 31 F(n-1) + 142n $69,086
2019 32 F(n-1) + 142n $75,358
2020 33 F(n-1) + 142n $81,826
2021 34 F(n-1) + 142n $88,490
2022 35 F(n-1) + 142n $95,350

            The second problem which is waiting in lines states that:

As the school registrar, part of your job entails making the registration process as painless as possible for the students. One aspect of the registration process that influences the length of the time required to register is the amount of time students spend waiting in line. To get a better idea of the factors that influence the wait time, you have decided to model a few different situations.

(1)  Determine the average wait time, when possible, for students in each of the following situations. For situations where an average wait time was determined, when will the registrar catch up so that there are no students waiting?

(2)  What do you notice about the relationships among the arrival time, service time, and waiting time?

Situation A

Assume that no student is waiting in line. Each student needs two minutes to pick up his/her registration materials and students are scheduled to arrive every three minutes.

ANSWER:

(1)       Let W = wait time, X = arrive time, S = service time

and      m = number of students waiting in line, n = number of students arriving.

Since S=2mins ≤ X=3mins, then there will be no waiting.

(2)       Total service time is Stotal(n) = 2n

Situation B

Assume that no student is waiting in line. Each student needs two minutes to pick up his/her registration materials and students are scheduled to arrive each minute.

ANSWER:

(1)       Let W = wait time, X = arrive time, S = service time

Since S=2mins ≥ X=1mins, then there will be waiting of 1min à W=1min.

(2)       If students keep arriving, then the function W(n) which is the wait time of  the nth  student is:

        where n = 1,2,3,…k

and         where     and      n = 1,2,3,…k

This is also equal to the function X(n) which is the arrive time of the nth student:

        where n = 1,2,3,…k

and           where      and      n = 1,2,3,…k

and the total service time is Stotal(n)= 2n

Student, n Arrive Time, X (mins) Service Time, S start (mins) Service Time, S end (mins) Wait Time, W (mins)
n1 0 0 2 0
n2 1 2 4 1
n3 2 4 6 2
n4 3 6 8 3
n5 4 8 10 4
n6 5 10 12 5
n7 6 12 14 6
n8 7 14 16 7
n9 8 16 18 8
n10 9 18 20 9


Situation C

Assume that there are four students waiting in line as registration begins and that each new student arrives three minutes apart. Also assume that the service time is still two minutes.

ANSWER:

(1)       Let W = wait time, X = arrive time, S = service time

Since S=2mins ≤ X=3mins, then eventually there will be no waiting.  But since there are four students waiting in line, m=4, then there will be waiting for the first few students that are arriving.  Based on the table shown below, the average wait time will be

             where m = no. of students waiting,       n = no. of students arriving

 (2)      If students keep arriving, then the function X(n) which is the arrive time of the nth student is:

          where n = 1,2,3,…k

and          where             and      n = 1,2,3,…k

and the total service time is Stotal(n) = 2(3+n)

Wait time will be zero when arrive time X(n) equals start service time Sstart(n):

Student, m & n Arrive Time, X (mins) Service Time, S start (mins) Service Time, S end (mins) Wait Time, W (mins)
m1 0 0 2 0
m2 0 2 4 2
m3 0 4 6 4
m4 0 6 8 6
n1 0 8 10 8
n2 3 10 12 7
n3 6 12 14 6
n4 9 14 16 5
n5 12 16 18 4
n6 15 18 20 3
n7 18 20 22 2
n8 21 22 24 1
n9 24 24 26 0
n10 27 26 28 0


Situation D

Assume that five students are waiting and each transaction takes three minutes with arrivals four minutes apart.

ANSWER:

(1)       Let W = wait time, X = arrive time, S = service time

Since S=3mins ≤ X=4mins, then eventually there will be no waiting.  But since there are five students waiting in line, m=5, then there will be waiting for the first few students that are arriving.  Based on the table shown below, the average wait time will be

             where m = no. of students waiting,       n = no. of students arriving

(2)       If students keep arriving, , then the function X(n) which is the arrive time of the nth student is:

                     where n = 1,2,3,…k

and          where            and      n = 1,2,3,…k

and the total service time, Stotal(n)= 2(4+n)

Wait time will be zero when arrive time X(n) equals start service time Sstart(n):

Student, m & n Arrive Time, X (mins) Service Time, S start (mins) Service Time, S end (mins) Wait Time, W (mins)
m1 0 0 2 0
m2 0 2 4 2
m3 0 4 6 4
m4 0 6 8 6
m5 0 8 10 8
n1 0 10 12 10
n2 4 12 14 8
n3 8 14 16 6
n4 12 16 18 4
n5 16 18 20 2
n6 20 20 22 0
n7 24 22 24 0
n8 28 24 26 0
n9 32 26 28 0
n10 36 28 30 0

 References

Weisstein, Eric W. “Recursion.” MathWorld. 1 May 2008. Wolfram Web Resource. 3 May 2008 <http://mathworld.wolfram.com/Pythagorean Theorem.html>.

Related Topics

We can write a custom essay

According to Your Specific Requirements

Order an essay
icon
300+
Materials Daily
icon
100,000+ Subjects
2000+ Topics
icon
Free Plagiarism
Checker
icon
All Materials
are Cataloged Well

Sorry, but copying text is forbidden on this website. If you need this or any other sample, we can send it to you via email.

By clicking "SEND", you agree to our terms of service and privacy policy. We'll occasionally send you account related and promo emails.
Sorry, but only registered users have full access

How about getting this access
immediately?

Your Answer Is Very Helpful For Us
Thank You A Lot!

logo

Emma Taylor

online

Hi there!
Would you like to get such a paper?
How about getting a customized one?

Can't find What you were Looking for?

Get access to our huge, continuously updated knowledge base

The next update will be in:
14 : 59 : 59