(New page: hello)
 
Line 1: Line 1:
hello
+
Lecture notes_Lecture 20_Mar 20_Kailu Song
 +
1. The explanation of program 2
 +
  a. the square and piece(one piece have several square)
 +
  b. duplicates: rotate the piece will generate another duplicate piece
 +
  c. rotation mirror: horizontal mirror and vertical mirror
 +
  e. invalid piece: there is a space between two square in one row(eg.010 101 010)
 +
  For this assignment, give the number of squares, generate all picecs(delete invalid piece, deplicate piece and mirror piece) using one dimensional array.
 +
2. Hint for this assignment:
 +
  first stage: partition integers:
 +
  ex. 4 = 1+1+1+1
 +
      4 = 1+1+2
 +
      4 = 1+2+1
 +
      4 = 1+3
 +
      4 = 2+2...
 +
  Use recursion
 +
  void f(int n)
 +
  {
 +
    int i;
 +
    if (n==0)
 +
      {
 +
          return;
 +
      }
 +
      if (i=1;i<n;i++)
 +
      {
 +
        f(n-i);
 +
      }
 +
  }

Revision as of 03:34, 20 March 2012

Lecture notes_Lecture 20_Mar 20_Kailu Song 1. The explanation of program 2

  a. the square and piece(one piece have several square)
  b. duplicates: rotate the piece will generate another duplicate piece
  c. rotation mirror: horizontal mirror and vertical mirror
  e. invalid piece: there is a space between two square in one row(eg.010 101 010)
  For this assignment, give the number of squares, generate all picecs(delete invalid piece, deplicate piece and mirror piece) using one dimensional array.

2. Hint for this assignment:

  first stage: partition integers:
  ex. 4 = 1+1+1+1
      4 = 1+1+2
      4 = 1+2+1
      4 = 1+3
      4 = 2+2...
  Use recursion
  void f(int n)
  {
    int i;
    if (n==0)
      {
          return;
      }
     if (i=1;i<n;i++)
      {
        f(n-i);
      }
  }

Alumni Liaison

To all math majors: "Mathematics is a wonderfully rich subject."

Dr. Paul Garrett