This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: OrderedCollection a2" s1 addAll: a1. "part v: Take all elements and put them in ascending order into s1" s2 := s1 reversed. "part vi: Take all elements in a1 and put them in descending order in s2" 1 to: s1 size do:[:i| s3 add: (s2 at: i) *(s1 at: i)]. "part vii: Sort in ascending order the ith component of s1 with the ith component of s2 and put in s3" "------Part B------" |A B C sum| A := Matrix new: n. "Declare Matrices A and B to be of size n X n" B := Matrix new: n. sum := 0. "Initialize sum to 0" "part i: Computer the matrix A X B" C := B preMultiplyByMatrix: A. "part ii: sum the elements of C, column order, and put them into sum" 1 to: C columnCount do:[:i| 1 to: C rowCount do:[:j| sum := sum + (C at:i at:j)]]....
View Full Document
- Spring '11
- Sort, Nikon Coolpix S2, S6, Nikon Coolpix S3