String Processing Algorithms

Algorithms and machine learning
Advanced studies
Basic algorithms and data structures for string processing: exact and approximate string matching, string sorting, dictionary data structures, text indexing.


18.12.2015 09.00 A111
Year Semester Date Period Language In charge
2015 autumn 27.10-10.12. 2-2 English Juha Kärkkäinen


Time Room Lecturer Date
Tue 12-14 B222 Juha Kärkkäinen 27.10.2015-10.12.2015
Thu 12-14 B222 Juha Kärkkäinen 27.10.2015-10.12.2015

Exercise groups

Group: 1
Time Room Instructor Date Observe
Tue 10-12 B222 Juha Kärkkäinen 26.10.2015—11.12.2015
Group: 2
Time Room Instructor Date Observe
Tue 14-16 C222 Juha Kärkkäinen 26.10.2015—11.12.2015

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


COURSE EXAM 18.12.2015

  • Solutions and scoring
  • You can see your exam papers and get feedback on Wed 20.01.2015 at 13:45-14:15 in room B214 (or contact the lecturer for another time).
  • Your feedback on improving the course is greatly appreciated. Please use this anonymous feedback form.

RENEWAL EXAM 05.02.2016

  • Solutions
  • The grade is based on max ( exam_points, exam_points/1.2 + exercise_points ).
  • Please contact the lecturer to see your exam papers and get feedback.


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.


Completing the course

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 5.11., Thu 19.11., Thu 26.11. and Thu 10.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.

Exercises: Tue 10-12 in B222 and Tue 14-16 in C222. Note: The first exercises will take place on the first week before the first lecture.

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 18.12.2015 at 09:00 in A111

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.

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.

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.

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


Literature and material

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 27.10.

Thu 29.10.

  • 12-14: Lecture 2: Slides (2x4 format)
    • Longest common prefixes, string sorting, string quicksort, radix sort


Tue 03.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 05.11.


Tue 10.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 12.11.


Tue 17.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 19.11.


Tue 24.11.

Thu 26.11.


Tue 1.12.

Thu 3.12.

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


Tue 8.12.

Thu 10.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