DS UNIT 1
DS UNIT 1
1.1.3 Variable
It is a symbolic name given to some known or unknown quantity or information, for the purpose of
allowing the name to be used independently of the information it represents. A variable name in computer
source code is usually associated with a data storage location and thus also its contents and these may
change during the course of program execution.
1.1.4 Record
Collection of related data items is known as record. The elements of records are usually called fields or
members. Records are distinguished from arrays by the fact that their number of fields is typically fixed,
each field has a name, and that each field may have a different type.
1.1.5 Program
A sequence of instructions that a computer can interpret and execute is termed as program.
1.1.6 Entity
An entity is something that has certain attributes or properties which may be assigned some values. The
values themselves may be either numeric or non-numeric.
Example:
1.1.8 Field
A field is a single elementary unit of information representing an attribute of an entity, a record is the
collection of field values of a given entity and a file is the collection of records of the entities in a given
entity set.
1.1.9 File
File is a collection of records of the entities in a given entity set. For example, file containing records of
students of a particular class.
1.1.10 Key
A key is one or more field(s) in a record that take(s) unique values and can be used to distinguish one
record from the others.
1.2 ALGORITHM
A well-defined computational procedure that takes some value, or a set of values, as input and produces
some value, or a set of values, as output. It can also be defined as sequence of computational steps that
transform the input into the output.
An implementation of ADT consists of storage structures to store the data items and algorithms
for basic operation. All the data structures i.e. array, linked list, stack, queue etc are examples of
ADT.
1.6 DATA STRUCTURE
In computer science, a data structure is a particular way of storing and organizing data in a
computer’s memory so that it can be used efficiently. Data may be organized in many different
ways; the logical or mathematical model of a particular organization of data is called a data
structure. The choice of a particular data model depends on the two considerations first; it must
be rich enough in st ructure to mirror the actual relationships of the data in the real world. On the
other hand, the structure should be simple enough that one can effectively process the data
whenever necessary.
Example: A 1, A 2, A 3 An
1.8.3 Tree
Data frequently contain a hierarchical relationship between various elements. The data structure
which reflects this relationship is called a rooted tree graph or, simply, a tree.
1.8.4 Graph
Data sometimes contains a relationship between pairs of elements which is not necessarily
hierarchical in nature, e.g. an airline flights only between the cities connected by lines. This data
structure is called Graph.
1.8.5 Queue
A queue, also called FIFO system, is a linear list in which deletions can take place only at one
end of the list, the Font of the list and insertion can take place only at the other end Rear.
1.8.6 Stack
It is an ordered group of homogeneous items of elements. Elements are added to and removed
from the top of the stack (the most recently added items are at the top of the stack). The last
element to be added is the first to be removed (LIFO: Last In, First Out).
Traversing: accessing each record/node exactly once so that certain items in the record
may be processed. (This accessing and processing is sometimes called “visiting” the
record.)
Searching: Finding the location of the desired node with a given key value, or finding
the locations of all such nodes which satisfy one or more conditions.
Inserting: Adding a new node/record to the structure.
Deleting: Removing a node/record from the structure.