[Year 12 SofDev] Teaching Algorithms

Mark mark at vceit.com
Thu Feb 4 12:44:58 AEDT 2016


What about a set of increasing-complex scenarios?

Imagine a set of traffic lights at a crossroad.

1. Write a strategy to give 70% of green light time to the north/south road
and 30% to the east/west road.
2. Add logic that changes the green-light times to 60/40 in off-peak times
(not 7-10am or 3-7pm)
3. Add additional lights for left/right arrows. Add the logical capacity
for the pedestrian crossing buttons to affect these lights so
button-pushing pedestrians don't get squashed by traffic.
4. Near the intersection, an ambulance station is built and they want to be
able to set all of the lights in the intersection to red when an ambulance
has to race out. Add that logic.
5. On Christmas day, the lights should randomly blink festive
green/amber/red sequences like jolly christmas trees. This should create
enough carnage to test the logic in point 4 quite nicely.

Then there's the Sensorlight algorithm I posted (somewhere) several
generations ago: Write the logic to control a sensorlight that turns on for
10 seconds if it detects movement, but only when it's dark. If further
movement is detected while the light is on, the light's countdown is reset
to 10 seconds.
You could go on to add extra sensors - e.g. don't turn on the light if the
movement is made by a cat-sized object etc.

Further fun with algorithms:

Fun #1 - round a shopping total up or down to the nearest 5 cents.



Fun #2 -  Convert any Roman number to decimal (e.g. MCMLXIX to 1969) -
and/or vice versa



Fun #3 - find the lowest (or greatest) common denominator of 2 integers (or
report that there is no LCD or GCD).



Fun #4 - list prime numbers up to 100



Fun #5 - simulate the display of a single-digit liquid crystal display

Assume there are 7 LCD bars like this

 _

|_|

|_|



Feed it any numeral or alphabetic character  in hexadecimal range (0 to F)
and it should turn on the right bars.



Fun #6 - given a price including 10% GST, give the ex-tax price and the tax
component, e.g. $11 inc = $10 ex + $1 GST.



Fun #7 - create a virtual deck of cards encoded as numbers 1 to 52.  Given
any number from 1 to 52, the algorithm should return the suit and
represented by the card.



Fun #8 - create an algorithm to shuffle the virtual deck of cards



Fun #9 - create an algorithm to play naughts and crosses - it should be
unbeatable if the algorithm plays first.



Fun #10 – given an number of dollars, calculate what minimum number of
notes or coins need to be given as change from $100.  e.g. $67 = 1 x $20, 1
x $10, 1 x $2, 1 x $1.



Fun #11 – convert any number to binary.


Fun #12 - determine if a year is a leap year or not.


Fun #13 - create logic that proves that F3[u][x] takes (asymptotically) the
expected number of irreducible values when x runs over polynomials in F3[u]
of odd degree, but it appears to take (asymptotically) twice as many
irreducible values as expected when x runs over polynomials of degree that
is 2 mod 4, while it (provably) takes no irreducible values at all when x
runs over nonconstant polynomials with degree that is a multiple of 4.


Warning: #11 is challenging.


Mark


On 4 February 2016 at 12:04, Baas, Benjamin B <
baas.benjamin.b at edumail.vic.gov.au> wrote:

> Hi Mark,
>
>
>
> Creating the logic. Well anything that will help students to think like a
> computer.
>
>
>
> Cheers,
>
>
>
> Ben.
>
>
>
> *From:* sofdev-bounces at edulists.com.au [mailto:
> sofdev-bounces at edulists.com.au] *On Behalf Of *Mark
> *Sent:* Thursday, 4 February 2016 11:49 AM
> *To:* Year 12 Software Development Teachers' Mailing List <
> sofdev at edulists.com.au>
> *Subject:* Re: [Year 12 SofDev] Teaching Algorithms
>
>
>
> Hi Benjamin
>
>
>
> Do you mean writing pseudocode, or actually creating the logic of an
> algorithm?
>
>
>
> M
>
>
>
> On 4 February 2016 at 10:56, Baas, Benjamin B <
> baas.benjamin.b at edumail.vic.gov.au> wrote:
>
> Hi all,
>
>
>
> Does anyone have any resources on creating algorithms. I have some
> students that are having difficulty breaking down a task/problem.
>
>
>
> Cheers,
>
>
>
> Ben.
>
>
>
> *Benjamin Baas*
>
> [image: Description: cid:image001.png at 01C9CA67.50F474D0]* Alkira
> Secondary College*
>
> +   *Nurture Ave, Cranbourne North | PO Box 4314, Narre Warren South 3805*
>
> '  * +61 3 5991 3500 <%2B61%203%205991%203500>      *6 *+61 3 5991 3599
> <%2B61%203%205991%203599>     *8 *www.alkirasecondarycollege.com.au*
> <http://www.alkirasecondarycollege.com.au/>
>
> *Alkira Secondary College believes in **Personalised** learning for all,
> and  **Respect** for the individual*
>
>
>
>
> --
>
>
>
> Mark Kelly
>
>
>
> mark at vceit.com
>
> http://vceit.com
>
> --
>

Mark Kelly

mark at vceit.com
http://vceit.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.edulists.com.au/pipermail/sofdev/attachments/20160204/a854b95b/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 1700 bytes
Desc: not available
Url : http://www.edulists.com.au/pipermail/sofdev/attachments/20160204/a854b95b/image001-0001.png 


More information about the sofdev mailing list