algorithms

Subdecks (2)

Cards (87)

  • This module is about computational problems and the algorithms needed to solve them
  • We're going to talk about designing and analysing algorithms
  • Abstraction
    • To help us analyse the computational cost of algorithms (the complexity)
    • To describe formal languages
  • We will be exercising program structures you already know (assignment, conditionals, loops, method calls, variables and arrays)
  • Algorithms
    Designing general methods for solving problems
  • We will be thinking about some of the ethical and possibly adverse implications of algorithms in the real world
  • Assessment
    • A programming coursework which is worth 50% of the final mark
    • An invigilated question session which is worth 50% of the final mark
  • Getting help
    • Come along to your practical session and ask in person
    • Moodle discussion forum
    • Jerry's office hours
    • Email the teaching staff
  • Learning goals
    • Explain the workings of standard algorithms
    • Analyse the complexity of algorithms
    • Select appropriate algorithms for particular practical situations
    • Design algorithms and describe them using plain English or pseudocode
    • Describe formal languages using regular expressions and context free grammars
    • Relate regular expressions to finite state automata
  • How to achieve the learning goals
    • Work continuously
    • Attend the lectures
    • Go to the tutorials and do the exercises
    • Program the algorithms yourself
    • Read the literature
  • The module is designed to require a total of 150 hours of study, there are 30 hours on the timetable, leaving you with 120 hours to timetable yourself
  • Go to every lecture, and try every single tutorial question. It's a subject where you have to try it out for yourself to become good at it
  • Materials
    • Lecture notes, with exercises at the end
    • Solutions will be made available in the following week
    • No required textbook, but some recommended books available from the University library
  • Schedule
    • Introduction
    • Introducing complexity: iterative algorithms
    • Simple sorting methods
    • Exponential and logarithmic complexity
    • Recursive algorithms
    • Divide-and-conquer sorting
    • The limits of algorithms
    • Regular languages and finite state automata
    • Context-free grammars
    • Revision
  • Why do we care? This session is about introducing algorithms, describing algorithms using pseudocode, and introducing some of the problems we'll consider, with a peek ahead at analysis of cost (which computer scientists call complexity)
  • Algorithm
    Any well-defined computational procedure that takes some value, or set of values, as input and produces some value, or set of values, as output. An algorithm is thus a sequence of computational steps that transform the input into the output.
  • The word "algorithm" comes from a Latin version of the name of a 9th-century Persian mathematician, Abū ʿAbdallāh Muḥammad ibn Mūsā al-Khwārizmī. Ada Lovelace is attributed with writing and publishing the first algorithm ever specifically tailored for implementation on a computer - in the 19th Century.
  • Algorithm definition
    An exact prescription, defining a computational process, leading from various initial data to the desired result
  • Features of an algorithm
    • Exact prescription
    • Computational process
    • Initial data
    • Result
  • Several algorithms might exist to solve the same problem
  • Ways to describe an algorithm
    • Unstructured text
    • Structured text
    • Pseudocode
    • Java code
  • Pseudocode
    Abstracts away from specific programming languages, describes sequential computations, has less syntactic noise than typical languages, indicates structure using indentation, often uses left arrow for assignment, avoids many of the finer details of a programming language, without sacrificing precision
  • You are expected to be able to read (and write) algorithms in pseudocode, and to translate them to both English and programming languages (e.g. Java)
  • Tracing an iterative algorithm is an important part of this module, to gain a solid grasp of control structures like loops
  • Types of computation problems
    • Searching
    • Sorting
    • Text processing
    • Numerical operations
    • Computational geometry
    • Combinatorial problems
  • Types of problems
    • Decision problems
    • Search problems
    • Optimization problems
  • Sorting is a common problem, and often a component in larger algorithms
  • Selection Sort and Insertion Sort are two basic sorting algorithms that will be covered in the module
  • When analysing markets, a range of assumptions are made about the rationality of economic agents involved in the transactions
  • The Wealth of Nations was written
    1776
  • Rational
    (in classical economic theory) economic agents are able to consider the outcome of their choices and recognise the net benefits of each one
  • Rational agents will select the choice which presents the highest benefits
  • Consumers act rationally by

    Maximising their utility
  • Producers act rationally by

    Selling goods/services in a way that maximises their profits
  • Workers act rationally by

    Balancing welfare at work with consideration of both pay and benefits
  • Governments act rationally by

    Placing the interests of the people they serve first in order to maximise their welfare
  • Rationality in classical economic theory is a flawed assumption as people usually don't act rationally
  • A firm increases advertising
    Demand curve shifts right
  • Demand curve shifting right
    Increases the equilibrium price and quantity
  • Marginal utility

    The additional utility (satisfaction) gained from the consumption of an additional product