Line 33: Line 33:
  
 
for n = 3
 
for n = 3
<nowiki>
+
 
 
x _ _
 
x _ _
 +
 
x _ _
 
x _ _
 +
 
x _ _
 
x _ _
  
Line 50: Line 52:
 
_ _ _
 
_ _ _
 
_ _ _
 
_ _ _
</nowiki>
 
  
  

Revision as of 02:55, 21 March 2012

March 21, 2012 - Tej Rajendran

Comfortable topics -Recursion -File Management -Structures

Upcoming Topics -Dynamic Memory -Data Structures -Linked Lists -Binary Trees

IPA2-1

Rules for blocks - arrangement cant have holes - no diagonal blocks

ELIMINATE ROTATIONS/ MIRRORS/ TRANSLATIONS

-Store in a 2D array

Integer Partitions

n = 3

1,1,1 2,1 1,2 3

  • Useful for generation of tetris pieces b/c given number of blocks in each piece, helps
 determine how many blocks in each row (use as a budget)

for n = 3

x _ _

x _ _

x _ _


x x _ x _ _ _ _ _

x _ _ x x _ _ _ _

x x x _ _ _ _ _ _


n = 4

1 * * *-> 1 ** -> 1 * -> 1

         		-> 2

-> 2 * -> 1 -> 3


Code for generation of Integer Partitions

void intPart(int budget, int pos, int *data) { int i;

//Base case: no more budget if(budget == 0) { //print the partition return; }

//Recursive case: figure out how to spend the budget for ( i = 1; i< budget; i ++) { data [pos] = i; intPart( budget-1, pos +1, data); }


}

Alumni Liaison

Ph.D. 2007, working on developing cool imaging technologies for digital cameras, camera phones, and video surveillance cameras.

Buyue Zhang