Make your own free website on Tripod.com
HOMEWORK 4
Group Members: Mei Fun Wong, Meng Yi Yee and Carrie Neer

Arrays

Arrays are consecutive group of memory locations that all have the same name and the same type. To refer to a particular element in the array of location, we specif y the name and the position number in the array.

Attribute:

Array Name
Element Type
Index Type
Array Base Address
Array Size
Operations
Initialization
Example: int value[100]
Data Update
Example: value[50] = 300
Data Access
Example: y = value[30]
 
Multidimensional Arrays

A multidimensional array with dimension of n is a single dimension array with each element having n-1 dimensional array.

Attribute

Array Name
Element Type
Index Type
Index Lower Bound
Index Upper Bound
Array Base Address
Operations
Initialization
Example: float grades[2] [3]
Data Update
Example: float grade [1][3] = 80
Data Access
Example: z = grade [2][3]

Slices

Slices are substructure of an array.

Attribute

Slice Name
Element Type
Slice Range
Operations
Specifying position
Example: string alphabet(10) = ‘j’
Specifying range of positions
Example: string alphabet(20...23) = ‘tuvw’
Assign to compatible slice
Example: response(1..4) := "FRED";

Records

A record, like an array, is a data structure for storing related items where elements are identified by their file name.

Attributes

Record Name
Field_1 Name
Field_1 Type
Field_1 Offset
…
Field_n Name
Field_n Type
Field_n Offset
Record Base Address
Operations
Data Access
Example: y = student.grade (where grade is a field of type float in student record)
Data Update
Example: student.grade = z;
 
Lists

Attributes

List Name
List Element Type
List Size
List Base Address
Operations
List creation and deletion
List Initialization
List comparison
Character Strings

A character string is a sequence of characters. It is exactly the same as an array of characters.

Attribute

String Name
Maximum Length
String Element Type
String Base Address
Operations
Initialization
Example: char name[4] = "Joe";
Data Access
Example: y = name[7];
Data Update
Example: name[8] = John;
String copy, compare, concatenate and other applicable string command
Example: strcpy(target, source), strcmp(string1, string2), strcat(string1[index], string2[index]) and etc.
Pointers

Pointers are variables that contain memory addresses as their values.

Attributes

Pointer Name
Pointer Type
Operations
Referencing
Example: t = &p
Dereferencing
Example: p = *t
Pointer arithmetic
Example: x++, x--
Memory Allocation
Example: new[]
Memory Deallocation
Example: delete[]
Sets

A set is an unordered collection of values that are all the same ordinal type.

Attributes

Set Name
Set Element Type
Set Size
Set Base Address
Operations
Mathematical Operations
Example: union, intersection, set-equality, etc.
Initialization
Example: setx = {0, 1, 2, 3}
File (Input File)

A file is a sequence of components that may be homogenous or heterogeneous and is a structured type.

Attributes

File Name
File Size
Operations
Read from file
Write to file
Create file
Open file
Delete file

Variant Records

Variant records are the same as records only that they have case statement.

Attributes

Record Name
Field_1 Name
Field_1 Type
Field_1 Offset
…
Field_n Name
Field_n Type
Fiel d_n Offset
Case Statement \variant part
Record Base Address

Operation

Execute same operations in normal Records only that there is an additional case statement.
 


Real-time system for controlling satellite systems

In real time system, rigid time requirements must be fulfilled. In this case, the satellite must have sensors to detect and bring data to the satelli te system. The system must analyze the data and may want to adjust controls to modify the appropriate sensors input or output. Processing must be done in the defined constraint if not the satellite system will fail. Therefore, in order for the system to work properly, data management is important and crucial in this system.

Array
Array is stored in memory as contiguous elements. They are usually in stored in Row or Column order. So, a mapping function is needed to locate an ele ment of an array as stored in the memory. In this case, the satellite system can use array to store data needed from its sensor input. Its mapping function then can later retrieve the data by locating its location in the memory.

Multidimensional Array
Certain languages limit the number of available dimensions because they are associated with performance problems. In this satellite system, the system can use multidimensional array to store all its sensor inputs or outputs. I must say that this may get complicated because it has many inputs and outputs. However, it's a good storage management for storing data that are not needed frequently in daily processing.

Slices
The range of the slice have to be determined first if we want to use it. In the satellite system, we can use slices so store data for example, temperature of the satellite, at a certain of time range.

Records
Advantage of using records rather than arrays is that the data types in records need not be the same. In this case, the satellite system can store multiple data, such as its location, its temperature and data input all in the same record.

Lists
Lists can be used to store tasks for the satellite system. In this case, the system is responsible to retrieve, read and perform the tasks in the lists accordingly. The performance and efficiently of the lists can be improved with the implementation of the lists with pointers. This enables dynamic access to the list.

Character Strings
In the satellite system, lets assume that the system supports string operations. The processed data of the operation in the system can then be stored dynamically strings. In dynamic strings, the lengths of the strings are not fixed, thus providing more flexibility to the system.

Pointers
Pointers are needed in dynamic storage management. In the satellite system, pointers are extremely useful in allocating available memor y storage and deallocating unwanted storage.

Sets
Sets can be use to store categories of result. The advantage of putting these categories in sets rather than in arrays is because sets have their own operations such as union and intersection. Therefore, with these operations, it improves the efficiency of the system.

Files (Input file)
Input files supplies data for the satellite system. These files can be stored in a database so that the system can access i t whenever needed.

Variant Records
Variant record is an extension of record only that it has a case selection. The selection allows easier categorization of data into the specific record. For example, the satellite system is inputting some data collected from the experiment. With the variant record, the system will be able to know the type of the experiment ( in the case selection).

For example:

Field_1 Name
Field_1 Type
Field_1 Offset< /dd>
…
Field_n Name
Field_n Type
Field_n Offset
Case Statement
Case experiment A: Result;
Case experiment B: Result;
…
Case Experiment n: Result;
End case
Record Base Address

Event driven system for automated manufacturing system

Assume that this automated manufacturing system is a se wing machine which could sew a design according to the user input. This machine would know which design to get and how to sew that particular design. This machine would know when and where to sew different color in different places. Therefore, in order for the machine to work, the system must contain all the designs and information on the color threads and must be able to function accordingly.

Arrays
Arrays in the system are used to stor e file names where each file name represents an individual design. When user enter input, a case statement is used to determine the specific file in the array that will be used.

Multidimensional arrays
Multidimensional arrays are used to store the coordinates to sew a particular color according to the design. For example, (x1, y1) sew black color and (x2, y2) paint yellow color. A mapping function in the system will be used to locate the coordinates.

Slices
The range of the slice must first be determined. In this case, the range contains the coordinates of the design have the same color of thread. The slices are used to store the coordinates of the design with the same color of threads.

Records
Advantage of using records rather than arrays is that the data types in records need not be the same. In this case, the system ca n store multiple data, such as its coordinates and its color threads information in a record.

Lists
Lists are used to store the list of instructions on how to sew a design. In this case, the system is responsible to retrieve, read and perform the tasks in the lists accordingly. The performance and efficiently of the lists can be improved with the implementation of the lists with pointers. This enables dynamic access to the list.

Character strings
Character strings are not appropriate to be used in the system because designs in the system are represented in coordinates (integers) and not in characters or string.

Pointers
Pointers are needed in dynamic storage management. In this manufacturing system, the pointers are used to allocate the location of the list of instructions. Also, the pointer points to a coordinate w hich represent the current color to be sewn.

Sets
Sets can be used to store a set of file names where each file name represents an individual design.

Files
Since input files store the coordinates for the design, the file then can be translated into multidimensional arrays.

Variant records
Variant records can be u sed so that we we can put all the designs into one file and then use the case statement of variant records to filter out the desired design.



Intelligent Tutoring System

The goal of an intelligent tutoring system is to speed a student's learning curve. This is accomplished by eliminating time spent on subject areas understood by the student and concentrating on those weaker areas. Keeping this in mind, it is necessary that an intelligent tutoring system be able to make decisions. The tutoring system must be able to keep track of student answers and subject areas' scores. Using this data, the system will prioritize subject areas and be able to recalculate scores on the fly.

Array
An array would be ideal for storing students' scores in an intelligent tutoring system. Student's would be able to save their work and resume a t a later time. In this syntax, the index_value_list would represent the student's unique id number and the element would represent the student's current overall score:
        array_name(index_value_list) -> element.

Multidimensional Array
Multidimensional arrays would be used in this system to track student progress in a subject area. For example, in the element (x1,y1) x1 represents the subject area and y1 represents a sub-subject area. This will allow for retesting in a more narrowed area.

Slices
For an intelligent tutoring system, the range of a slice could contain elements with the same subject area. For example, the slice (x1,y1:n) would contain all the elements for subject area x1. All of these sub-subject scores would represent the score for subject x1.

Records
Records would be used to expand the information contain ed within the array. In the example above for an array, the only information stored is the student name and the student's overall score. A record would be used this system to permanently store a student's sub-subject scores. This would allow for incomplete sub-subject areas, whereas the student's overall score stored in the array would not take incomplete sub-subject areas into account.

Lists
A list would keep track of how a student will progress through a particular subject are a. There will be sequences defined specific to the student being tutored according to previous scores. For example, the system could make an intelligent decision to eliminate a sub-subject area from being covered because the student scored above 90% in that area, therefore this sub-subject area would not be contained in the list.

Character Strings
Prompts for a user of this system would be stored in character strings. Users unfamiliar with the software would benefit from a prompt to save their work before leaving the tutorial if they had not previously done so.

Pointers
Pointers in this system would be used to provide a method of dynamic storage management. Pointers would be used to specify the memory location of the current list the student is working on.

Sets
Sets will be used in this intelligent tutoring system to store profiles. A unique profile would consist of the lists that the student would be guided through after accessin g the subject areas the student needs to review.

Files
Files will be used to store the student's information while they are not currently accessing the system.

Variant Records
Variant records will be useful for evaluating the success of the intelligent tutoring system. Records could be manipulated using the case statement to gather the data to determine whether the system is successful or unsuccessful.


Reference:

Data Structures and Other Objects Using C++, Michael Main and Walter Switch

The HandBook of Software for Engineers and Scientists, Paul W. Ross

http://www.cs.adfa.oz.au/teaching/studinfo/ada/Ada_index.html

How to Program C++, Deitel & Deitel

Concepts of Programming Languages, Robert W. Sebesta