Introduction to Data Structure

Slides:



Advertisements
Similar presentations
Data Structures Through C
Advertisements

ADVANCED DATA STRUCTURES AND ALGORITHM ANALYSIS Chapter 3 Lists, Stacks, and Queues.
©Brooks/Cole, 2003 Chapter 12 Abstract Data Type.
Lecture - 1 on Data Structures. Prepared by, Jesmin Akhter, Lecturer, IIT,JU Data Type and Data Structure Data type Set of possible values for variables.
CS 104 Introduction to Computer Science and Graphics Problems Data Structure & Algorithms (4) Data Structures 11/18/2008 Yang Song.
©Brooks/Cole, 2003 Chapter 12 Abstract Data Type.
Chapter 12 C Data Structures Acknowledgment The notes are adapted from those provided by Deitel & Associates, Inc. and Pearson Education Inc.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 12 – Data Structures Outline 12.1Introduction.
INTRODUCTION TO DATA STRUCTURE. Topics To Be Discussed………………………. Meaning of Data Structure Classification of Data Structure Data Structure Operations.
© 2004 Pearson Addison-Wesley. All rights reserved12-1 Chapter 12 : Collections Intermediate Java Programming Summer 2007.
12 Abstract Data Types Foundations of Computer Science ã Cengage Learning.
C o n f i d e n t i a l Developed By Nitendra NextHome Subject Name: Data Structure Using C Title: Overview of Data Structure.
Chapter 12 Data Structure Associate Prof. Yuh-Shyan Chen Dept. of Computer Science and Information Engineering National Chung-Cheng University.
Data Structures Winter What is a Data Structure? A data structure is a method of organizing data. The study of data structures is particularly important.
ISOM MIS 215 Module 3 – Stacks and Queues. ISOM Where are we? 2 Intro to Java, Course Java lang. basics Arrays Introduction NewbieProgrammersDevelopersProfessionalsDesigners.
Introduction to Data Structures. Definition Data structure is representation of the logical relationship existing between individual elements of data.
Computer Science Department Data Structures and Algorithms Lecture 1.
Chapter 9 (modified) Abstract Data Types and Algorithms Nell Dale John Lewis.
Chapter 9 Abstract Data Types and Algorithms Nell Dale John Lewis.
 DATA STRUCTURE DATA STRUCTURE  DATA STRUCTURE OPERATIONS DATA STRUCTURE OPERATIONS  BIG-O NOTATION BIG-O NOTATION  TYPES OF DATA STRUCTURE TYPES.
9-1 Abstract Data Types Abstract data type A data type whose properties (data and operations) are specified independently of any particular implementation.
1 Linked-list, stack and queue. 2 Outline Abstract Data Type (ADT)‏ Linked list Stack Queue.
Data Structures Types of Data Structure Data Structure Operations Examples Choosing Data Structures Data Structures in Alice.
Elementary Data Organization. Outline  Data, Entity and Information  Primitive data types  Non primitive data Types  Data structure  Definition 
2 Obaid Ullah HOD Computer Science Dept. Superior University Sialkot Campus.
Topic 2 Collections. 2-2 Objectives Define the concepts and terminology related to collections Discuss the abstract design of collections.
REEM ALMOTIRI Information Technology Department Majmaah University.
Data Structure and Algorithms
Chapter 9 Abstract Data Types and Algorithms Nell Dale John Lewis.
DATA STRUCURES II CSC QUIZ 1. What is Data Structure ? 2. Mention the classifications of data structure giving example of each. 3. Briefly explain.
CPS120: Introduction to Computer Science Nell Dale John Lewis Abstract Data Types.
CPS120: Introduction to Computer Science Sorting.
1 Data Organization Example 1: A simple text editor –Store the text buffer as a list of lines. –How would we implement the UNDO operation? Example 2: Parsing.
Mohammed I DAABO COURSE CODE: CSC 355 COURSE TITLE: Data Structures.
Introduction toData structures and Algorithms
Data Structure and Algorithms
STACKS & QUEUES for CLASS XII ( C++).
Review Array Array Elements Accessing array elements
Cpt S 122 – Data Structures Abstract Data Types
Chapter 12 Abstract Data Type.
G.PULLAIAH COLLEGE OF ENGINEERING AND TECHNOLOGY
Data Structure By Amee Trivedi.
Set Collection A Bag is a general collection class that implements the Collection interface. A Set is a collection that resembles a Bag with the provision.
Chapter 12 – Data Structures
Chapter 4 The easy stuff.
Course Developer/Writer: A. J. Ikuomola
Data Structures & File Processing
Data Structure Interview Question and Answers
12 C Data Structures.
Chapter 15 Lists Objectives
DATA STRUCTURES AND OBJECT ORIENTED PROGRAMMING IN C++
Data Structures Data Structure is a way of collecting and organising data in such a way that we can perform operations on these data in an effective.
Stacks and Queues.
Queues Queues Queues.
Data Structure Interview
CMSC 341 Lecture 5 Stacks, Queues
structures and their relationships." - Linus Torvalds
Stacks, Queues, and Deques
structures and their relationships." - Linus Torvalds
ITEC 2620M Introduction to Data Structures
Introduction to Data Structures
Cs212: Data Structures Computer Science Department Lecture 7: Queues.
Introduction to Data Structures
Introduction to Data Structure
Important Problem Types and Fundamental Data Structures
Stacks, Queues, and Deques
Introduction to data structures
Introduction to data structures
structures and their relationships." - Linus Torvalds
DATA STRUCTURES IN PYTHON
Presentation transcript:

Introduction to Data Structure

What is Data Structure? A data structure is a particular way of storing and organizing data in a computer so that it can be used efficiently. They provide a means to manage large amounts of data efficiently, such as large databases. Data are simply values or set of values and Database is organized collection of data. Department of CSE

What is Data Structure? (…contd) A data structure is a logical and mathematical model of a particular organization of data. The choice of particular data structure depends upon following consideration: 1.It must be able to represent the inherent relationship of data in the real world. 2.It must be simple enough so that it can be processed efficiently as and when necessary. Department of CSE

THE STUDY OF DATA STRUCTURE INCLUDE: Logical description of data structure Implementation of data structure Quantitative analysis of data structure, this include amount of memory, processing time Department of CSE

Classification of Data Structure Data Structures Primitive Data Structures Non-Primitive Data Structures Linear Data Structures Non -Linear Data Structures Integer Real Character Boolean Arrays Trees Stacks Graphs Linked List Queues Department of CSE

Classification (contd..) A data structure can be broadly classified into Primitive data structure Non-primitive data structure Primitive data structure :-The data structures, that are directly operated upon by machine level instructions i.e. the fundamental data types such as int, float in case of ‘c’ are known as primitive data structures. Non- Primitive data structure :-These are more complex data structures. These data structures are derived from the primitive data structures. Department of CSE

Classification (contd..) Non-Primitive Data Structures can be further divided into two categories: Linear Data Structures Non-Linear Data Structures. Linear Data Structures:-In linear data structures, data elements are organized sequentially and therefore they are easy to implement in the computer’s memory. E.g. Arrays. Non-Linear Data Structures:-In nonlinear data structures, a data element can be attached to several other data elements to represent specific relationships that exist among them. E.g. Graphs Department of CSE

Array & Linked List Array Linked list Linked lists are unbounded [0] [1] [2] A B C Array node linked A B C Linked list Linked lists are unbounded (maximum number of items limited only by memory) Department of CSE

Stack Stack New nodes can be added and removed only at the top Similar to a pile of dishes Last-in, first-out (LIFO) push Adds a new node to the top of the stack pop Removes a node from the top Department of CSE

Stack A stack is a list in which insertion and deletion take place at the same end This end is called top The other end is called bottom. Department of CSE

Queue Queue Insert and remove operations Similar to a supermarket checkout line First-in, first-out (FIFO) Nodes are removed only from the head Nodes are inserted only at the tail Insert and remove operations Enqueue (insert) and dequeue (remove) Department of CSE

The Queue Operations A queue is like a line of people waiting for a bank teller. The queue has a front and a rear. $ $ When you think of a computer science queue, you can imagine a line of people waiting for a teller in a bank. The line has a front (the next person to be served) and a rear (the last person to arrive. Walking out Rear(insertion) Front(Removal) Department of CSE

Tree A tree T is a finite non empty set of elements. One of these elements is called the root, and the remaining elements, if any, are portioned into trees, which are called the sub trees of T. Department of CSE

Tree (example) node edge Department of CSE

Graph A graph is defined as: “Graph G is a ordered set (V,E), where V(G) represent the set of elements, called vertices, and E(G) represents the edges between these vertices.” Graphs can be Undirected Directed Department of CSE

Fig . (a) Undirected Graph Figure shows a sample graph V(G)={v1,v2,v3,v4,v5} E(G)={e1,e2,e3,e4,e5} e2 v5 v1 e3 v4 e5 e1 v3 v2 e4 Fig . (a) Undirected Graph Department of CSE

Graph e2 v5 v1 e3 v4 e5 e1 v3 v2 e4 Fig. (b) Directed Graph In directed graph, an edge is represented by an ordered pair (u,v) (i.e.=(u,v)), that can be traversed only from u toward v. Department of CSE

Data Structure Operations Five major operations are associated with all data structures. Creation:- Initialization of the beginning. Insertion: - Insertion means adding new details or new node into the data structure. Deletion: - Deletion means removing a node from the data structure. Traversal: - Traversing means accessing each node exactly once so that the nodes of a data structure can be processed. Traversing is also called as visiting. Searching: - Searching means finding the location of node for a given key value. Department of CSE

Data Structure Operations(contd..) Apart from the four operations mentioned above, there are two more operations occasionally performed on data structures. They are: (a) Sorting: -Sorting means arranging the data in a particular order. (b) Merging: - Merging means joining two lists. Department of CSE

A first look on ADTs Solving a problem involves processing data, and an important part of the solution is the efficient organization of the data In order to do that, we need to identify: The collection of data items Basic operation that must be performed on them

Abstract Data Type (ADT) The word “abstract” refers to the fact that the data and the basic operations defined on it are being studied independently of how they are implemented We think about what can be done with the data, not how it is done

Primitive Data Type vs ADT Department of CSE

Some ADT’s Some user defined ADT’s are Stacks Queues Department of CSE

Stack ADT We define a stack as an ADT as shown below: Department of CSE

Queue ADT We define a queue as an ADT as shown below: Department of CSE