Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

DATA STRUCTURES

Abhimanyu Sahu

Assistant Professor
Dept. of Computer Science and Engineering
Motilal Nehru National Institute of Technology Allahabad
Syllabus:
• UNIT-1: Introduction: Basic Terminology, Elementary Data Organization, Algorithm, Efficiency of
an Algorithm, Time and Space Complexity, Asymptotic notations: Theta, Big-O, and Omega, Time-
Space tradeoff. Abstract Data Types (ADT)
• UNIT-II: Arrays: Definition, Single and Multidimensional Arrays, Representation of Arrays: Row
Major Order, and Column Major Order, Application of arrays, Sparse Matrices and their
representations.
• Linked Lists: Array Implementation and Dynamic Implementation of Singly Linked Lists, Doubly
Linked List, Circularly Linked List, Operations on a Linked List. Insertion, Deletion, Traversal,
Polynomial Representation and Addition, Generalized Linked List
• Stacks: Abstract Data Type, Primitive Stack operations: Push & Pop, Array and Linked
Implementation of Stack in C, Application of stack: Prefix and Postfix Expressions, Evaluation of
postfix expression, Recursion, Tower of Hanoi Problem, Simulating Recursion, Principles of
recursion, Tail recursion, Removal of recursion.
• Queues: Abstract Data Type, Operations on Queue: Create, Add, Delete, Full and Empty, Circular
queues, Array and linked implementation of queues in C, Deque and Priority Queue
Syllabus:
• Unit III: Trees: Basic terminology, k-ary trees, Binary Trees, Binary Tree Representation:
Array Representation and Dynamic Representation, Complete Binary Tree, Algebraic
Expressions, Extended Binary Trees, Array and Linked Representation of Binary trees, Tree
Traversal algorithms: In order, Preorder and Post order, Binary Search Trees, Threaded
Binary trees, Traversing Threaded Binary trees, Forest, Huffman algorithm, Heap, B/B+
Tree, AVL tree.
• Unit IV: Searching& Sorting: Sequential search, Binary Search, Comparison and Analysis
Internal Sorting: Bubble Sort, Selection Sort, Insertion Sort, Two Way Merge Sort, Heap
Sort, Quick Sort, Hashing.
• UNIT V: Graphs: Terminology, Sequential and linked Representations of Graphs:
Adjacency Matrices, Adjacency List, Adjacency Multi list, Graph Traversal: Depth First
Search and Breadth First Search, Connected Component, Spanning Trees, Minimum Cost
Spanning Trees: Prims and Kruskal algorithm. Shortest Path algorithm: Dijikstra Algorithm
Books:
• Text Books:
1. “Aaron M. Tenenbaum, YedidyahLangsam and Moshe J. Augenstein “Data
Structures Using C and C++”, PHI
• Reference Books:
1. Horowitz and Sahani, “Fundamentals of Data Structures”, Galgotia Publication
2. Donald Knuth, “The Art of Computer Programming”, vol. 1 and vol. 3.
3. Jean Paul Trembley and Paul G. Sorenson, “An Introduction to Data Structures with
applications” McGraw Hill
4. R. Kruse etal, “Data Structures and Program Design in C”, Pearson Education
Lipschutz, “Data Structures” Schaum’s Outline Series, TMH
ALGORITHM AND DATA STRUCTURE:
Algorithm:
• An algorithm is a step-by-step procedure of solving a problem.
• It is defined as any well-defined computational procedure that takes some value
as input, produces some value known as output within a finite amount of time.
• Different algorithms can be devised to solve a single problem.
• Real world applications of algorithms:
• The Human Genome project
• The Internet
• E-commerce
ALGORITHM AND DATA STRUCTURE:
Data Structure:
• A data structure is a way to store and organize data in order to facilitate
access and modifications.
• For example, an array stores similar types of data sequentially while a
structure stores data of different types. These two are basic data structures
and are used to formulate other data structures.
• For example, we can create a structure to store the information of a student.
An array of such a structure will store the details of several students. So this
array of structure will represent another data structure.
• Other well-known data structures include stack, queue, linked list, trees etc.
• No single data structure works well for all purposes, so it is important to
understand multiple data structures.
ALGORITHM AND DATA STRUCTURE:
Difference between algorithm and data structure:
• An algorithm is a way to solve a problem where as a data structure is a way to store similar
or heterogeneous data.
• Every algorithm must work on some specific data structure (be it an array or a tree or a list).
• In simpler terms, the way we store data is data structure and the way we access and modify
that data is the algorithm.
Properties of Algorithm:
An algorithm must have the following properties.
• Input: An algorithm must take some (possibly one) input value.
• Output: An algorithm must produce some definite outputs.
• Finiteness: An algorithm must terminate after a finite number of steps.
• Definiteness: An algorithm should be definite, i.e. it shouldn’t contain any ambiguity at any
step.
• Effectiveness: One must be able to perform the steps in algorithm without applying any
intelligence.
ALGORITHM AND DATA STRUCTURE:
Types of algorithm:
Algorithms generally fall under two categories:
• Iterative: These algorithms sequentially execute the input using loops and
conditional statements. E.g. Linear search
• Recursive: These algorithms recursively break a larger problem into some smaller
problems and solve those problems. Then they combine the result of smaller
problems to solve the main given problem.
Basic Terminology:
• Data: Data are simply values or sets of values.
• Data items: Data items refers to a single unit of values.
• Data items that are divided into sub-items are called Group items. Ex: An Employee Name may be
divided into three subitems- first name, middle name, and last name.
• Data items that are not able to divide into sub-items are called Elementary items.
Ex: SSN
• Entity: An entity is something that has certain attributes or properties which may be assigned values. The
values may be either numeric or non-numeric.

• Entities with similar attributes form an entity set. Each attribute of an entity set has a range of values,
the set of all possible values that could be assigned to the particular attribute
Basic Terminology:
• Field is a single elementary unit of information representing an attribute of an entity.

• Record is the collection of field values of a given entity.

• File is the collection of records of the entities in a given entity set.

• Records may also be classified according to length.

• A file can have fixed-length records or variable-length records.

• In fixed-length records, all the records contain the same data items with the same amount of space
assigned to each data item.

• In variable-length records file records may contain different lengths.

Example: Student records have variable lengths, since different students take different numbers of
courses. Variable-length records have a minimum and a maximum length.
CLASSIFICATION OF DATA STRUCTURES:
• Data structures are generally classified into
• Primitive data Structures
• Non-primitive data Structures
• Primitive data Structures:
These are the data structures which are directly supported by the machine. i.e. Any operation
can be performed in these data items.
or
Primitive data structures are the fundamental data types which are supported by a
programming language.
The different primitive data types are
• Integer
• Float
• Double
• Character
• boolean
These data types consists of characters that cannot be divided and hence they also called
simple data types.
CLASSIFICATION OF DATA STRUCTURES:
• Non- Primitive data Structures:
Non-primitive data structures are those data structures which are created using primitive data
structures.
Examples of non-primitive data structures is the processing of complex numbers, linked lists, stacks,
trees, and graphs.
CLASSIFICATION OF DATA STRUCTURES:
• Linear Data structures:
• A data structure is said to be linear if its elements form a sequence or a linear list.
• There are basically two ways of representing such linear structure in memory.
• One way is to have the linear relationships between the elements represented by means of sequential
memory location. These linear structures are called arrays.
• The other way is to have the linear relationship between the elements represented by means of pointers or
links. These linear structures are called linked lists.
• The common examples of linear data structure are: Arrays, Queues, Stacks, Linked lists
• Non-linear Data Structure:
• A data structure is said to be non-linear if the data are not arranged in sequence or a linear.
• The insertion and deletion of data is not possible in linear fashion.
• This structure is mainly used to represent data containing a hierarchical relationship between elements.
• The common examples of Non-linear data structure are
• Trees
• Graphs
Data structure operations:
• Operation means processing the data in the data structure. The following are some
important operations.
• Traversing : To visit or process each data exactly once in the data structure

• 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 : To add a new value to the data structure

• Deleting : To remove a value from the data structure

• Sorting : To arrange the values in the data structure in a particular order

• Merging : To join two same type of data structure values

You might also like