Grzegorz Bancerek

Paradigms of Programming in O'Caml

Exercises 2: Arrays

Manual: Module: Array
  1. Define the Sieve of Eratosthenes
      let eratosthenes n = ...
    
  2. Define the sum (sigma) of all elements from an array.
  3. Define the collective operation on f-images of all elements from an array.
  4. Define the value of a polynomial at an argument.
  5. Operations on polynomials: addition, multiplication, division.
  6. Multiplication of matrices.
      C.(i).(j) = sum 0 n (fun k -> A.(i).(k)*B.(k).(j))
    
  7. Determinant.
      let det2 A = ...
    
      let rec det (* n = Array.length A *) A = ... uses minors
    
  8. Insertion sort.
  9. Bubble sort.
  10. Selection sort.
  11. Merge sort.
  12. Quick sort.
  13. Heap sort.

bancerek@wi.pb.edu.pl