Emil Bremer Orloff Dyalog’14 Eastbourne, UK. What will this be about ” Emil will describe his...

47
How I won the APL Problem Solving Competition Emil Bremer Orloff Dyalog’14 Eastbourne, UK

Transcript of Emil Bremer Orloff Dyalog’14 Eastbourne, UK. What will this be about ” Emil will describe his...

  • Slide 1
  • Emil Bremer Orloff Dyalog14 Eastbourne, UK
  • Slide 2
  • What will this be about Emil will describe his experiences of Dyalog and tell us how he managed to master enough of it to win the competition.
  • Slide 3
  • What will this be about About me Relation to APL The competition
  • Slide 4
  • About me Studying Computer Science at Aarhus University
  • Slide 5
  • About me Studying Computer Science at Aarhus University
  • Slide 6
  • About me Studying Computer Science at Aarhus University 4 years into my masters degree
  • Slide 7
  • About me Studying Computer Science at Aarhus University 4 years into my masters degree Specialized in Cryptography and programming languages Programming experience in: Java, Ocaml, SML, C, Coq, (Matlab)
  • Slide 8
  • My first encounter with APL
  • Slide 9
  • 2011: my department shared a link to the Dyalog Competition
  • Slide 10
  • My first encounter with APL 2011: my department shared a link to the Dyalog Competition A horrible mess of funny characters!
  • Slide 11
  • My first encounter with APL 2011: my department shared a link to the Dyalog Competition A horrible mess of funny characters! Became interessted due to the nature of the language had to use another approach Didnt have time to learn
  • Slide 12
  • Fastforward 2014 Last chance to compete as a student
  • Slide 13
  • Fastforward 2014 Last chance to compete as a student Legrands book
  • Slide 14
  • The Competition Phase 1 10 problems solved using dfns Here follows a couple of my solutions
  • Slide 15
  • Problem 5 - Mirror Mirror Tell if a given strings is a palidrome
  • Slide 16
  • Problem 5 - Mirror Mirror Tell if a given strings is a palidrome Nave: { }
  • Slide 17
  • Problem 5 - Mirror Mirror Tell if a given strings is a palidrome Nave: { } Unfortunately only letters are relevant
  • Slide 18
  • Problem 5 - Mirror Mirror Tell if a given strings is a palidrome Nave: { } Unfortunately only letters are relevant {{ }( 'abcdefghijklmnopqrs tuvwxyzABCDEFGHIJKLMNOPQRSTUVWX YZ')/ }
  • Slide 19
  • Problem 8- Go the distance Find the distance between two points in n- dimensional space
  • Slide 20
  • Problem 8- Go the distance Find the distance between two points in n- dimensional space {(+/( - )*2)*0.5}
  • Slide 21
  • Part II Consisted of 3 problem sets Each containing 3 parts (easy, medium, hard)
  • Slide 22
  • Part II Consisted of 3 problem sets Each containing 3 parts (easy, medium, hard) Bioinformatics Cryptography Recreation and games
  • Slide 23
  • Part II Consisted of 3 problem sets Each containing 3 parts (easy, medium, hard) Bioinformatics (easy, medium, hard) Cryptography (easy, hard) Recreation and Games (hard)
  • Slide 24
  • Bioinformatics K-mer counting Most frequent k-mers Clump finding Approximate pattern matching Shared k-mers Longest shared substring Shortest non-shared substring Edit distance
  • Slide 25
  • Bioinformatics K-mer counting Most frequent k-mers Clump finding Approximate pattern matching Shared k-mers Longest shared substring Shortest non-shared substring Edit distance
  • Slide 26
  • Bioinformatics K-mer counting Most frequent k-mers Clump finding Approximate pattern matching Shared k-mers Longest shared substring Shortest non-shared substring Edit distance Substringsand
  • Slide 27
  • Substring Created a helper function that could create all substrings of a given length
  • Slide 28
  • Substring Created a helper function that could create all substrings of a given length Create all relevant indexes
  • Slide 29
  • Substring Created a helper function that could create all substrings of a given length Creating all relevant indexes
  • Slide 30
  • Substring Created a helper function that could create all substrings of a given length Creating all relevant indexes Use N-Wise reduce! { > :'' ,/ } Changed shortly before deadline
  • Slide 31
  • Bioinformatics K-mer counting Most frequent k-mers Clump finding Approximate pattern matching Shared k-mers Longest shared substring Shortest non-shared substring Edit distance SubstringsAnd
  • Slide 32
  • Edit distance Given two strings find the minimal edits that brings the first to the second An edit: Insert a character Delete a character
  • Slide 33
  • Edit distance Generate a matrix that gives the editdistance between the substrings
  • Slide 34
  • Edit distance Generate a matrix that gives the editdistance between the substrings manly 012345 m101234 a210123 n321012 y432111
  • Slide 35
  • Edit distance Generate a matrix that gives the editdistance between the substrings manly 012345 m101234 a210123 n321012 y432111 First row and first column are always the same
  • Slide 36
  • Edit distance Each element in table is given by 0+value to NW if the characters match 1+the minimum value to the W, NW or N if the characters does not match
  • Slide 37
  • Edit distance Each element in table is given by 0+value to NW if the characters match 1+the minimum value to the W, NW or N if the characters does not match Which is min(cost+NW, 1+W, 1+N)
  • Slide 38
  • Edit distance firstRow( 1+ t)-1
  • Slide 39
  • Edit distance firstRow( 1+ t)-1 nextRow{ {( +1) }\(1+ ) (1+ ),(1 )+ t }
  • Slide 40
  • Edit distance firstRow( 1+ t)-1 nextRow{ {( +1) }\(1+ ) (1+ ),(1 )+ t } lastRow nextRow/( s), firstRow ed lastRow
  • Slide 41
  • Edit distance firstRow( 1+ t)-1 nextRow{ {( +1) }\(1+ ) (1+ ),(1 )+ t } lastRow nextRow/( s), firstRow ed lastRow
  • Slide 42
  • What was actually delivered
  • Slide 43
  • Cryptography Viginre cipher Book cipher variation Playfair cipher
  • Slide 44
  • Cryptography Viginre cipher Book cipher variation Playfair cipher
  • Slide 45
  • Recreation and Games Word search Scrabble Bridge
  • Slide 46
  • Recreation and Games Word search Scrabble Bridge
  • Slide 47