Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
8 views6 pages

Data Assignment

Data structure

Uploaded by

badasamuelwest
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views6 pages

Data Assignment

Data structure

Uploaded by

badasamuelwest
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Yaba College of Education

School of Engineering

Computer engineering

P/ND/23/3410036

Bada Samuel Ayomide

Key points

 Definitions
 Functions
 Advantage and disadvantages

DATA STRUCTURE

The logical or mathematical model of a particular organization of data is called its


data structures. A data item is a single unit of values. It is a raw fact which
becomes information after processing . Data items for example , date are called group
items if they can be divided into subsystems. The date for instance is represented
by the day, the month andumber is called an elementary item, because it can not
be sub-divided into sud-items. It is indeed treated as a single item.

Functions

 Seek to identify and develop entities, operations and appropriate classes of problems to
use them.
 Determine representations for abstract entities to implement abstract operations on
concrete representations.

Value range

All possible values that could be assigned to a given atttibute of an entity set is called the
range of values of the attribute.

Data types

In mathematics it is customary to classify variables according to certain important characteristics. Clear


distinctions are made between real, complex, and logical variables or between variables representing
individual values, or sets of values, or sets of sets, or between functions, functionals, sets of functions,
and so on. This notion of classification is equally if not more important in data processing. We will
adhere to the principle that every constant, variable, expression, or function is of a certain type. This
type essentially characterizes the set of values to which a constant belongs, or which can be assumed by
a variable or expression, or which can be generated by a function .
PURPOSE OF TYPE INFORMATION:

Type information has 4 purposes:

a) It allows us to associate meaning to sequence of bits in the computer memory eg string


AA@ , integer 5YThis is because all data and instructions are store in the same manner as sequence of
bits.

b) It is useful during program development to improve readability and debugging.

c) It helps simplify implementation, eg it is easier and more efficient for implementations to


allocate storage for integers only, rather that arbitrary value

Type checking:

The main objective of type checking is to determine before program execution whether a
domain incompatibility can occur. If so, error messages occur for coercion or execution time
testing may be generated.

Advantages of Type checking:

a.) Efficiency: since the program is typically executed many times but needs only be type-checked
once.

b.) Furthermore type information may used by implementation to improve efficiency in many other
ways

c.) Minor programming errors could be detected before actual execution; this will simplify program
testing and debugging eg when another operation is to be performed on non numerical data.
Disadvantages

d.) Type specification also improves programme readability by making explicit the data
representation used by the programmer.

Disadvantages :

 Syntax of a type language are usually more complex


 Inflexibility: restriction are imposed on the programmer’s freedom of expression.

Examples

TYPE shape = (rectangle, square, ellipse, circle)

TYPE color = (red, yellow, green)

TYPE sex = (male, female)

TYPE weekday = (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday)


TYPE currency = (franc, mark, pound, dollar, shilling, lira, guilder, krone, ruble, cruzeiro, yen)

The Record Structure

The most general method to obtain structured types is to join elements of arbitrary types, that
are possibly themselves structured types, into a compound. Examples from mathematics are
complex numbers, composed of two real numbers, and coordinates of points, composed of two
or more numbers according to the dimensionality of the space spanned by the coordinate
system. An example from data processing is describing people by a few relevant characteristics,
such as their first and last names, their date of birth, sex, and marital status.

Examples

TYPE Complex = RECORD re, im: REAL END

TYPE Date = RECORD day, month, year: INTEGER END

TYPE Person = RECORD name, firstname: Name; birthdate: Date; sex: (male, female); marstatus:
(single, married, widowed, divorced) END

The following are the units for identifying data character,

1. A file is a collection of logically related records; e.g students file, stock file.
2. A record: is a collection of logically related data fields; e. g Data relating to students in
students
3. field: is consecutive storage position of values. It is a unit of data within a record e. g
student’s number, Name, Age. In a database concept fields are usually in columns of a
given table.
4. Data items for example , date are called group items if they can be divided
into subsystems. The date for instance is represented by the day, the month
andumber is called an elementary item, because it can not be sub-divided into
sud-items otherwise known as sub fields
5. Character is the smallest unit of information. It includes letters, digits and special
symbols such as + (Plus sign), _(minus sign), \, /, $,a,b,…z, A,B,…Z etc. Every character requires
one byte of memory unit for storage in computer system.
Graph
Graphs are a commonly used data structure because they can be used to model many
real-world problems. A graph consists of a set of nodes with an arbitrary number of
connections, or edges, between the nodes. These edges can be either directed or
undirected and weighted or unweighted.
Definition1. A graph is a finite nonempty set vertex) together with a (possibly empty) set
of objects called vertices (the singular is of unordered pairs of distinct vertices of edges.
called Graphs are a very expressive formalism for system modeling, especially when
attributes are allowed. Our research is mainly focused on the use of graphs for system
verification. Up to now, there are two main different approaches of modeling (typed)
attributed graphs and specifying their transformation. Here we report preliminary results
of our investigation on a third approach. In our approach we couple a graph to
a data signature that consists of unary operations only. Therefore, we transform arbitrary
signatures into a structure comparable to what is called a graph structure signature in
the literature, and arbitrary algebras into the corresponding algebra graph.
Computer representations of graphs
There are two common computer representations for graphs (or digraphs), called
adjacency matrices and adjacency lists. For a graph of order , an adjacency matrix
representation is a boolean matrix (often encoded with 0's and 1's) of dimension n such
that entry only if edge/arc is in E( ). For a graph of order is true if and , an adjacency lists
representation is such that the -th list contains a sequence (often sorted) of out-
neighbours of vertex We can see the structure of these representations more clearly with
examples
Symbol, and relations
Relations
A binary relation is determined by specifying all ordered pairs of objects in that relation;
it does not matter by what property the set of these ordered pairs is described.
Definition.
A set R is a binary relation if all elements of R are ordered pairs, i.e., if for any z ∈ R
there exist x and y such that z = (x, y). It is customary to write xRy instead of (x, y) ∈
R. We say that x is in relation R with y if xRy holds. The set of all x which are in
relation R with some y is called the domain of R and denoted by “dom R.” So dom R =
{x | there exists y such that xRy}. dom R is the set of all first coordinates of ordered
pairs in R. The set of all y such that, for some x, x is in relation R with y is called the
range of R, denoted by “ran R.” So ran R = {y | there exists x such that xRy}. Symbol
Symbol
A symbol is something such as an object, picture, written word, sound, or particular
mark that represents something else by association, resemblance, or convention. For
example, a red octagon may stand for "STOP". On maps, crossed sabres may indicate a
battlefield. Numerals are symbols for numbers.
Language and symbols
All languages are made up of symbols. Spoken words are the symbols of mental experience, and
written words are the symbols of spoken words. The word "cat", for example, whether spoken
or written, is not a literal cat but a sequence of symbols that by convention associate the word
with a concept. Hence, the written or spoken word "cat" represents (or stands for) a particular
concept formed in the mind. A drawing of a cat, or a stuffed cat, could also serve as a symbol for
the idea of a cat.
Equivalence relation
Equivalence relation is a binary relation between two elements of a set which groups them
together as being "equivalent" in some way. Let a, b, and c be arbitrary elements of some set X.
Then "a ~ b" or "a ≡ b" denotes that a is equivalent to b. An equivalence relation "~" is reflexive,
symmetric, and transitive. In other words, the following must hold for "~" to be an equivalence
relation on X: An equivalence relation partitions a set into several disjoint subsets, called
equivalence classes. All the elements in a given equivalence class are equivalent among
themselves, and no element is equivalent with any element from a different class.
Composite Relations
If the elements of a set A are related to those of a set B, and those of B are in turn
related to the elements of a set C, then one can expect a relation between A and C. For
example, if Tom is my father(parent-child relation) and Sarah is a sister of Tom (sister
relation), then Sarah is my aunt (aunt-nephew/niece relation). Composite relations give
that kind of relations.
Definition(composite relation):
Let R1 be a binary relation from a set A to a set B, R2 a binary relation from B to a
set C. Then the composite relation from A to C denoted by R1R2(also denoted by R1 R2
is defined as R1R2 = {<a, c> | a A c C b [b B <a, b> R1 <b, c> R2 ] } . In English, this
means that an element a in A is related to an element c in C if there is an element b
in B such that a is related to b by R1 and b is related to c by R2 . Thus R1R2 is a
relation from A to C via B in a sense. If R1 is a parent-child relation and R2 is a sister
relation, then R1R2 is an aunt-nephew/niece relation.
Properties of Composite Relations
Composite relations defined above have the following properties. Let R1 be a relation from A to
B, and R2 and R3 be relations from B to C. Then 1. R1(R2R3) = (R1R2)R3 2. R1(R2 R3) = R1R2
R1R3 3. R1(R2 R3) R1R2 R1R3 Proofs for these properties are not necessary
Powers of Relation
Let R be a binary relation on A. Then Rn for all positive integers n is defined recursively as
follows:
Definition(power of relation): Basis Clause: R0 = E, where E is the equality relation on A.
Inductive Clause:
For an arbitrary natural number n , Rn+1 = RnR. Note that there is no need for extremal
clause here. Thus for example R1 = R, R2 = RR, and R3 = R2R = (RR)R = R(RR) = RRR. The powers
of binary relation R on a set A defined above have the following properties. 1. Rm+n = RmRn,
2. (Rm)n = Rmn.
Using composite identity relationships
An identity relationship establishes an association between business objects or other data
on a one-to-one basis. A composite identity relationship relates two business objects
through a composite key attribute.
Creating composite identity relationship
definitions Identity relationship definitions differ from lookup relationship definitions in
that the participant types are business objects, not of the type Data (the first selection in
the participant types list)
As with a simple identity relationship:
• The composite identity relationship consists of the generic business object and at least
one application-specific business object.
• The participant type is a business object for all participants.
Restriction: To manage composite relationships, the server creates internal tables. A table
is created for each role in the relationship. A unique index is then created on these
tables across all key attributes of the relationship. (In other words, the columns which
correspond to the key attributes of the relationship are the participants of the index.)
The column sizes of the internal tables have a direct relation to the attributes of the
relationship and are determined by the value of the MaxLength attribute for the
relationship.
Databases typically have restrictions on the size of the indexes that can be created. For
instance, DB2 has an index limitation of 1024 bytes with the default page size. Thus,
depending on the MaxLength attribute of a relationship and the number of attributes in a
relationship, you could run into an index size restriction while creating composite
relationships.
Important:
• You must ensure that appropriate MaxLength values are set in the repository file for all
key attributes of a relationship, such that the total index would never exceed the index
size limitations of the underlying DBMS. If the MaxLength attribute for type String is not
specified, the default is nvarchar(255) in the SQLServer. Thus, if a relationship has N Keys,
all of type String and the default MaxLength attribute of 255 bytes, the index size would
be ((N*255)*2) + 16 bytes. You can see that you would exceed the SQLServer 7 limit of
900 bytes quite easily when N takes values of >=2 for the default MaxLength value of
255 bytes for type String. • Remember, too, that even when some DBMS'es support
large indexes, it comes at the cost of performance; hence, it is always a good idea to
keep index sizes to the minimum.

You might also like