The Goals page describes what students can expect to learn from this course. It’s just as important to think about what the entrance requirements are. The rough guide we’re using is this: if you can solve the two problems below using any programming language at all, you’re ready.
Problem 1: Finding the Largest Zero Neighbor
Write a function that takes a list or array of numbers as input and return the largest number that is adjacent to a zero. For example, if the input is:
[1, 5, 3, 0, 2, 7, 0, 8, 9, 1, 0]
the output is 8.
Problem 2: Reorganizing Files
Write a program that reads in a file containing an NxM array of numbers, transposes the array, and writes the result back to the original file. The numbers in each row are separated by one or more space characters; you don’t know in advance how many rows or columns there are, but you do know that every row is supposed to contain the same number of values. For example, if the original file contains:
1 2 3 4 5 6 7 8
then your program should replace it with:
1 5 2 6 3 7 4 8
[...] @ 12:38 pm Our rough guide to what students should know before taking this course is now on the Prerequisites page. If you don’t feel confident you know this material, but still want to take the course in [...]
Pingback by Entrance Requirements « Software Carpentry — May 12, 2009 @ 1:46 am
I tried to do problem 1 as a quick exercise in MATLAB to test my skills (i’m still a novice) at the end of a long day.
I thought the last number in the vector was 0 (not 10), I think this makes the task more tricky and thought you must be running a tough course if this is the entrance test!
Comment by JA — June 16, 2009 @ 5:46 pm
solved it now, not very tricky just v tired last night
Comment by JA — June 17, 2009 @ 10:29 am