Presentation is loading. Please wait.

Presentation is loading. Please wait.

Algorithms and Data types: Introduction Dr. Andrew Wallace PhD BEng(hons) EurIng

Similar presentations


Presentation on theme: "Algorithms and Data types: Introduction Dr. Andrew Wallace PhD BEng(hons) EurIng"— Presentation transcript:

1 Algorithms and Data types: Introduction Dr. Andrew Wallace PhD BEng(hons) EurIng

2 Overview Algorithms Data types Program design Writing code Testing code

3 Algorithms What is an algorithm? Set of instructions for calculating / doing something. Examples Sorting Path finding Item finding Controlling

4 Algorithms History Abū ʿ Abdallāh Mu ḥ ammad ibn Mūsā al-Khwārizmī Brahmagupta 0628 Algoritmi de numero Indorum. Anthyphairesis Euclidean algorithm Euclid's Elements Gottfried Wilhelm von Leibniz Calculus ratiocinator 1680 Augusta Ada King, Countess of Lovelace 19 th Cent.

5 Algorithms Time and space complexity Analysis Pseudocode Design

6 Data Types What is a data type? A way of classifying pieces of information Useful for computers Examples Primitive Integers, reals, boolean(?) Composite Arrays, struct, unions Abstract Stacks, queues, heaps, trees

7 Data Types Integers int nVar; short intnVar; long intlVar; unsigned intlVar; intnArray[nSize];

8 Data Types Floats / doubles floatfVar; doubledVar; long doubledVar;

9 Data Types Char charcVar; signed charcVar; charstrArray[nSize];

10 Data Types Void void*pVar;

11 Program design The ideal way: Customer specification Program / top level specification Top level design Low level design Implementation

12 Program design Customer specification From the users point of view What to do but not how Program / top level specification Technical What to do but not how!!!

13 Program design Top level design Modelling the system What data? What functions / methods? How to solve the problem?

14 Program design Top level design Structured Analysis / Structured design Data flow Object orientated Encapsulation Agents design Task orientated

15 Program design Low level design Function design KISS Does one thing! Algorithm design Pseudocode

16 Program design Program boundary Program Input Output check function

17 Program design int function (n) check n if error return error else do something clever return 0

18 Program design int function (n) ASSERT(n) do something clever return 0

19 Writing code Hungarian notation Block structure

20 Writing code n – integer nVar l – long lVar f – floatfVar d – doubledVar b – BooleanbVar m_- memberm_nVar o – ObjectoVar fp, i, j

21 Writing code Blocks { } Indentation if … else while.. for …

22 Testing code Does it meet the requirements? Time constraints Space constraints Does it work (bugs?) Usability

23 Testing code Block / function test Assembly / integration test Customer / validation testing function Assembly system

24 Testing code Static Asymptotic analysis Logical proof checking Dynamic Running the code debugger

25 Testing code Debugging Break points Check variables Change variables Jump in and out of code Step through code Look at the memory

26 Questions?


Download ppt "Algorithms and Data types: Introduction Dr. Andrew Wallace PhD BEng(hons) EurIng"

Similar presentations


Ads by Google