Structured Problem Solving - PowerPoint PPT Presentation

1 / 26
About This Presentation
Title:

Structured Problem Solving

Description:

What we shall do in this part of the course. Concept of a data structure ... Volkswagen is Manufacturers[2] 17. www.hope.ac.uk Deanery of Business & Computer Sciences ... – PowerPoint PPT presentation

Number of Views:216
Avg rating:3.0/5.0
Slides: 27
Provided by: BrianFa8
Category:

less

Transcript and Presenter's Notes

Title: Structured Problem Solving


1
Structured Problem Solving
  • Data Structures 1

2
What we shall do in this part of the course
  • Concept of a data structure
  • Examples of data structures
  • records
  • arrays
  • sequences (lists, queues, stacks)

3
An example of a data structure
  • Set of record cards containing quiz league details

4
Where is the structure in this?
  • The information is organised in a logical way
  • One card for each team
  • Same 4 pieces of information for each team
  • Each piece of information made up of words and
    numbers
  • Each word made up of letters
  • Each number made up of digits

5
A question
  • The simplest level of data structure in the
    English Football League is the player. What
    levels of data structure can you identify?
  • divisions forming the Football League
  • teams forming a division
  • players forming a team
  • individual players

6
Important point
  • There is a difference between a data structure
    and the data stored in it
  • In the quiz team example the data structure
  • Box for the cards
  • Blank cards with lines drawn in to hold the 4
    items of information

7
Data types
Black Arrows
The Red Lion
West Road, Bolton
0204 3521345
Monday
  • Each part of the card holds a particular type of
    information

8
This modules data structures
  • records
  • arrays
  • sequences (lists, queues, stacks)

9
Records Chapter 3
  • A record is a collection of different data types
  • All other data structures we shall meet on this
    module are collections of items of the same data
    type

10
Record structure
  • Each piece of information is a field
  • For each field we need to know
  • its identifier or label
  • the type of information it can contain

11
Quiz team record structure
  • No two fields can have the same label
  • Fields do not have to be text

12
  • Text fields name, nationality, date of birth,
    sex, ID number
  • Image field
  • Could also have, for example,
  • audio field(voice print)
  • fingerprint field

13
Representing a record as a row of fields
14
Arrays and Tables Chapter 4
  • An array consists of a fixed number of data
    items.
  • Each item is known as an element
  • Each element is of the same type
  • Each element is associated with a unique number
    called an index

15
Array example
  • Index range is 1..4
  • Each element is a name

16
Identifying an array element
  • Ford is Manufacturers1
  • Volkswagen is Manufacturers2

17
Describing an array completely
  • The index for the array Manufacturers lies in the
    range 1..4
  • The elements are of type Name.

18
Quick question
  • What is the value of Manufacturers3 ?

19
Another example
  • What are the contents of the element in the array
    PlayOffTeams which has index 3 ?
  • What is the value of PlayOffTeams2 ?

20
Example
  • Describe completely the structure of the array
    PlayOffTeams.

21
Example
  • The index for the array PlayOffTeams lies in the
    range 1..4
  • The elements are of type Name

22
Multi-dimensional arrays
  • How do we store a table like this?

23
Multi-dimensional arrays
  • Use two index numbers
  • First identifies the item number
  • Second identifies which shop

24
Multi-dimensional arrays
  • E.g. 37 is Prices2,3
  • What price is stored in Prices1,4?
  • 61

25
Multi-dimensional arrays
  • Description of Prices array in a data table

26
4 dimension array example
  • Seat bookings
  • The first index number is in range 1..30 and
    denotes the seat number
  • The second index number is in range 1..20 and
    denotes the row number
  • The third index number is in range 1..3 and
    denotes the performance number
  • The fourth index number is in range 19..23 and
    denotes the date of the performance in January.
  • What does Bookings5,7,3,21 represent?
  • Seat 5 on 7 row 7 at 3rd performance on 21st
    January
Write a Comment
User Comments (0)
About PowerShow.com