TOPIC 4.2: DATA STRUCTURES

INTRODUCTION TO DATA STRUCTURES

ALGORITHMS AND PSEUDOCODE

PSEUDOCODE ALGORITHMS

IF..THEN..ELSE..ENDIF

CASE..OF..ENDCASE

FOR..TO..ENDFOR

REPEAT..UNTIL..

WHILE..DO..ENDWHILE

PROCEDURE..ENDPROC

FUNCTION..ENDFUN

DATA TYPES

            A := B/C;   since C is not a real or integer variable

STATIC AND DYNAMIC DATA STRUCTURES

ARRAYS

var
    x : array[1..50] of integer;
   Sales : array[1..12] of Real;

MULTI-DIMENSIONAL ARRAYS

    x : array[0..10] of array [1..6] of integer;

    x : array[0..10, 1..6] of integer;

   Regional_Sales : array[1..12, 1..5] of Real;

RECORD

Name: String;
Sex: Char;
Salary: Real;
Department: Integer;
name address course date_of_birth
Ben Ramsey 17 Elmer Street, Ipswich PD7015 170873
student.name, student.address, etc

FIXED AND VARIABLE LENGTH RECORDS

            - The size of some of the fields coould vary - e.g. a field containing a name or an address.

            - The number of fields could vary. For example, a customer's invoice record could have a filed )or several fields) for each item that he has purchased.

LINKED LIST

USES OF LINKED LIST

STACKS

   
 
 
Mark Top of Stack
Daniel  
Roxanne

USES OF STACKS

Stacks are used in many different situations in computing, for example:

QUEUE

Nigel Marcus Davin      

MaxSize = 6;

After 2 people have left the queue and 3 more have joined, the queue will look like this:

    Davin Jon Ian Georgina

Only 4 people are in the queue but the end of the array has been reached. To overcome this problem, the queue may be implemented as a circular queue, so that when the next person joins she enters at the front of the array:

Bryony   Davin Jon Ian Georgina

USES OF QUEUE

Queues are used in a variety of applications such as:


RESOURCES:

1) P M Heatcote & K R Bond, [A Level Computing], Letts Educational Ltd, 1997.

2) P M Heatcote, [A Level Computing, 3rd Edition], Letts Educational Ltd, 1998.

Hosted by www.Geocities.ws

1