Monday, February 21, 2011

C & Data Structure By Practice







CONTENTS
Forward (vii)
Preface (ix)
1. Around the World of C 1
1.1 Welcome to C Language 1
1.2 Arrays Implementation 4
1.3 Use of Structure to Implement Foot Balls Problem 6
1.4 Exploit C Files to Store Data About Foot Balls 8
2. Programming Basics 19
2.1 Introduction 19
2.1.1 Flow Chart 19
2.2 Algorithms 21
2.3 Program Development Steps 22
2.4 About A, B, and C Language 23
23
2.5 Structure of C Language
2.6 C Language Basics–Tokens,Variables, and Keywords 24
2.7 Data Types 25
2.8 Constants 26
2.8.1 Declaration and Assignment Values to Variables 29
2.9 Expressions 29
2.10 Arithmetic Operators 31
2.11 Relational and Logical Operators 32
2.12 Precedence and Association of Operators 34
2.13 Input and Output Statements 35
3. Control Statements 51
3.1 Conditional and Branching Statements 51
3.1.1 If Statement 51
3.1.2 If-Else Statement 52
3.2 If-Else-If Statement 53
3.3 Switch and Case Statements 55
3.4 Control Loops 56
3.4.1 While Loop 56
3.4.2 Do-while Loop 58
3.4.3 For Loop 60
3.4.4 When to Use For or While or Do-while 62
3.5 Break and Continue 62
3.5.1 Break 62
3.5.2 Continue Statement 63
3.6 Goto Statements 64
3.7 Exit Function 65
4. Functions and Storage Classes 77
4.1 Why Use Functions? 77
4.2 Communication Between Functions 79
4.3 Call By Value 80
4.4 Call By Reference 80
4.5 Recursion 82
83
4.6 Storage Classes in C Language
4.6.1 Memory Organization and Mapping of C Language 84
4.6.2 Types of Storage Classes 85
4.7 Header Files 90
4.8 C Preprocessor 90
4.8.1 Macro Expansion 91
4.8.2 Macro Definition with Arguments 91
4.8.3 File Inclusion 92
4.8.4 Conditional Inclusion 93
4.8.5 Conditional Compilation #Ifdef and #Ifndef Statements 94
4.8.6 #undef 94
4.8.7 #error Macros 95
5. Arrays & Strings 103
5.1 How Arrays Are Stored in the Memory 104
5.2 Array Initialization 105
5.3 Multi Dimensional Arrays 106
5.4 Character Array-String Handling in C Language 110
5.5 String.h-Library Function 111
6. Pointers 125
6.1 What, Why and How of Pointers 125
6.2 Declaration & Usage 125
6.3 Call By Value & Call By Reference 127
6.4 Dynamic Memory and Malloc() & Calloc() 128
6.5 Pointers and Arrays 129
6.6 Pointers and Multi Dimensional Arrays 131
6.6.1 Two Dimensional Arrays & Printers 131
6.6.2 Three Dimensional Arrays & Printers 134
6.6.3 Array of Pointers 134
6.7 Pointers to Void 135
6.8 Pointer to Pointers 136
7. Structures & Unions 151
7.1 Let Us Declare & Define a Structure 151
7.2 Initialization of Values to Structure 152
7.3 First Problem Using Structure 153
7.4 Input & Output Using Structures 154
7.5 Passing of Structure Elements as Arguments to a Function 156
157
7.6 Pass a Structure as an Argument to a Function
7.7 Pass a Pointer to a Structure as an Argument to a Function 160
7.8 Create a Pointer to a Structure 162
7.9 Passing Array of Structures to a Function 165
7.10 Sorting an Array of Structures 167
7.11 Unions 170
8. Files 179
8.1 Introduction to Files 179
8.2 File Types 180
8.3 Input-output (IO) Functions 180
8.3.1 Errors While Opening Files 183
8.3.2 Checking for End of File 183
8.3.3 More Streaming Functions 189
8.3.4 Stream Functions for Writing Structures on to File 192
8.4 Command Line Arguments 199
9. Linear Data Structures 213
9.1 Introduction to Data Structures 213
9.2 Single Linked Lists 214
9.3 Linked Lists Functions 215
9.4 Reverse List 225
9.5 Double Linked Lists 229
10. Stacks 243
10.1 Introduction 243
10.2 Stack Operations 243
10.3 Array Implementation of Stack Data Structure 244
10.4 Stack Implementation Using Linked Lists 250
10.5 Applications of Stack 253
10.5.1 Infix to Postfix Notation 253
10.5.2 Evaluation of Postfix Expression 257
11. Queues 275
11.1 Introduction to Queues 275
11.2 Array Representation of Queue 277
11.2.1 Algorithm for Addition of an Element to the Queue 277
11.2.2 Algorithm for Deletion of an Element to the Queue 277
11.3 Dynamic Representation of Queues Using Linked Lists 281
11.4 Circular Queue-Array Representation 286
12. Non Linear Data Structures: Trees 299
12.1 Trees Why–What–How 299
12.2 Terminology and Definitions of Tree 302
12.3 Binary Tree 303
12.4 Binary Search Tree 305
12.4.1 Creating Binary Tree 305
12.4.2 Insertion in a BST 305
12.4.3 Deletion in a BST 306
12.4.4 Searching a Binary Search Tree 307
12.5 Tree Traversals 315
12.6 Non Recursive Algorithms for BST 324
13. Graphs 345
13.1 Introduction 345
13.2 Graph Representation 348
13.2.1 Adjacency Matrix Representation 348
13.2.2 Adjacency List Representation 350
13.3 Graph Traversals 352
13.3.1 Depth First Search Algorithm 353
358
13.3.2 Breadth First Search Algorithm
13.4 Minimal Spanning Trees (MST) 364
13.4.1 MST Problem 364
13.4.2 Example of Spanning Tree Problem 365
13.4.3 Kruskal’s Algorithm for MST 366
13.4.4 Prims Algorithm for MST 370
14. Searching and Sorting 375
14.1 Introduction 375
14.2 Big Oh-O Notation 376
14.3 Efficiency Considerations in Sorting Algorithms 377
14.4 Searching 377
14.4.1 Linear Search 378
14.4.2 Analysis of Linear Search 378
14.5 Binary Search 380
14.5.1 Binary Search Algorithm 380
14.6 Bubble Sort 384
14.7 Selection Sort 387
14.8 Insertion Sort 390
14.9 Quick Sort 395
14.10 Heap Sort 400
15. JNTU Question Papers and Solutions 419


Another C Books
Another The Core of CS Books
Download

No comments:

Post a Comment

Related Posts with Thumbnails

Put Your Ads Here!