Professional Documents
Culture Documents
Data Structure
Data Structure
1
• The compiler is different for each architecture Operating System
Interpreter
• A special program “Interpreter” directly processes and executes a
source file
• Interpreters are Architecture and Operating System specific
• Interpreter is slower than Compiler
– Translation from language code to
machine code is done at run-time
– The Compiler is OS specific but Architecture independent
• An Interpreter processes and executes the bytecode
• Java is faster than a pure interpreted language
2
• Data can be in Boolean form like (TRUE / FALSE)
Whether we go there? NO/FALSE or
YES/TRUE
• Data can be in the form of sound, like the sound you play in computer
• Data can be in form of graphics, like a picture in a computer
• Data can be in the form of animated graphics, like movies in
computer
DATA CLASSES
• Group Data Item
– A Data item that can be further divided into sub items
3
• Computerkeeps data in organized form for processing
• This organized form of data is called data structure
TYPES OF DATA STRUCTURE
• Linear data structure
– The organization of data in a single row or in a single column is called
linear data structure
• Non linear data structure
• The organization of data in HIRARICHAL form is called non linear data
structure, for example Trees, Graphs, Hash Tables.
DATA STRUCTURE OPERATIONS
• For example an organization contains a membership file in which
each record contains the following data for a given member:
– Name – Address – Telephone number – Age
– Gender
• Announce meeting through a mailing
– Traverse the file to obtain name and address of each member
• Find the names of all members living in a certain area
– Again traverse to obtain the required data
• Obtain address for a given name
– Search the file for the record containing the name
New person joins the organization
– Insert his/her record in the file
• A member dies
– Delete his/her record from the file
4
• A member has moved to new location
– Search for member’s record and perform update operation
• Members with age >= 22
– Traverse the file
Some Terminologies
• Entity:
– an entity is something, that has certain attributes which may be
assigned values
• Field:
– a single elementary unit of information representing an attribute of
an entity
• Record:
– collection of field values of a given entity
• File:
– collections of records of the entities in a given entity set
Many types of operations on data in a particular data structure can be
performed, but four are basic operations
– Traversing – Searching
– Inserting – Deleting
• Other two are
– Sorting – Merging
Traversing
• Accessing a data item exactly once in a data structure
• Traversal makes data item available for further operations
5
Searching
• Finding the location of a data item in memory
• It is the basic of all operations in data structures
• All other operations on data structure are directly dependent upon
searching operation
Inserting
• Adding a new data item to the data structure
• Insertion operation is successful only if there is a space in data
structure
Deleting
• Removing a data item from data structure
• For deletion, first of all search for the item is performed
Algorithm
• Well definedlist of steps for solving a particular problem
• Algorithm is independent of a particular
computer and the software used for development
Algorithm is general for all sorts of computers and programming
languages
Algorithm is used to describe a problem solving method
Algorithm is written independentof computer programs
The codes used for writing algorithm is called pseudo code or
algorithmic notations
Time Space Tradeoff
• Timeand space are the two major and primary variables measuring
the efficiency of a program
6
• Time is the amount of time used to complete a process
• Spaceis the amount in memory consumed by the process during its
processing
Algorithm Notations
• An algorithm is executed statement by statement, one after the other
8
9