# Pseudocode

## Recommended Posts

Hi, everyone the year has ended I finished my 2nd year at University. I was just going over my Subject Knowledge by doing quizzes, practice tests etc on my University site. However, there servers are messed up so I cant download the mark scheme and I don't know if my answers are correct so I'm going to post the question up and give my reasoning behind my answer and you could tell if I'm correct and what the correct answer would be.

I have chosen C as the answer as when you give n = 100 it returns the lowest interger meaning that the less amount of data that needs to be processed by the algorithm meaning its would be the fastes.

Please let me know if you agree

##### Share on other sites

I would try them with a number significantly larger than 100 and see what kind of results you get.

##### Share on other sites

sorry i meant to write 1000 and it seems to be that C is the best would you agree? because

C 13*1000 +62 whereas D 1000(2) ... C returns a lower interger meaning it would be more efficent to process

##### Share on other sites

Hi, everyone the year has ended I finished my 2nd year at University. I was just going over my Subject Knowledge by doing quizzes, practice tests etc on my University site. However, there servers are messed up so I cant download the mark scheme and I don't know if my answers are correct so I'm going to post the question up and give my reasoning behind my answer and you could tell if I'm correct and what the correct answer would be.

I have chosen C as the answer as when you give n = 100 it returns the lowest interger meaning that the less amount of data that needs to be processed by the algorithm meaning its would be the fastes.

Please let me know if you agree

You can go with process of elimination.

n^2 + anything is bigger than n^2, so S1 is bigger than S4 for sure

S4 is also bigger, than S3 (n^2 > n)

So, it's between S3 and S2. The simplest way is to plug in bigger and bigger numbers; 1000 and 10000 just to see which is bigger.

A more educational approach would be to look at how the graphs of n^2, logn and nlogn look like. You can see here for a chart (and a generally good Big-O "cheat sheet" site) http://bigocheatsheet.com/#chart

hold

Edited by Sato

## Create an account

Register a new account