Viewing algorithms as iterative systems and plotting their dynamic behaviour Venkatesh Choppella , K. Viswanath and P. Manjula Software Engineering Research Centre International Institute of Information Technology - Hyderabad, Hyderabad, India Email: venkatesh.choppella@iiit.ac.in; viswanath.iiithyd@gmail.com; manjula.p@research.iiit.ac.in Abstract—We revive an old but little explored idea about how to think about algorithms and problem solving. Algorithms are discrete dynamical systems, also called iterative systems. Pursuing this point of view pays rich dividends. Important concepts like state space, next-state function, termination, fixed points, invariants, traces etc., can be mapped from dynamical systems to elements of algorithm design. Many of these concepts can be visualised through plots that trace the dynamic behaviour of the algorithm. Keywords-Algorithms, Programming, Dynamics, Computer Science Education, Engineering Education I. I NTRODUCTION Students have a brush with algorithms informally in their first programming course. Then, they learn how to design and analyse them in their data structures and algorithms course. As is evident from the curricula recommendations by ACM and IEEE[1] and the All India Council for Technical Education (AICTE) [2], introductory programming courses focus on the use of algorithms and algorithmic patterns (recursion, iteration, etc.) while courses on algorithm and data structures present problem solving and time and space complexity. The formal notion of an algorithm and its precise connection with problem solving is rarely presented. Even well respected textbooks begin by describing algo- rithms informally as a “sequence of computational steps that transform input to output”[3], or as procedures that are “pre- cise, unambiguous, mechanical, efficient and correct.”[4]. This description is unsatisfactory to the beginning computer science student, because it does not give the student a clear, general structure on how to construct an algorithm to solve a problem and verify that the construction is sound. This paper starts with the premise that algorithms are iterative systems, also called discrete dynamical systems. The subject of dynamics is age-old in physics. Dynamical systems form the basis of studying various natural and artificial phenomena (atmosphere, biology, economics, fi- nance, etc.). The idea of dynamics is pervasive and it is natural to ask the question of how dynamical systems relate to computing. This question is an old one. As early as 1968, Knuth introduced a formal notion of a “computational method” in his celebrated Art of Computer Programming ([5], Section 2.2). Although he did not use the term discrete dynamical systems, his computational method is essentially identical to it. Surprisingly, the connection was not explored further in his book or elsewhere. Only much later, in 2008, discrete dynamical systems and the Mapcode method were suggested as a unifying approach to study algorithmic problem solving[6]. As far as we know, few professional or academic bodies suggest approaching the subject of algorithms and problem solving through dynamical systems in their curriculum recommendations 1 . II. I TERATIVE SYSTEMS An iterative system is a set along with a next state function on it. Many systems in science and engineering are modeled as iterative systems. Iteration is a universal concept in nature. Evolution is an iterative process with the purpose of survival and adaption to environment. Nature’s fractal geometry (clouds, coastlines, mountains, ferns) re- veals itself best when understood as an iterative system. Continuous dynamical systems in science and engineering can be approximated by iterative systems. Students begin the study of simple dynamical systems in their high school and continue studying them through undergraduate courses in mathematics, physics and mechanics. Iteration is also pervasive in programming and computer science. Iteration is a core concept in computing and is classified as one of the threshold concepts in Computer Science[7]. Students first see iteration through while loops in their programming class. Yet iteration does not come naturally to them[8]. Wing[9] has underscored that com- putational thinking — of which iteration is an important pillar — should involve conceptualising, not just coding and learning the syntax of a language. Students of functional programming are taught that iteration is a special form of recursion called tail recursion. Many important algorithms (searching, sorting, numerical) are specified via iteration. In computer engineering, compilers and architectures are opti- mised to make iteration run as fast as possible. Engineering students write converging iterative loops to simulate and solve differential equations. How can algorithmic problem solving be viewed as constructing iterative systems and visualising their dynamic behaviour? In the rest of this paper we explore this question. The idea of an iterative system is simple and easily accessible to someone with equipped with high school level 1 Dynamical systems should not to be confused with dynamic program- ming, a popular topic in algorithms. 2013 IEEE Fifth International Conference on Technology for Education 978-0-7695-5141-8/13 $31.00 © 2013 IEEE DOI 10.1109/T4E.2013.56 206