Data Structures and Algorithms - Overview
In this article, we are going to learn what is data structures and algorithms and why and where these two terms used for. and you will have a better understanding of the Data structures and algorithms after completing this article.
What are Data Structures
Data can be organized in many ways and the mathematical or logical model organization of data is called a data structure.
To choose a particular data structure we need to consider these two points.
- The data structure must be able to represent the relationship of the data in the real world.
- It must be in a form so that whenever we need it can be processed efficiently.
Terms used in Data Structures
Data - A unit of value or a set of values refer to Data. these values may represent some observation from an experiment, some figures collected during some survey (such as census, exit polls, etc.), marks obtained by a student in an exanimation etc.
Data Item - A single unit of Data is called a data item. For example, roll number, name, date of birth, age, address and marks in each subject are data items.
Data items can be divided into 2 types
- Group items - Data items that can be categorized into sub-items are called group items. for example, an address is a group item as it is divided into sub-items such as country, city, street number, house number, locality, city, pin code, etc. Likewise, data can be divided into the day, month and year, a name can be divided into first name and last name.
- Elementary items - Data items that can not be divided into sub-items are called elementary items. for example, roll number, marks, city, Pincode, etc. are normally treated as elementary items because they can not be further divided.
Entity - Data that has certain attributes or properties is called Entity, which may be assigned values. For example, the employee is an entity.
Fields - The attributes or properties of the entity is called field. we can assign either numeric or non-numeric to these fields. For example, the possible attributes for a student can be named, date of birth, class, gender, and roll number. the possible values for these attributes can be 1234567, YASH, 06/05/1999, S, 5.
Record - For a given entity a collection of related fields is called a record.
File - collection of related records is called File. for example, a file containing records of all employees in a company, a file containing records of all employees like name, address, date of birth and employee id. in fact, an entity set is represented by a file.
Key - Unique values of the data item in a record are called a key. it is used to distinguish a record from other records. there be a case to has a unique value for one data. so there is a case where we have multiple keys.
so at a time, we can use only one data item as a key and that is called the primary key, and the other keys are considered alternative key(s) for that entity. this consideration depends on the condition. so whenever we need it can use it.
There are some cases where can be found no field that has unique values. then a combination of some fields can be used to form a key, such a key is known as a composite key. Also, there are some cases when there is no possibility of forming a key from within a record. so to create a unique key we need to add some extra data item that can be used as a key.
Information - information and the terms data have the same meaning. in actual data is just a small representation of information. it is more than just data. in simple terms, information is processed data. data is just a collection of raw data (values), that has no meaning at all. so we cannot make decisions from that data. so to generate information from data we need to apply some rules and after applying the rules new data become the information. this new generation of data (information) conveys some meaning and hence can be used for decision making.
Data type - A data type is a collection of values and a set of operations that act on these values. whether we are dealing with user-defined or pre-defined data types. we always need to consider these two aspects.
- Set of values
- Set of operations
For example, consider an integer data type which consists of valued (MININT...., -2,-1,0,1,2,...., MAXINT), where MININT is the smallest and MAXINT are the largest integers that can be represented by an integer type on a particular computer. the operations on integers include the arithmetic operation of addition (+), subtraction (-), multiplication (*) and division (/). there are also some other operations that test for equality/inequality like (=, !=) and the operation that assigns an integer value to a variable.
What is an Algorithm?
An algorithm is a set of well-defined lists of different steps for solving a particular problem. let's say we want to make tea then the steps that we follow to make tea is an algorithm for making tea. The same goes with the technical terms. for solving any problem like creating a dashboard for an application the set of steps that we follow is the algorithm for creating the dashboard.
In technical terms, we can say that algorithm is a well-defined computation process that takes some values as input and then generate some values as output. It has some set of rules that we need to follow to solve a particular problem. an algorithm is only valid if there is an output for every given input instance. thus we can say that a valid algorithm always solves a given computation problem and give the desired output value as a result.
In theory terms, we can say that algorithm is a well-defined set of a finite sequence of computation steps that transforms the given input into output for the desired problem. and an incorrect input does not give the desired output for the input. we can define/specify an algorithm in any language like in natural language, computer language, or hardware design. only we need to consider that the resulting instructions are defined in such a way so that they can provide a detailed description of the computational procedure to be followed.
The word algorithm comes from the name of the 9th-century Persian mathematician Muhammad ibn Musa al-Khwarizmi whose works introduced Indian numerals and algebraic concepts as step-by-step calculations. the word algorism originally referred only to the rules of performing arithmetic using Arabic numerals but evolved via European Latin translation of al-Khwarizmi's name into the algorithm by the 18th century.
At present, the world algorithm includes all definite procedures for solving problems or performing tasks. The term 'ALGORITHM' refers to this logic of a program. it is the step-by-step description of the method to arrive at a solution to the given problem.
The algorithm is a finite set of steps defining the solutions to a particular problem. an algorithm can be expressed in an English-like language, called pseudo forward. there may be many ways for solving a particular problem and each procedure of writing to solve that problem is known as designing the algorithm. each algorithm will involve a particular data structure so we always may not use the most efficient algorithm. the graphical representation called a flow chart is another way to solve the problem.
the efficiency of the implementation of an algorithm depends upon speed, size, and resource consumption. the algorithm that is definite and effective are also called computational procedures. one important example of a computational procedure is the operating system of a digital computer. and an algorithm procedure is designed to control the execution of the job in that if there are multiple works to do then it will perform one by one with priority and if there are no jobs available, then it goes to a waiting state and does not terminate.