.$ru60441 1677754382000
.$ru60441 1677754382000
A Data structure is a particular way of storing and organizing data in a computer so that it can
be used efficiently. Data structures provide a means to manage huge amounts of data efficiently
for uses such as large databases and internet indexing services.
i)Integer type
i)INTEGER TYPE: an integer is a datum of integral data type, a data type which represents
some finite subset of the mathematical integers; they are commonly represented in a computer as
a group of binary digits
The standard operators are the four basic arithmetic operations of addition (+), subtraction (-),
multiplication (*), and division (/, DIV).
The term byte initially meant 'the smallest addressable unit of memory'
a. Words
The term 'word' is used for a small group of bits which are handled simultaneously by processors
of a particular architecture. The size of a word is thus CPU-specific
ii)The Type Real:
The type REAL denotes a subset of the real numbers. Whereas arithmetic with operands of the
types INTEGER is assumed to yield exact results; arithmetic on values of type REAL is
permitted to be inaccurate within the limits of round-off errors caused by computation on a finite
number of digits. The standard operators are the four basic arithmetic operations of addition (+),
subtraction (-), multiplication (*), and division (/). It is an essence of data typing that different
types are incompatible under assignment. An exception to this rule is made for assignment of
integer values to real variables, because here the semantics are unambiguous. After all, integers
form a subset of real numbers. However, the inverse direction is not permissible: Assignment of
a real value to an integer variable requires an operation such as truncation or rounding.
iii)The Type Boolean: The two values of the standard type BOOLEAN are denoted by the
identifiers “TRUE” and “FALSE”.
The Boolean operators are the logical conjunction, disjunction, and negation whose values are
defined in Table 2.1. The logical conjunction is denoted by the symbol &, the logical disjunction
by OR, and negation by “~”.
The Boolean operators & (AND) and OR have an additional property in most programming
languages, which distinguishes them from other dyadic operators. Whereas, for example, the sum
x + y is not defined, if either x or y is undefined, the conjunction p & q is defined even if q is
undefined, provided that p is FALSE.
This conditionality is an important and useful property. The exact definition of & and OR is
therefore given by the following equations:
In order to be able to design algorithms involving characters (i.e., values of type CHAR) that are
system independent, we should like to be able to assume certain minimal properties of character
sets, namely:
The type CHAR contains the 26 capital Latin letters, the 26 lower-case letters, the 10 decimal
digits and a number of other graphic characters, such as punctuation marks.
1. The subsets of letters and digits are ordered and contiguous, i.e.,
("A" x) & (x "Z") implies that x is a capital letter
("a" ≤ x) & (x ≤ "z") implies that x is a lower-case letter
2. The type CHAR contains a non-printing, blank character and a line-end character that
may be used as separators.
1B. SYSTEM DEVELOPMENT LIFE CYCLE
The Systems Development Life Cycle (SDLC), also referred to as the application development
life-cycle, is a term used in systems engineering, information systems and software engineering
to describe a process for planning, creating, testing, and deploying an information system.
SDLC is used during the development of an IT project; it describes the different stages involved
in the project from the drawing board, through the completion of the project.
The system development life cycle framework provides a sequence of activities for system
designers and developers to follow. It consists of a set of steps or phases in which each phase of
the SDLC uses the results of the previous one. They are as follows;
II) BYTE
The byte is a unit of digital information in computing and telecommunications that most
commonly consists of eight bits. Historically, the byte was the number of bits used to encode a
single character of text in a computer and for this reason it is the smallest addressable unit of
memory in many computer architectures.
Probably the most important use for a byte is holding a character code. Characters typed at the
keyboard; displayed on the screen, and printed on the printer all have numeric values. The size of
the byte has historically been hardware dependent and no definitive standards existed that
mandated the size.
This means that the smallest item that can be individually accessed is an eight-bit value. To
access anything smaller requires that you read the byte containing the data and mask out the
unwanted bits. The bits in a byte are normally numbered from zero to seven
A data type is a term which refers to the kinds of data that variables may hold. With every
programming language there is a set of built-in data types. This means that the language allows
variables to name data of that type and provides a set of operations which meaningfully
manipulates these variables.
Some data types are easy to provide because they are built-in into the computer’s machine
language instruction set, such as integer, character etc. Other data types require considerably
more efficient to implement. In some languages, these are features which allow one to construct
combinations of the built-in types (like structures in ‘C’). However, it is necessary to have such
mechanism to create the new complex data types which are not provided by the programming
language. The new type also must be meaningful for manipulations. Such meaningful data types
are referred as abstract data type.
IV) WORD
The term 'word' is used for a small group of bits which are handled simultaneously by processors
of a particular architecture. The size of a word is thus CPU-specific. Many different word sizes
have been used, including 6-, 8-, 12-, 16-, 18-, 24-, 32-, 36-, 39-, 48-, 60-, and 64-bit.
Since the size of a word is architectural, it is usually set by the first CPU in a family, rather than
the characteristics of a later compatible CPU. The meanings of terms derived from word, such as
long-word, double-word, quad-word, and half-word, also vary with the CPU and OS.
1C)I. Bits:
A bit is the basic unit of information in computing and digital communications. A bit can have
only one of two values, and may therefore be physically implemented with a two-state device.
The most common representation of these values are 0and1. The term bit is also known as binary
digit.e.g 0 and 1
II. Nibbles:
In computing, a nibble is a four-bit aggregation or half an octet. As a nibble contains 4 bits, there
are sixteen (24) possible values, so a nibble corresponds to a single hexadecimal digit (thus, it is
often referred to as a "hex digit" or "hexit").e.g 1010 and 1100
III.Octet:
The term octet always refers to an 8-bit quantity. It is mostly used in the field of computer
networking, where computers with different byte widths might have to communicate. In modern
usage, byte almost invariably means eight bits, since all other sizes have fallen into disuse. Thus,
byte has come to be synonymous with octet.e.g 01000101 and 10110011
A double word is exactly what its name implies, a pair of words. Therefore, a double word
quantity is 32 bits/4 bytes long
2 A.
AND 0 1
0 0 0
1 0 1
OR 0 1
0 0 1
1 1 1
XOR 0 1
0 0 1
1 1 0
2B. Data Representation refers to the methods used internally to represent information stored in a
computer.
Decimal numbering system uses 10 digits (0,1,2,3,4,5,6,7,8,9) to represent numbers. Each digit
represents a power of 10, with the rightmost digit representing the units place, the second-
rightmost digit representing the tens place, and so on. For example, the number "123" in decimal
notation represents 1100 + 210 + 3*1 = 123.
Hexadecimal numbering system uses 16 digits (0-9 and A-F) to represent numbers. Each digit
represents a power of 16, with the rightmost digit representing the units place, the second-
rightmost digit representing the sixteens place, the third-rightmost digit representing the 256s
place, and so on. For example, the number "1A" in hexadecimal notation represents 116 + 101 =
26.
2C. Abstract Data Type (ADT) is a data type that separates specification of objects and
operations from representation of objects and implementation of operations. Abstraction captures
only those details about an object that are relevant to the current perspective. Examples are:
1.Stack
2.Queue
3.Trees
4.Lists
3A) An Array is a sequenced collection of elements of the same data type with a single
identifier name. An array consists of elements and dimensions.
Types of Arrays
The types of array depend on the number of dimensions an array has, we have:
i. One-dimensional array
ii. Two-dimensional array
iii. Multi-dimensional array
One-Dimensional Array
A one-dimensional array is an array with only one dimension. This is the simplest form of an
array. It is also called a linear array. Accessing its elements involves a single subscript which can
either represent a row or column index
Multi-Dimensional Array
A Multidimensional array can be described as "arrays of arrays". For example, two-
dimensional array can be imagined as a two-dimensional table made of elements, all of them of a
same uniform data type.
Multidimensional arrays are not limited to two indices (i.e., two dimensions). They can contain
as many indices as needed. Although the amount of memory needed for an array increases
exponentially with each dimension. Thus, a two-dimensional array can also be categorised as a
multidimensional array
}
4A) 1. Programmers use array to organize collections of data efficiently and intuitively. This
prevents repetition of data or input.
2. Arrays are used to implement other data structures, such as heaps, hash tables, queues, stacks,
strings.
3. Large arrays are sometimes used to emulate in-program dynamic memory allocation
particularly memory pool allocation.
4. Some arrays are used in modeling game boards in computer games.
4B) A record is a special type of data structure that, unlike arrays, collects different data types
that define a particular structure such a book, product, person and many others.
an Array is a homogeneous collection of components; all components of the same kind While A
record is a heterogeneous collection of components. In other words, the components may be of
different kinds.
5A)
Type
person = Record
name : string;
phone : String;
weight : Real;
age : int;
sex : char;
End;
5B)
iii. You can assign one record variable to another of identical type
that_person:= this_person;
5C) Arrays of records are arrays whose elements are records. Records may be stored in arrays
and this will become very useful and it is not that difficult to manage.
Type
Str24 = String[24];
Book_Rec = Record
Title : Str24;
Author : Str24;
ISBN : Str24;
Price : Real;
End;
Begin
Readln(newBook.Title);
Write('Author: ');
Readln(newBook.Author);
Write('ISBN: ');
Readln(newBook.ISBN);
Write('Price: ');
Readln(newBook.Price);
End;
Var
i : 1..10;
Begin
For i := 1 to 10 do
EnterNewBook(bookRecArray[i]);
Readln(i);
Writeln;
End.
6A) Stack is a container or collection of elements in which data items are removed in the reverse
order of their insertion. A stack implements a Last In First Out (LIFO) data structure i.e. in
stacks, the last item entered is the first item outputted
A stack is an abstract data type (ADT) that supports two main methods or operations:
¨ pop(): Removes the top object of stack and returns it; if stack is empty an error occurs
Input: none; Output: Object
The stack also supports some other methods or operations such as:
6B
A queue is a first in first out structure (FIFO). A queue differs from a stack as its insertion and
removal routines follow the first-in-first-out principle
Types of Queues
i. Simple Queue
ii. Circular Queue
iii. Priority Queue
iv. Double Ended queue
6C)
Singly linked lists contain nodes which have a data field as well as a next field, which points to
the next node in line.
Doubly-linked list is a linked data structure that consists of a set of sequentially linked records
called nodes. Each node contains two fields, called links that are references to the previous and
to the next node in the sequence of nodes.
Circular list
In the last node of a list, the link field often contains a null reference, a special value used to
indicate the lack of further nodes. A less common convention is to make it point to the first node
of the list; in that case the list is said to be circular or circularly linked; otherwise it is said to be
open or linear.
In a multiply linked list, each node contains two or more link fields, each field being used to
connect the same set of data records in a different order (e.g., by name, by department, by date of
birth, etc.).
6D
a. They are used to represent organization in hierarchy and are used in representing
computer file systems
b. Networks use trees to find best path in the Internet