March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class StatusStatus –Survey –Returning homework ArraysArrays –What are they? –Declaring them –Initializing them –Working with them
March R. Smith - University of St Thomas - Minnesota Arrays Variables and egg cartonsVariables and egg cartons Arrays as sets of variablesArrays as sets of variables –All the same type What are they for?What are they for? –any time you’re collecting a lot of data items –Sorting, analyzing, comparing, aggregating
March R. Smith - University of St Thomas - Minnesota Talking about arrays How do we ‘declare’ an arrayHow do we ‘declare’ an array –What do we need to specify? –Size matters How do we select individual elements?How do we select individual elements? What’s the difference between using an array element and a ‘normal’ variable?What’s the difference between using an array element and a ‘normal’ variable?
March R. Smith - University of St Thomas - Minnesota Initializing an array What if we refer to an elementWhat if we refer to an element –and it hasn’t been initialized? –How does this compare to “normal” (primitive) variables? Initializing with statementsInitializing with statements Initializing during declarationInitializing during declaration –Example “sum”
March R. Smith - University of St Thomas - Minnesota Fibonacci example Create an arrayCreate an array Fill with the Fibonacci sequenceFill with the Fibonacci sequence Calculate the Golden SectionCalculate the Golden Section
March R. Smith - University of St Thomas - Minnesota Creative Commons License This work is licensed under the Creative Commons Attribution-Share Alike 3.0 United States License. To view a copy of this license, visit sa/3.0/us/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.