You are previewing Data Structure Using C.
O'Reilly logo
Data Structure Using C

Book Description

A data structure is the logical organization of a set of data items that collectively describe an object. Using the C programming language, this book describes how to effectively choose and design a data structure for a given situation or problem.

Table of Contents

  1. Cover
  2. Title Page
  3. Contents
  4. About the Author
  5. Dedication
  6. Preface
  7. Chapter 1: Overview of ‘C’
    1. 1.1 The History
    2. 1.2 Characters Used in ‘C’
    3. 1.3 Data Types
      1. 1.3.1 Integer Data Type (int)
      2. 1.3.2 Character Data Type (char)
      3. 1.3.3 The Floating Point (float) Data Type
    4. 1.4 C Tokens
      1. 1.4.1 Identifiers
      2. 1.4.2 Keywords
      3. 1.4.3 Variables
      4. 1.4.4 Constants
    5. 1.5 Structure of a ‘C’ Program
      1. 1.5.1 Our First Program
    6. 1.6 printf() and scanf() Functions
      1. 1.6.1 How to Display Data Using printf() Function
      2. 1.6.2 How to Read Data from Keyboard Using scanf()
    7. 1.7 Comments
    8. 1.8 Escape Sequence (Backslash Character Constants)
    9. 1.9 Operators and Expressions
      1. 1.9.1 Arithmetic Operators
      2. 1.9.2 Relational and Logical Operators
      3. 1.9.3 Conditional Operator
      4. 1.9.4 Order of Evaluation of Expressions
      5. 1.9.5 Some Special Operators
      6. 1.9.6 Assignment Operator
      7. 1.9.7 Bitwise Shift Operators
    10. 1.10 Flow of Control
      1. 1.10.1 The Compound Statement
      2. 1.10.2 Selective Execution (Conditional Statements)
      3. 1.10.3 Repetitive Execution (Iterative Statements)
      4. 1.10.4 The exit() Function
      5. 1.10.5 Nested Loops
      6. 1.10.6 The Goto Statement (Unconditional Branching)
    11. 1.11 Input-Output Functions (I/O)
      1. 1.11.1 Buffered I/O
      2. 1.11.2 Single Character Functions
      3. 1.11.3 String-based Functions
    12. 1.12 Arrays
    13. 1.13 Structures
      1. 1.13.1 Defining a Structure in ‘C’
      2. 1.13.2 Referencing Structure Elements
      3. 1.13.3 Arrays of Structures
      4. 1.13.4 Initializing Structures
      5. 1.13.5 Assignment of Complete Structures
      6. 1.13.6 Nested Structures
    14. 1.14 User-defined Data Types
      1. 1.14.1 Enumerated Data Types
    15. 1.15 Unions
    16. 1.16 Functions
      1. 1.16.1 Function Prototypes
      2. 1.16.2 Calling a Function
      3. 1.16.3 Parameter Passing in Functions
      4. 1.16.4 Returning Values from Functions
      5. 1.16.5 Passing Structures to Functions
  8. Chapter 2: Data Structures and Algorithms: An Introduction
    1. 2.1 Overview
    2. 2.2 Concept of Data Structures
      1. 2.2.1 Choice of Right Data Structures
      2. 2.2.2 Types of Data Structures
      3. 2.2.3 Basic Terminology Related with Data Structures
    3. 2.3 Design of a Suitable Algorithm
      1. 2.3.1 How to Develop an Algorithm?
      2. 2.3.2 Stepwise Refinement
      3. 2.3.3 Using Control Structures
    4. 2.4 Algorithm Analysis
      1. 2.4.1 Big-Oh Notation
  9. Chapter 3: Arrays: Searching and Sorting
    1. 3.1 Introduction
    2. 3.2 One-dimensional Arrays
      1. 3.2.1 Traversal
      2. 3.2.2 Selection
      3. 3.2.3 Searching
      4. 3.2.4 Insertion and Deletion
      5. 3.2.5 Sorting
    3. 3.3 Multi-dimensional Arrays
    4. 3.4 Representation of Arrays in Physical Memory
      1. 3.4.1 Physical Address Computation of Elements of One-dimensional Arrays
      2. 3.4.2 Physical Address Computation of Elements of Two-dimensional Arrays
    5. 3.5 Applications of Arrays
      1. 3.5.1 Polynomial Representation and Operations
      2. 3.5.2 Sparse Matrix Representation
  10. Chapter 4: Stacks and Queues
    1. 4.1 Stacks
      1. 4.1.1 Stack Operations
    2. 4.2 Applications of Stacks
      1. 4.2.1 Arithmetic Expressions
    3. 4.3 Queues
      1. 4.3.1 Queue Operations
      2. 4.3.2 Circular Queue
      3. 4.3.3 Priority Queue
      4. 4.3.4 The Deque
  11. Chapter 5: Pointers
    1. 5.1 Introduction
      1. 5.1.1 The ‘&’ Operator
      2. 5.1.2 The ‘*’ Operator
    2. 5.2 Pointer Variables
      1. 5.2.1 Dangling Pointers
    3. 5.3 Pointers and Arrays
    4. 5.4 Array of Pointers
    5. 5.5 Pointers and Structures
    6. 5.6 Dynamic Allocation
      1. 5.6.1 Self Referential Structures
  12. Chapter 6: Linked Lists
    1. 6.1 Introduction
    2. 6.2 Linked Lists
    3. 6.3 Operations on Linked Lists
      1. 6.3.1 Creation of a Linked List
      2. 6.3.2 Travelling a Linked List
      3. 6.3.3 Searching a Linked List
      4. 6.3.4 Insertion in a Linked List
      5. 6.3.5 Deleting a Node from a Linked List
    4. 6.4 Variations of Linked Lists
      1. 6.4.1 Circular Linked Lists
      2. 6.4.2 Doubly Linked List
    5. 6.5 The Concept of Dummy Nodes
    6. 6.6 Linked Stacks
    7. 6.7 Linked Queues
    8. 6.8 Comparison of Sequential and Linked Storage
    9. 6.9 Solved Problems
  13. Chapter 7: Trees
    1. 7.1 Introduction
    2. 7.2 Basic Terminology
    3. 7.3 Binary Trees
      1. 7.3.1 Properties of Binary Trees
    4. 7.4 Representation of a Binary Tree
      1. 7.4.1 Linear Representation of a Binary Tree
      2. 7.4.2 Linked Representation of a Binary Tree
      3. 7.4.3 Traversal of Binary Trees
    5. 7.5 Types of Binary Trees
      1. 7.5.1 Expression Tree
      2. 7.5.2 Binary Search Tree
      3. 7.5.3 Heap Trees
      4. 7.5.4 Threaded Binary Trees
  14. Chapter 8: Graphs
    1. 8.1 Introduction
    2. 8.2 Graph Terminology
    3. 8.3 Representation of Graphs
      1. 8.3.1 Array-based Representation of Graphs
      2. 8.3.2 Linked Representation of a Graph
      3. 8.3.3 Set Representation of Graphs
    4. 8.4 Operations of Graphs
      1. 8.4.1 Insertion Operation
      2. 8.4.2 Deletion Operation
      3. 8.4.3 Traversal of a Graph
      4. 8.4.4 Spanning Trees
      5. 8.4.5 Shortest Path Problem
    5. 8.5 Applications of Graphs
  15. Chapter 9: Files
    1. 9.1 Data and Information
      1. 9.1.1 Data
      2. 9.1.2 Information
    2. 9.2 File Concepts
    3. 9.3 File Organization
    4. 9.4 Files in ‘C’
    5. 9.5 Files and Streams
    6. 9.6 Working with Files Using Stream I/O
      1. 9.6.1 Opening of a File
      2. 9.6.2 Unformatted File I/O Operations
      3. 9.6.3 Formatted File I/O Operations
      4. 9.6.4 Reading or Writing Blocks of Data in Files
    7. 9.7 Sequential File Organization
      1. 9.7.1 Creating a Sequential File
      2. 9.7.2 Reading and Searching a Sequential File
      3. 9.7.3 Appending a Sequential File
      4. 9.7.4 Updating a Sequential File
    8. 9.8 Direct File Organization
    9. 9.9 Indexed Sequential Organization
      1. 9.9.1 Searching a Record
      2. 9.9.2 Addition/Deletion of a Record
      3. 9.9.3 Storage Devices for Indexed Sequential Files
      4. 9.9.4 Multilevel Indexed Files
    10. 9.10 Choice of File Organization
    11. 9.11 Graded Problems
  16. Chapter 10: Advanced Data Structures
    1. 10.1 AVL Trees
      1. 10.1.1 Searching an AVL Tree
      2. 10.1.2 Inserting a Node in an AVL Tree
    2. 10.2 Sets
      1. 10.2.1 Representation of Sets
      2. 10.2.2 Operations on Sets
      3. 10.2.3 Applications of Sets
    3. 10.3 Skip Lists
    4. 10.4 B-Trees
      1. 10.4.1 Searching a Key in a B-Tree
      2. 10.4.2 Inserting a Key in a B-Tree
      3. 10.4.3 Deleting a Key from a B-Tree
      4. 10.4.4 Advantages of B-trees
    5. 10.5 Searching by Hashing
      1. 10.5.1 Types of Hashing Functions
      2. 10.5.2 Requirements for Hashing Algorithms
      3. 10.5.3 Overflow Management (Collision Handling)
  17. Appendix A ASCII Codes (Character Sets)
  18. Appendix B Table of Format Specifiers
  19. Appendix C Escape Sequences
  20. Notes
  21. Copyright