









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










A computer system organizes data in a hierarchy that starts with bits and bytes and progresses to fields, records, files, and databases.
1. Bit: This represents the smallest unit of data a computer can handle. A group of bits, called a byte, represents a single character, which can be a letter, number or other symbol. 2. Field: A field is a particular place in a record where an item of information can be held or a grouping of characters into a word, group of words or a complete number (e.g. a person's first name or age), is called a field. 3. Record: A group of related fields, such as a student's name, class, date admitted, age or record is a collection of related items of data treated as a unit. 4. File: A file is organized collection of related records which are processed together. It is also referred to as a data set. The files is a collection of records relating to some class of object e.g. records of all insurance policies issue by an insurance company, records of all employees of firm, student records etc. A group of records of the same type (e.g. the records of all students in the class) is called a file. 5. Database: A group of related files (e.g. the personal history, examinations records and payments history files) make up a database. A record describes an entity. An entity is a person, place, thing, or event on which we maintain information. An employee record is an entity in a personnel records file and maintains information on the employees in that organization. Each characteristic or quality describing a particular entity is called an attribute. For example, employee name, address, age, gender, date employed is an attribute each of the entity personnel. The specific values that these attributes can have can be found in the field of the record describing the entity. Every record in the file contains at least one field that uniquely identifies that record so that the record can be retrieved, changed,
modified or sorted. This identifier is called the key field. An example of a key field is the employee number for a personnel record containing employee data such as name, address, age, job title etc.
COMPUTER FILE A computer file is a collection of related records / information that is stored in a computer system and can be identified by its full path name. File can also be defined as a group of records pertaining to a specific item e.g. payroll file. This contains all the payroll records within the organization’s records. Computer files are so called because they are the computer equivalent of card, paper, or microfiche files in the traditional office environment. Computer files provide a way to organize the resources used to permanently store information inside a computer.
A file has got a layout which show, for each different type of record in each file, the name of each file, its length and its locations within the record. Files are created when need for a particular collection of records is recognized. However, the creation and maintenance of files are major factor in the work load of a computer information processing system.
Purpose: A file holds data which is required for providing information. Some files are processed at regular intervals to provide this information (e.g. payroll file) and others which is required at regular intervals (e.g. file containing prices of items).
Ways of viewing file There are two common ways of viewing files:
1. Logical Files A logical file is a file viewed in terms of what data items its records, contain and what processing operations may be performed upon the file. The user of the file will normally adopt such a view. 2. Physical Files A physical file is a file viewed in terms of how the data are stored on a storage device such as a magnetic disk and how the processing operations are made possible. A logical file usually gives rise to a number of alternative physical file implementation
Types of file
1. Master file These are files of a fairly permanent nature e.g. customer ledger, payroll, inventory, etc. A feature to note is the regular updating of these files to show a current position. For example customer’ order will be processed by increasing the “balance owing” figure on a customer ledger record. It is seen therefore that master records will contain both data of a static nature, e.g. a customer name and address, and data which by its nature will change each time a transaction occurs, e.g. the “balance” personal file. 2. Movement file/Transaction file This is made up of the various transactions created from the source documents. In a sales ledger application, the file will contain all the orders received at a particular time. This file will be used to update the master file. As soon as it has been used for this purpose, it is no longer required. It will therefore have a very short life; because it will be replaced by a file containing the next batch addresses E.g. Sales Invoicing file, purchase order file and payroll file.
Processing activities on a file We will need to have access to particular records in the files in order to process them. The major processing activities are given below:
File organization Organization of a file on tape is simply a matter of placing the records one after the other on to the tape. There are four basic methods of organizing files on disk:
Record: Record can be defined as the collection of various data items, for example, if we talk about the student entity, then its name, address, course and marks can be grouped together to form the record for the student.
File: A File is a collection of various records of one type of entity, for example, if there are 60 employees in the class, then there will be 20 records in the related file where each record contains the data about each employee.
Attribute and Entity: An entity represents the class of certain objects. it contains various attributes. Each attribute represents the particular property of that entity.
Field: Field is a single elementary unit of information representing the attribute of an entity.
Need of Data Structures As applications are getting complexed and amount of data is increasing day by day, there may arrise the following problems:
1. Processor speed: To handle very large amout of data, high speed processing is required, but as the data is growing day by day to the billions of files per entity, processor may fail to deal with that much amount of data. 2. Data Search: Consider an inventory size of 106 items in a store, If our application needs to search for a particular item, it needs to traverse 106 items every time, results in slowing down the search process. 3. Multiple requests: If thousands of users are searching the data simultaneously on a web server, then there are the chances that a very large server can be failed during that process in order to solve the above problems, data structures are used. Data is organized to form a data structure in such a way that all items are not required to be searched and required data can be searched instantly.
Advantages of Data Structures Efficiency: Efficiency of a program depends upon the choice of data structures. For example: suppose, we have some data and we need to perform the search for a perticular record. In that case, if we
organize our data in an array, we will have to search sequentially element by element. hence, using array may not be very efficient here. There are better data structures which can make the search process efficient like ordered array, binary search tree or hash tables. Reusability: Data structures are reusable, i.e. once we have implemented a particular data structure, we can use it at any other place. Implementation of data structures can be compiled into libraries which can be used by different clients. Abstraction: Data structure is specified by the ADT which provides a level of abstraction. The client program uses the data structure through interface only, without getting into the implementation details.
Types of Data Structures
There are two types of data structures:
o Primitive data structure o Non-primitive data structure
Primitive Data structure
The primitive data structures are primitive data types. The int, char, float, double, and pointer are the primitive data structures that can hold a single value.
Non-Primitive Data structure
The non-primitive data structure is divided into two types:
o Linear data structure o Non-linear data structure
Linear Data Structure
Linked List: Linked list is a linear data structure which is used to maintain a list in the memory. It can be seen as the collection of nodes stored at non-contiguous memory locations. Each node of the list contains a pointer to its adjacent node.
Stack: Stack is a linear list in which insertion and deletions are allowed only at one end, called top.
A stack is an abstract data type (ADT), can be implemented in most of the programming languages. It is named as stack because it behaves like a real-world stack, for example: - piles of plates or deck of cards etc.
Queue: Queue is a linear list in which elements can be inserted only at one end called rear and deleted only at the other end called front.
It is an abstract data structure, similar to stack. Queue is opened at both end therefore it follows First- In-First-Out (FIFO) methodology for storing the data items.
Non Linear Data Structures: This data structure does not form a sequence i.e. each item or element is connected with two or more other items in a non-linear arrangement. The data elements are not arranged in sequential structure.
Types of Non Linear Data Structures are given below:
Trees: Trees are multilevel data structures with a hierarchical relationship among its elements known as nodes. The bottommost nodes in the herierchy are called leaf node while the topmost node is called root node. Each node contains pointers to point adjacent nodes.
Tree data structure is based on the parent-child relationship among the nodes. Each node in the tree can have more than one children except the leaf nodes whereas each node can have atmost one parent except the root node. Trees can be classfied into many categories which will be discussed later in this tutorial.
Graphs: Graphs can be defined as the pictorial representation of the set of elements (represented by vertices) connected by the links known as edges. A graph is different from tree in the sense that a graph can have cycle while the tree can not have the one.
Operations on data structure
Example: If we need to calculate the average of the marks obtained by a student in 6 different subject, we need to traverse the complete array of marks and calculate the total sum, then we will devide that sum by the number of subjects i.e. 6, in order to find the average.
If the size of data structure is n then we can only insert n- 1 data elements into it.
If we try to delete an element from an empty data structure then underflow occurs.
Searching: The process of finding the location of an element within the data structure is called Searching. There are two algorithms to perform searching, Linear Search and Binary Search. We will discuss each one of them later in this tutorial.
Sorting: The process of arranging the data structure in a specific order is known as Sorting. There are many algorithms that can be used to perform sorting, for example, insertion sort, selection sort, bubble sort, etc.
Merging: When two lists List A and List B of size M and N respectively, of similar type of elements, clubbed or joined to produce the third list, List C of size (M+N), then this process is called merging
To make them more concise, many decision tables include in their condition alternatives a don't care symbol. This can be a hyphen[1][2][3]^ or blank,[4]^ although using a blank is discouraged as it may merely indicate that the decision table has not been finished.[ citation needed ]^ One of the uses of decision tables is to reveal conditions under which certain input factors are irrelevant on the actions to be taken, allowing these input tests to be skipped and thereby streamlining decision-making procedures.[5]
Aside from the basic four quadrant structure, decision tables vary widely in the way the condition alternatives and action entries are represented.[6][7]^ Some decision tables use simple true/false values to represent the alternatives to a condition (similar to if-then-else), other tables may use numbered alternatives (similar to switch-case), and some tables even use fuzzy logic or probabilistic representations for condition alternatives.[8]^ In a similar way, action entries can simply represent whether an action is to be performed (check the actions to perform), or in more advanced decision tables, the sequencing of actions to perform (number the actions to perform).
A decision table is considered balanced or complete if it includes every possible combination of input variables. In other words, balanced decision tables prescribe an action in every situation where the input variables are provided.[4]
While recognizing these advantages, many will point out that tables are merely a systematic way to present static data. Do they have a worthwhile function in a more dynamic situation - that of decision making?
Decision tables may take one of three forms: (1) Limited entry table (2) Extended entry table (3) Mixed entry table
The limited-entry decision table is the simplest to describe. The condition alternatives are simple Boolean values, and the action entries are check-marks, representing which of the actions in a given column are to be performed.
A technical support company writes a decision table to diagnose printer problems based upon symptoms described to them over the phone from their clients.
The following is a balanced decision table.
Sorting Algorithms
Sorting is the process of arranging the elements of an array so that they can be placed either in ascending or descending order. For example, consider an array A = {A1, A2, A3, A4, ?? An }, the array is called to be in ascending order if element of A are arranged like A1 > A2 > A3 > A4 > A5 >?
An.
Consider an array;
int A[10] = { 5, 4, 10, 2, 30, 45, 34, 14, 18, 9 )
The Array sorted in ascending order will be given as;
A[] = { 2, 4, 5, 9, 10, 14, 18, 30, 34, 45 }
Bubble Sort
In Bubble sort, each element of the array is compared with its adjacent element. The algorithm processes the list in passes. A list with n elements requires n-1 passes for sorting. Consider an array A of n elements whose elements are to be sorted by using Bubble sort. The algorithm processes like following.
Algorithm:
o Step 1 : Repeat Step 2 For i = 0 to N- 1 o Step 2 : Repeat For J = i + 1 to N - I o Step 3 : IF A[J] > A[i] SWAP A[J] and A[i] [END OF INNER LOOP] [END OF OUTER LOOP o Step 4 : EXIT