This document provides an introduction to key concepts in data structures, including definitions of data, data types, data objects, and different types of data structures. It discusses how data structures organize data elements and their relationships. Some main points covered are:
- Data can be numbers, strings, or combinations and is classified as atomic or composite.
- Data types refer to the kind of data a variable can store, and are classified as built-in or user-defined.
- A data object represents a container for data values and includes attributes like its name, type, and organization.
- A data structure organizes data and relationships between elements, defining domains, functions/operations, and axioms or
This document provides an introduction to key concepts in data structures, including definitions of data, data types, data objects, and different types of data structures. It discusses how data structures organize data elements and their relationships. Some main points covered are:
- Data can be numbers, strings, or combinations and is classified as atomic or composite.
- Data types refer to the kind of data a variable can store, and are classified as built-in or user-defined.
- A data object represents a container for data values and includes attributes like its name, type, and organization.
- A data structure organizes data and relationships between elements, defining domains, functions/operations, and axioms or
This document provides an introduction to key concepts in data structures, including definitions of data, data types, data objects, and different types of data structures. It discusses how data structures organize data elements and their relationships. Some main points covered are:
- Data can be numbers, strings, or combinations and is classified as atomic or composite.
- Data types refer to the kind of data a variable can store, and are classified as built-in or user-defined.
- A data object represents a container for data values and includes attributes like its name, type, and organization.
- A data structure organizes data and relationships between elements, defining domains, functions/operations, and axioms or
This document provides an introduction to key concepts in data structures, including definitions of data, data types, data objects, and different types of data structures. It discusses how data structures organize data elements and their relationships. Some main points covered are:
- Data can be numbers, strings, or combinations and is classified as atomic or composite.
- Data types refer to the kind of data a variable can store, and are classified as built-in or user-defined.
- A data object represents a container for data values and includes attributes like its name, type, and organization.
- A data structure organizes data and relationships between elements, defining domains, functions/operations, and axioms or
Download as DOCX, PDF, TXT or read online from Scribd
Download as docx, pdf, or txt
You are on page 1/ 8
Introduction to data structures
Computer science includes the study of data, its representation,
and its processing by computer. It refers to the organisation of data elements and the inter relationships between them. Data Data is a piece of information. Data input, processing and output are the functions of computers. It can be a number, string or the combination of two etc. Data is classified into atomatic and composite data. Atomic data is a single, non- decomposable entity. Example: An integer. atomic data is also called as scalar data Composite data can be broken down into sub fields that have complete meaning Example: Student record( sno, s name, mobile) Composite data is also called as structured data that can be implemented by a structure or a class c ++ Data type Data type refers to the kind of data a variable may store Data type classified into Built in data type User defined data type C ++ supports boolean , int,char, float, double etc, are used to define user define data type User define data types are extension of built in data types like structure union or class Data object A data object represents a container for data values it includes a set of attributes a) name of the data object b) type of data object c) logical organisation of data object A data object alphabets is D=( a,b......a,b.......) A data object of integers is D=(-------3,-2,-1,0,1,2,3,.........) Example variables , constants, arrays etc Data structure Data structures refers to data and representation of data objects with in a program it is collection of atomic and composite data types into a set with well define relationships A data structure is a set of domains(a) a set off function(f) and a set of axioms (a) Domain(D) Range of values that the data may have Function(f) Set off operations performed on data a set of operations must be spacified for a data structural to operations Axioms(a) Set of rules belongs to different operations(f) that can be implemented Example Data structure(D)= integer Domain(D)=( integer, boolean) Function(f)=( if zero(), zero()) increment(),add()) Operation output If zero( zero()) true If zero( increment( zero()) false Add (zero(), x) x Add( increment (x),y)=increment(add(x,y)) Abstract data type Abstraction allows to organise the complexity of a task bye focussing on logical properties of data and actions rather than on the implementation details Logical properties refers to what and implementation details refers to 'How' The abstraction can be data or producer Data abstraction is the separation of logical properties of the data from details of how the data is represented Procedural abstraction means separation of logical properties of action from implementation Abstract data type includes declaration of data implementation of operation and encapsulation of data and operations Data specification method has the following future's Abstract It should help programs to organise t data by focussing on its logical properties rather than on the implementation( which hides the complexity of a task Safe It should control the manipulation of the representation ask data malfunctioning can be avoided Modifiable If I should make it relatively easy to modify the representation Reliable It should provide consistenc performance Example Abstract data type for integer Operation. output Zero() int If zero() boolean Increment(int) int Add(int,int) int Equal (int,int) boolean Rules /axioms for operations For all x, y E integer, int If zero( zero()) true If zero( increment( zero()) false Add( zero(), x) x Add( increment(x ),y increment(add(x,y)) Types of data structures The data structures areclassified into a) primitive /non- primitive b) linear/ non- linear c) static/ dynamic d) sequential/ direct( random) e) persistent and ephemeral Primitive /non-primitive data structure Primitive data structure define a set of primitive elements that donot contain subparl eg: Integers characters Primitive data types are also called as built- in data types or primary data types Non-primitive data structures consist a set of elements that may be different and functions operation eg: Class ,union Linear/ non- linear data structures Linear data structure elements form a sequence every data element has a unque predecessor and successor linear data structures can be represented by a) arraya( sequential organisation) b) linked list( linked organisation) Non- linear data structures are used to represent the data containing hirarchial or network relationship among the elements In non- linear data structures every data elements main Ave more than one predecessor or successor eg: Trees( hierchial), graphs( network) Static/ dynamic data structures A static data structures is created before program execution begians( also called as compile time) The operator new is used to allocat the memory at da run time( it is also called as dynamic) The Advantage of dynamic data structure is fixibility( growing and shrinking) Dynamic data structures is implemented at run time using reference variables ( pointer) d) sequential/direct( random) data structure This data structure is basically depends on the way the data structure access operations are performed Sequential data structures process(n-1) data element to process nth element ex: Array, linked list Direct Data Structure access the nth element without processing predecessor eg: Array Persistent /ephimeral data structure Data Structure includes a set of operation add a set of data to operate the operations that process the data may modify the data this creates two versions of data structures