Problem 2.3 from SCHAUM’S OUTLINE OF Principles of COMPUTER SCIENCE

Count the primitive operations in your algorithm to find the mean.
What is the order of growth of your mean algorithm?



setup 4
loop 5 * length (length = n, the count of numbers to be averaged)
return 2


Order of growth :  Θ( n )

related source : SCHAUM’S OUTLINE OF Principles of COMPUTER SCIENCE
related resource : http://www.cs.nott.ac.uk/~nza/G52ADS/lecture2.pdf

Write pseudo code for finding the mean of a set of numbers.

mean( list_of_numbers )
length <-- length of list_of_numbers
index <-- 1
sum <-- 0
while index <= length {
sum <-- sum + list_of_numbers[index]
index <-- index + 1
}
return sum / length

example input :

mean ( 1 2 3 4 )
length <-- 4
index  <-- 1
sum    <-- 0
list_of_numbers[1] = 1
list_of_numbers[2] = 2
list_of_numbers[3] = 3
list_of_numbers[4] = 4

[toggle title="Answer" float="left" width="100px" margin="0 20px 20px 0" status="closed"] 2.5 [/toggle]

source : SCHAUM’S OUTLINE OF Principles of COMPUTER SCIENCE

Inter-School Sports Meet . Long Jump

Dhanu has the longest jump of 3 metres  40 cm.
Gurjeet is second. His jump is 20 cm less than Dhanu's.
Gopi comes third.His jump is only 5 cm less than Gurjeet's jump.

How long are Gurjeet's and Gopi's jumps ?


[toggle title="Gurjeet: Answer" float="left" width="100px" margin="0 20px 20px 0" status="closed"] 3 metres 20 cm[/toggle]


[toggle title="Gopi : Answer" float="left" width="100px" margin="0 20px 20px 0" status="closed"] 3 metres 15 cm[/toggle]



2. Inter-School sports meet . Race

Have you heard about marathon races in which people
have to run about 40 kilometres ? People run marathon 
on roads because the track of the stadium is only 400 metres.

10 rounds of a stadium track = ----- km
[toggle title="Answer" float="left" width="100px" margin="0 20px 20px 0" status="closed"] 4 km[/toggle]

So,if you run a marathon on a stadium track, you will have
to complete ------ rounds!
[toggle title="Answer" float="left" width="100px" margin="0 20px 20px 0" status="closed"]  100 [/toggle]



Inter-School Sports Meet . Race

Have you heard about 1500m or 3000 m race ?
(1000 metres make 1 kilometre and 500 metres make half a kilometre)

So you can say ---

In a 1500 metres race people run ----- km
[toggle title="Answer" float="left" width="100px" margin="0 20px 20px 0" status="closed"] 1.5 km[/toggle]

In a 3000 metres race people run ----- km
[toggle title="Answer" float="left" width="100px" margin="0 20px 20px 0" status="closed"] 3 km[/toggle]

Mental Math: Bhajan Buys Bricks

Bhajan  went  to  buy  bricks.The  price  was  given  one
thousand  bricks.  The  prices  were  also different  for
different types of bricks.

old bricks     - Rs 1200 for one thousand bricks
New bricks from Intapur     - Rs 1800 for one thousand bricks
New bricks from Brikabad    - Rs 2000 for one thousand bricks

Bhajan decided to buy the new bricks from Brickabad.
Heo bought three thousand bricks. How much did he pay ?

[toggle title="Answer" float="left" width="100px" margin="0 20px 20px 0" status="closed"]Rs 6000[/toggle]

Guess what he will pay if he buys 500 old bricks ?
Do this without writing.

[toggle title="Answer" float="left" width="100px" margin="0 20px 20px 0" status="closed"]Rs 600[/toggle]