Revision:Algorithms - The Student Room
The Student Room

Revision:Algorithms

TSR Wiki > Study Help > Subjects and Revision > Revision Notes > Mathematics > Algorithms



An algorithm is defined as a finite sequence of unambiguous instructions for solving a problem.

  • Every algorithm requires an input
  • The output depends only on the input
  • The algorithm must terminate in a finite time for all inputs (it doesn't get stuck in a loop)

Contents

Order

The order of an algorithm is a measure of the approximate run time for an algorithm, depending on the size of the problem. For large problems we only need to consider the dominant term to get an approximate run time.

The efficiency of an algorithm is a measure of how well an algorithm copes with an increase in the size, n, of a problem. The efficiency decreases as run time increases.

Order Run time proportional to
Linear n
Quadratic n^2
Cubic n^3
Exponential x^n or n!

Example

A computer takes 2 seconds to solve a problem of size 30. Estimate the times taken to solve a problem of size 300 if the algorithm used has

  • an order n

 2 \times \frac{300}{30} = 20\ seconds

  • an order n2

 2 \times (\frac{300}{30})^2 = 200\ seconds \approx 3.33\ minutes

  • an order n3

 2 \times (\frac{300}{30})^3 = 2000\ seconds \approx 33.3\ minutes

  • an order 2n

 time \propto 2^n

 t = k \times 2^n

 2 = k \times 2^{30}

 k = \frac{2}{2^{30}}

Therefore, using n = 300

t = 2^{300} \times \frac{2}{2^{30}}

t \approx 3.79e81\ seconds \approx 1.2e71\ millenia

Also See

See the other D1 notes:

  1. Algorithms
  2. Sorting algorithms
  3. Packing algorithms
  4. Graphs and networks
  5. Minimum connector problems
  6. The shortest path
  7. Route inspection
  8. The travelling salesman problem
  9. Linear programming
  10. The simplex algorithm

Comments

Discussions Toggle
Peninsula Medical School Applicants thread 2012 entry.
started by: joemullally
forum: Medical Schools
replies: 1205
last post: 1 Minute Ago
Opposite gender friendship.
started by: KyranCurry
forum: Friends, Family and Work
replies: 87
last post: 1 Minute Ago
Suturing at medical school?
started by: MrDoctor
forum: Medicine
replies: 15
last post: 1 Minute Ago
Do you think the British forces should get involved with Syria?
started by: lsaul95
forum: International
replies: 94
last post: 2 Minutes Ago
Depression Society MKVI
started by: Idle
forum: Mental Health
replies: 1877
last post: 2 Minutes Ago
Sex crisis in Japan will spread to UK. I blame videogames
started by: Simplicity
forum: Society
replies: 63
last post: 2 Minutes Ago
Central Link [Accommodation]
started by: Merro
forum: Newcastle Unis
replies: 6
last post: 2 Minutes Ago
Help me flatten my stomach please
started by: Freak Out
forum: Fitness
replies: 7
last post: 2 Minutes Ago
***Official Summer 2012 & Off Cycle Internship Applications***
started by: InternshipPlease
forum: Investment Banking Internships and Work Experience
replies: 5447
last post: 2 Minutes Ago
Foods you buy, but wish you could cook.
started by: Eternal*
forum: Food and Drink
replies: 69
last post: 2 Minutes Ago
Has anyone here read the Bible cover to cover?
started by: ROYP
forum: Religion
replies: 86
last post: 2 Minutes Ago
The Porn Industry - celebrating or diminishing feminism?
started by: Marinated_in_Joy
forum: Society
replies: 74
last post: 2 Minutes Ago
Games you love that no one else seems to have played
started by: Kater Murr
forum: Gaming
replies: 520
last post: 2 Minutes Ago
"The role of a business is to provide a service, NOT to create profit"
started by: IB_19
forum: UK Politics
replies: 163
last post: 2 Minutes Ago
AQA physics unit 6 maths help
started by: Polo_the_Don
forum: Physics
replies: 1
last post: 2 Minutes Ago
Cannibalization of Nigerian Muslims
started by: xXxiKillxXx
forum: International
replies: 48
last post: 3 Minutes Ago
Intl Engineering Fraternity
started by: SPDexpansion
forum: Student Life
replies: 0
last post: 3 Minutes Ago
The Uni Study Thread Mk II
started by: Aemiliana
forum: Student Life
replies: 513
last post: 3 Minutes Ago
TSR Graduate entry medics and applicants society!
started by: brokenangel
forum: Medicine Community Discussion
replies: 9690
last post: 3 Minutes Ago
Op prep - rehab, recovery and a return to strength. Bigger, stronger & faster
started by: Powerlifter
forum: Fitness Blogs
replies: 143
last post: 3 Minutes Ago
Article Updates Toggle
Contact Us | Site Rules | Staying Safe on TSR | Advertising | Staff Blog | Essays & Coursework | Terms & Conditions | Top
Customise your TSR | Life Advice | Hobbies and Interests | Debate and Current Affairs | Study Help | University and University courses
Universities and HE Colleges | Careers, Employment and Gap Years | General Discussion

Customise your TSR