This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | name: CSC 404 AP6 Problem 1 (Addition) | |
| source code: |+ | |
| # CSC 404 AP6 - Problem 1 | |
| # Add 2 non-negative numbers | |
| # f(n1, n2) = n1 + n2 | |
| # Each integer is represented as n + 1 (for example, 4 is 11111) | |
| input: '11111*111' #4+2 should = 6 (7 1's) | |
| blank: ' ' | |
| start state: q0 | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | name: 'CSC 404 AP2 Problem 2 (String Reversal) ' | |
| source code: | | |
| # CSC 404 AP6 - Problem 2 | |
| # Reverse a bit string | |
| # f(w) = w^R | |
| # Each integer is represented as n + 1 (for example, 4 is 11111) | |
| input: '001010' | |
| blank: ' ' | |
| start state: q0 | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | name: CSC 404 - HW2 - Problem 5 (001) | |
| source code: |- | |
| # CSC 404 HW2 - Problem 5 | |
| # Twice as many zeros! | |
| input: '010100' | |
| #input: '000011010001' | |
| #input: '111000000' | |
| blank: ' ' | |
| start state: q0 | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | name: CSC 404 - HW2 - Problem 8 (mod 3) | |
| source code: | | |
| # CSC 404 HW2 - Problem 5 | |
| # Modulo 3 | |
| # f(n) = n mod 3 | |
| # Each integer is represented as n + 1 ones (for example, 4 is 11111) | |
| input: '11111111' | |
| blank: ' ' | |
| start state: q0 | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | name: CSC 404 - HW2 - Problem 7 (Double n) | |
| source code: |- | |
| # CSC 404 HW2 - Problem 7 | |
| # Doubling Function! | |
| # f(n) = 2n | |
| # Each integer is represented as n + 1 ones (for example, 4 is 11111) | |
| input: '1111' | |
| blank: ' ' | |
| start state: q0 | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | name: CSC 404 - HW2 - Problem 4 (001) | |
| source code: |- | |
| # CSC 404 HW2 - Problem 4 | |
| # 0^(2k)1^k | |
| input: '000011' | |
| #input: '0000111' #Fails on 3rd 1 (Stuck at q0) | |
| blank: ' ' | |
| start state: q0 | |
| table: | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | name: CSC 404 - HW2 - Problem 7c (triple n) | |
| source code: |- | |
| # CSC 404 HW2 - Problem 7c | |
| # Triple Function! | |
| # f(n) = 3n | |
| # Each integer is represented as n + 1 ones (for example, 4 is 11111) | |
| input: '111' | |
| blank: ' ' | |
| start state: q0 | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | name: CSC 404 - HW2 - Problem 7 (Double n) - Take Two | |
| source code: |- | |
| # CSC 404 HW2 - Problem 7 (Soln 2) | |
| # Doubling Function! | |
| # f(n) = 2n | |
| # Each integer is represented as n + 1 ones (for example, 4 is 11111) | |
| input: '1111' | |
| blank: ' ' | |
| start state: q0 | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | name: Even Number of 0s and 1s (Option 1) | |
| source code: |- | |
| # Even Number of 0s and 1s | |
| # Upon seeing a 0 or 1 we then go and seek its 'match' | |
| input: '001101' # try '010110' | |
| #input: '010110' | |
| #input: '111000' | |
| blank: ' ' | |
| start state: seekDigit | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | name: Even Number of 0s and 1s | |
| source code: |- | |
| # Even Number of 0s and 1s | |
| # Find a 0 when reading left to right. Then frind a 1 when reading right to left. Repeat. | |
| input: '0000111' # try '010110' | |
| #input: '010110' | |
| #input: '111000' | |
| blank: ' ' | |
| start state: seek0 | 
OlderNewer