String Processing Algorithms

Algoritmit ja koneoppiminen
Syventävät opinnot
Basic algorithms and data structures for string processing: exact and approximate string matching, string sorting, dictionary data structures, text indexing.


19.12.2016 14.00 B123
Vuosi Lukukausi Päivämäärä Periodi Kieli Vastuuhenkilö
2016 syksy 01.11-15.12. 2-2 Englanti Juha Kärkkäinen


Aika Huone Luennoija Päivämäärä
Ti 12-14 B222 Juha Kärkkäinen 01.11.2016-15.12.2016
To 12-14 B222 Juha Kärkkäinen 01.11.2016-15.12.2016


Group: 1
Aika Huone Ohjaaja Päivämäärä Huomioitavaa
Ti 10-12 C222 Jarno Alanko 31.10.2016—16.12.2016
Group: 2
Aika Huone Ohjaaja Päivämäärä Huomioitavaa
Ti 14-16 D123 Jarno Alanko 31.10.2016—02.12.2016
Ti 14-16 C123 Jarno Alanko 13.12.2016—13.12.2016

Registration for this course starts on Tuesday 4th of October at 9.00.



The course introduces basic algorithms and data structures for string processing including: exact and approximate string matching, string sorting, dictionary data structures and text indexing.

The course is one of the elective courses on the subprogram of Algorithms, Data Analytics and Machine Learning and its predecessor Algorithms and Machine Learning.

The course is also useful for students in the Algorithmic Bioinformatics subprogram (and its predecessor Master's degree program for Bioinformatics), particularly for those interested in biological sequence analysis.

The students are expected to have basic knowledge on algorithms, data structures, finite automata and algorithm analysis. Recommened prerequisite courses are Data Structures, Models of Computation, and Design and Analysis of Algorithms.

The course is followed by Project in String Processing Algorithms in period III.

Kurssin suorittaminen

The course consists of lectures, study groups, exercises and an exam.

Lectures: Tue and Thu 12-14 in B222 (except when replaced by a study group meeting).

Attending lectures is not obligatory but it is useful. Lecture notes covering key facts will be posted on this page, but there will be additional examples and explanations during the lectures.

Study groups: Four lectures are replaced by a study group: Thu 10.11., Thu 24.11., Thu 01.12., and Thu 15.12.

The students read some material in advance and then discuss the material in groups during the meeting. Attending the study group meetings is mandatory. If you cannot attend, please contact the lecturer as soon as possible for a replacement assignment.

Exercises: Tue 10-12 in C222 and Tue 14-16 in D123.

Exercise problems will be available on this page about a week before each exercise session. Model solutions will be available after the exercise session.

The students should solve the problems at home and be prepared to present their solutions at the exercise session. The students are not required to solve all problems, but additional points are awarded according to how many problems have been solved:

  • 7/35 marked problems is required and gives 1 point.
  • 30/35 marked problems gives the maximum of 10 points.


Course exam Mon 19.12. at 14:00 (tentative, check later)

The exam covers the lectures and the exercises. There will be no questions on the study group material. See last year's course for examples of exam problems.

The exam lasts 2.5 hours. No notes or other material is allowed in the exam.

The grading is based on the sum of the points from the exercises (max. 10 points) and the exam (max. 50 points).

  • 30 points is required to pass and gives the lowest grade 1.
  • 50 points or more gives the highest grade 5.

Renewal Exam

The renewal exam requires participation to the course and can be taken only if eligible for the course exam:

  • Participation to all four study groups during the course (or completion of the replacement assignments).
  • At least 7 solved exercise problems.

The renewal exam covers the same material as the course exam (lectures and exercise but not study groups). The exercise points (max. 10) will be added to the exam score when determining the grade.

The renewal exam is organized together with a separate exam and there will be a joint question paper with four joint questions, one question for renewal exam only and one question for separate exam only. The question for separate exam only is about the study group material.

Separate exams

The separate exams do not require course participation and the grade is based on the exam score only.

The separate exams cover lectures, exercises and study groups.

To prepare for the separate exam study group question:

  • For each of the four study group assignments, choose one of the groups.
  • Read the material assigned to the groups you chose.
  • Prepare to answer questions related to the main discussion topics assigned to your chosen groups.

The first separate exam is organized together with a renewal exam and have a joint question paper with four joint questions, one question for renewal exam only and one question for separate exam only. The question for separate exam only is about the study group material.

For an example question, see last year's exam.


Kirjallisuus ja materiaali

All essential content can be found in the lecture notes and other material that will be posted here during the course.

The course will be similar (but not necessarily identical) to last year's course.


Tue 01.11.

Thu 03.11.

  • 12-14: Lecture 2: Slides (2x4 format) Edit: Fix labels of proofs (slides 35 and 41).
    • Longest common prefixes, string sorting, string quicksort, radix sort


Tue 08.11.

  • 10-12 and 14-16: Exercises 2: Problems
  • 12-14: Lecture 3: Slides (2x4 format)
    • Lcp-comparisons, string mergesort, string binary search, Karp-Rabin hashing/fingerprints

Thu 10.11.

  • 12-14: Study Group 1: Assignments
    • Please contact the lecturer if your name is not mentioned in the assignments.


Tue 15.11.

  • 10-12 and 14-16: Exercises 3: Problems
  • 12-14: Lecture 4: Slides (2x4 format)
    • Exact string matching, (Knuth-)Morris-Pratt, Shift-And, Karp-Rabin, Horspool

Thu 17.11.


Tue 22.11.

  • 10-12 and 14-16: Exercises 4: Problems
  • 12-14: Lecture 6: Slides (2x4 format)
    • Edit distance, dynamic programming, approximate string matching, Ukkonen's cut-off algorithm

Thu 24.11.


Tue 29.11.

Thu 01.12.


Wed 07.12.

  • 10-12 (DK112) and 14-16 (B222): Exercises 6: Problems
  • 12-14: Lecture 8 (D112): Slides (2x4 format)
    • Suffix tree, McCreight's algorithm, applications of suffix trees

Thu 08.12.

  • 12-14: Lecture 9: Slides (2x4 format)
    • Suffix array, LCP array, applications of suffix array, BWT, backward search


Tue 13.12.

Thu 15.12.

The course does not follow any book. The books and articles below can be useful supplementary material but are not required reading (except when a part of a study group assignment).


  • M. Crochemore, C. Hancart and T. Lecroq. Algorithms on Strings. Cambridge University Press, 2007.
  • M. Crochemore and W. Rytter. Jewels of Stringology. World Scientific Publishing, 2002.
  • D. Gusfield. Algorithms on Strings, Trees and Sequences: Computer Science and Computational Biology. Cambridge University Press, 1997.
  • E. Ohlebusch. Bioinformatics Algorithms: Sequence Analysis, Genome Rearrangements, and Phylogenetic Reconstruction, 2013.
  • V. Mäkinen, D. Belazzougui, F. Cunial and A. I. Tomescu: Genome-Scale Algorithm Design: Biological Sequence Analysis in the Era of High-Throughput Sequencing. Cambridge University Press, 2015.
  • G. Navarro and M. Raffinot. Flexible Pattern Matching in Strings. Cambridge University Press, 2002.
  • B. Smyth. Computing Patterns in Strings. Addison Wesley, 2003.

Survey articles