©Brooks/Cole, 2003 Chapter 11 Data Structures. ©Brooks/Cole, 2003 Understand arrays and their usefulness. Understand records and the difference between.

Slides:



Advertisements
Similar presentations
11 Data Structures Foundations of Computer Science ã Cengage Learning.
Advertisements

Linked Lists Linked Lists Representation Traversing a Linked List
CHP-5 LinkedList.
M180: Data Structures & Algorithms in Java
Foundation of Computing Systems Lecture 2 Linked Lists.
Data Structures: A Pseudocode Approach with C
Data Structures: A Pseudocode Approach with C 1 Chapter 5 Contd... Objectives Explain the design, use, and operation of a linear list Implement a linear.
©Brooks/Cole, 2003 Chapter 12 Abstract Data Type.
Chapter 1 Object Oriented Programming. OOP revolves around the concept of an objects. Objects are crated using the class definition. Programming techniques.
©Brooks/Cole, 2001 Chapter 9 Pointers. ©Brooks/Cole, 2001 Figure 9-1.
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.
Chapter 15 B External Methods – B-Trees. © 2004 Pearson Addison-Wesley. All rights reserved 15 B-2 B-Trees To organize the index file as an external search.
©Brooks/Cole, 2001 Chapter 9 Pointers. ©Brooks/Cole, 2001 Figure 9-1.
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 17: Linked Lists.
©Brooks/Cole, 2001 Chapter 8 Arrays. ©Brooks/Cole, 2001 Figure 8-1.
©Brooks/Cole, 2003 Chapter 11 Data Structures. ©Brooks/Cole, 2003 Data Structure Data structure uses collection of related variables that can be accessed.
©Brooks/Cole, 2001 Chapter 3 Structure of a C Program.
Main Index Contents 11 Main Index Contents Abstract Model of a List Obj. Abstract Model of a List Obj. Insertion into a List Insertion into a List Linked.
©Brooks/Cole, 2001 Chapter 10 Pointer Applications.
©Brooks/Cole, 2001 Chapter 11 Strings. ©Brooks/Cole, 2001 Figure 11-1.
Summary of lectures (1 to 11)
Linked Lists list elements are stored, in memory, in an arbitrary order explicit information (called a link) is used to go from one element to the next.
Programming Logic and Design Fourth Edition, Comprehensive
©Brooks/Cole, 2001 Chapter 4 Functions. ©Brooks/Cole, 2001 Figure 4-1.
Self Referential Structure. A structure may not contain a member of its own type. struct check { int item; struct check n; // Invalid };
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand the basic concepts and uses of arrays ❏ To be able to define C.
Chapter 13 File Structures. Understand the file access methods. Describe the characteristics of a sequential file. After reading this chapter, the reader.
Computers Data Representation Chapter 3, SA. Data Representation and Processing Data and information processors must be able to: Recognize external data.
Linked Lists list elements are stored, in memory, in an arbitrary order explicit information (called a link) is used to go from one element to the next.
Arrays in C++ Numeric Character. Structured Data Type A structured data type is a type that stores a collection of individual components with one variable.
Data Strcutures.
Lecture 14 Linked Lists 14-1 Richard Gesick. Linked Lists Dynamic data structures can grow and shrink at execution time. A linked list is a linear collection.
©Silberschatz, Korth and Sudarshan11.1Database System Concepts Chapter 11: Storage and File Structure File Organization Organization of Records in Files.
©Brooks/Cole, 2003 Chapter 13 File Structures. ©Brooks/Cole, 2003 Understand the file access methods. Describe the characteristics of a sequential file.
A first look an ADTs Solving a problem involves processing data, and an important part of the solution is the careful organization of the data In order.
Department of Computer Science Data Structures Using C++ 2E Chapter 5 Linked Lists.
Python Arrays. An array is a variable that stores a collection of things, like a list. For example a list of peoples names. We can access the different.
The List ADT A sequence of zero or more elements A 1, A 2, A 3, … A N-1 N: length of the list A 1 : first element A N-1 : last element A i : position i.
3 Data. Software And Data Data Data element – a single, meaningful unit of data. Name Social Security Number Data structure – a set of related data elements.
Chapter 11 Data Structures. Understand arrays and their usefulness. Understand records and the difference between an array and a record. Understand the.
Subject Name : Data Structure Using C Title : Linked Lists
Data Structures Chapter 6. Data Structure A data structure is a representation of data and the operations allowed on that data. Examples: 1.Array 2.Record.
1. Circular Linked List In a circular linked list, the last node contains a pointer to the first node of the list. In a circular linked list,
Chapter Lists Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2010.
Department of Computer Science 1 Some Practice Let’s practice for the final a little bit. OK?
 Array is a data structure were elements are stored in consecutive memory location.in the array once the memory is allocated.it cannot be extend any more.
Circular linked list A circular linked list is a linear linked list accept that last element points to the first element.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand the relationship between arrays and pointers ❏ To understand the.
1 M I DAABO COURSE CODE: CSC 355 COURSE TITLE: Data Structures.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To introduce the basic concepts of linked lists ❏ To introduce the basic concepts.
Linked list: a list of items (nodes), in which the order of the nodes is determined by the address, called the link, stored in each node C++ Programming:
CHAPTER 51 LINKED LISTS. Introduction link list is a linear array collection of data elements called nodes, where the linear order is given by means of.
BITS Pilani Pilani Campus Data Structure and Algorithms Design Dr. Maheswari Karthikeyan Lecture3.
UNIT-II Topics to be covered Singly linked list Circular linked list
© Oxford University Press All rights reserved. Data Structures Using C, 2e Reema Thareja.
Data Structures: A Pseudocode Approach with C 1 Chapter 5 Objectives Upon completion you will be able to: Explain the design, use, and operation of a linear.
1 Data Organization Example 1: Heap storage management Maintain a sequence of free chunks of memory Find an appropriate chunk when allocation is requested.
Lectures linked lists Chapter 6 of textbook
Review Deleting an Element from a Linked List Deletion involves:
Data Structure and Algorithms
Chapter 8 Arrays Objectives
External Methods Chapter 15 (continued)
Chapter 15 Lists Objectives
Lecture 20 Linked Lists Richard Gesick.
Chapter 11 Data Structures.
Chapter 17: Linked Lists.
Chapter 11 Data Structures 1.
Data Structures & Algorithms
Lecture No.02 Data Structures Dr. Sohail Aslam
Chapter 9 Linked Lists.
Presentation transcript:

©Brooks/Cole, 2003 Chapter 11 Data Structures

©Brooks/Cole, 2003 Understand arrays and their usefulness. Understand records and the difference between an array and a record. Understand the concept of a linked list and the difference between an array and a linked list. After reading this chapter, the reader should be able to: O BJECTIVES Understand when to use an array and when to use a linked-list.

©Brooks/Cole, 2003 ARRAYSARRAYS 11.1

Figure 11-1 Twenty individual variables

©Brooks/Cole, 2003 Figure 11-2 Processing individual variables

©Brooks/Cole, 2003 Figure 11-3 Arrays with subscripts( 下標 ) and indexes

©Brooks/Cole, 2003 Figure 11-4 Processing an array

©Brooks/Cole, 2003 Array Applications Frequency arrays Frequency arrays –A frequency array shows the number of elements with the same value found in a series of numbers. (Fig. 11.5) Histograms Histograms –A histogram is a pictorial ( 圖示的 ) representation of a frequency array. (Fig. 11.6)

©Brooks/Cole, 2003 Figure 11-5 Frequency array

©Brooks/Cole, 2003 Figure 11-6 Histogram

©Brooks/Cole, 2003 Figure Part I Two-dimensional array

©Brooks/Cole, 2003 Figure 11-8 Memory layout “ Row-major ” storage “ Row-major ” storage

©Brooks/Cole, 2003 RECORDSRECORDS 11.2

Records A record is a collection of related elements, possibly of different types, having a single name. A record is a collection of related elements, possibly of different types, having a single name. Each element in a record is called a field. Each element in a record is called a field. A field is the smallest element of named data that has meaning. A field is the smallest element of named data that has meaning. Fig Fig. 11.9

©Brooks/Cole, 2003 Figure 11-9 Records

©Brooks/Cole, 2003 The elements in a record can be of the same or different types. But all elements in the record must be related. Note:

©Brooks/Cole, 2003 LINKEDLISTSLINKEDLISTS 11.3

Linked lists A linked list is a ordered collection of data in which each element contains the location of the next element. A linked list is a ordered collection of data in which each element contains the location of the next element. Each element contains two parts: Each element contains two parts: –Data: the data parts holds the useful information –Link: the link is use to chain the data together Example: singly linked list (Fig ) Example: singly linked list (Fig )

©Brooks/Cole, 2003 Figure Linked lists Null pointer: indicate the end of the list Null pointer: indicate the end of the list

©Brooks/Cole, 2003 Figure Node A node in a linked list is a record that has at least two fields: one contains the data, and the other contains the address of the next node in the sequence A node in a linked list is a record that has at least two fields: one contains the data, and the other contains the address of the next node in the sequence

©Brooks/Cole, 2003 Operations on linked lists Inserting a node Inserting a node Deleting a node Deleting a node Searching a list Searching a list Retrieving a node Retrieving a node Traversing a list Traversing a list Coping a list … and so on Coping a list … and so on

©Brooks/Cole, 2003 Figure Inserting a node

©Brooks/Cole, 2003 Figure Deleting a node

©Brooks/Cole, 2003 Figure Traversing a list

©Brooks/Cole, 2003 Key terms Array Array Data structure Data structure Field Field Frequency array Frequency array Histogram Histogram Link Link Linked list Linked list Loop Loop Memory Memory Node Node Null pointer Null pointer One-dimensional array One-dimensional array Pointer Pointer Record Record Row-major storage Row-major storage Search a list Search a list Singly linked list Singly linked list Subscript Subscript Two-dimensional array Two-dimensional array Variable Variable