Data Structures Using C
Data Structures Using C
Data Structures Using C
of Karnataka, Department of Technical Education Diploma in Computer Science & Engineering Third Semester Subject: DATA STRUCTURES USING C Contact Hrs / week: 4 Table of Contents
Chapter No 1 2 3 4 5 6 7 8 9 10 Topic Section I Pointers Dynamic Memory allocation Files Section II Introduction to data structures The Stack Queues Section III Linked lists Trees Sorting Searching Seminars and Guest lectures from Industry and Institute Tests Total hrs No. of Hrs 08 04 06 02 08 06 08 06 06 02 05 03 64 145 Marks 18 6 14 4 22 14 20 16 15 6
Total hrs: 64
Detailed Contents
1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 1.10 2 2.1 2.2 2.3 Pointers Concept of pointers Declaring and initializing pointers Accessing variables using pointers Pointer arithmetic Pointers and arrays Pointers and character strings Pointers and functions Pointer as a function argument Pointers to function pointers and structures Dynamic Memory allocation Introduction Dynamic memory allocation Allocating a block of memory : Malloc
2.4 2.5 2.6 3 3.1 3.2 3.3 3.4 3.5 3.6 3.7 4 4.1 4.2 4.3 4.4 5 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 5.10 5.11 5.12 5.13 5.14 6 6.1 6.2 6.3 6.4 7 7.1 7.2 7.3 7.4 7.5 7.6 7.7 7.8 8 8.1 8.2
Allocating multiple blocks of memory : Calloc Releasing the used space : Free Altering the size of memory : Realloc Files Introduction Defining and opening a file Closing a file Input / Output operations on files Error handling during I/O operations Random Access to files Command line arguments Introduction to data structures Introduction Data and information Types of data structures Primitive & non primitive data structures ND operations The Stack Definition and examples Primitive Operations- Push and Pop Representing Stacks in C Implementing Push and Pop Operations in C Applications of Stacks Infix, Postfix and Prefix Expressions Algorithm for evaluating an expression- Infix to prefix, Infix to Postfix Recursion Recursive definition Multiplication of Natural numbers Factorial Function GCD function Properties of Recursive algorithms/functions Recursion in C Queues The queue and its sequential representation C implementation of Queues and their operations C implementation of Circular queues and their operations Dequeue and priority queues(Concepts only) Linked lists Linked linear lists Inserting and removing nodes from a list Linked Implementation of Stacks and Queues Array implementation of lists in C and its limitations Linked list using dynamic variables in C Comparing the Dynamic and Array Implementation of Lists Circular linked lists (Concepts only, no implementations) Doubly linked list Trees Introduction Basic Terms
8.3 8.4 8.5 8.6 8.7 9 9.1 9.2 9.3 9.4 9.5 9.6 9.7 9.8 9.10 9.11 10 10.1 10.2 10.3 10.4
Binary trees Complete binary tree Binary tree representation Operation on binary tree Traversal of a binary tree Sorting Exchange sorts --Bubble sort --Quick sort (No implementation) Selection and tree sorting --Straight selection sort --Binary tree sort Insertion Sorts --Simple Insertion sort --Shell sort (No implementation) Merge sort and Radix sort (No implementation) Searching Introduction Searching Linear (sequential) search (without creating linked list) Binary search
General objectives: 1 Understand the concept of pointers and their operations 2 Understand the concept of dynamic memory allocation 3 Understand file handling in C Know the concepts of linear data structures, their operations and 4 applications Know the concepts of non linear data structures, their operations and 5 applications 6 Understand the various sorting and searching techniques Specific Objectives: Pointers Bring out the concepts of pointers Learn to declaring and initializing pointers Learn to access variables using pointers Explain the concepts of pointer arithmetic Explain the use of Pointers in arrays, character strings, functions, structures Files Define File Learn the I/O operations on files Distinguish between sequential & random access files
Learn to handle errors in files and command line arguments Introduction to data structures Define Information ,data and data structures Distinguish between the various types of data types: primitive and non primitive Define stack with examples Explain the Primitive Operations- Push and Pop performed on stack Write programs to Implement Push and Pop Operations in C Learn the applications of Stacks Learn about Infix, Postfix and Prefix Expressions Learn to convert expressions i.e. from Infix to postfix & prefix, Learn to convert Postfix to infix & prefix ,Prefix to infix & postfix Expressions Understand recursion: eg. Multiplication of natural numbers, Factorial and GCD Learn queue with examples and their sequential representation Learn C implementation of Queues and their operations Learn C implementation of Circular queues and their operations Learn the concepts of Dequeue and priority queues Linked list Learn the concepts of Linked linear lists, their advantages and disadvantages Write programs for Inserting and removing nodes from a list Write programs to implement of Stacks and Queues Learn Array implementation of lists in C and its limitations Implement Linked list using dynamic variables in C Examples of list operations in C Comparing the Dynamic and Array Implementation of Lists Learn concepts of Circular & doubly linked lists Trees Define Binary trees and learn their concepts Understand tree operations Learn & implement binary tree traversal operations Sorting To understand different sorting Techniques with examples To implement sorting techniques in C Searching To understand linear and binary search Techniques with examples To learn and implement linear and binary search techniques in C Text book: 1. For Chapter 1 to 3 -- Programming in ANSI C, E.Balagurusamy, 4E, Tata McGraw Hill, ISBN: 9780070648227 2. For Chapters 5, 6, 7, 9,10 -- DATA STRUCTURES USING C AND C++, Langsam yedidyah, Augenstein moshe j., Aron M. Tenenbaum , Second Edition, PHI 3. For Chapters 4 and 8 -- Introduction to Data Structures in C, Ashok N Kamthane, Third impression 2009, Pearson Education, ISBN : 9788131713921
Reference Books: 1. C and data Structures, Dr.N.B. Venkateshwarulu and Dr.E.V Prasad, S chand Publications 2. Data structures Using C, Aron M. Tenenbaum ,langsam yedidyah, Augenstein moshe j. , PHI 3. C and Data Structures, Prof. P S Deshapande and Prof. O G Kakde
5. a) What is recursion ? Explain with an example. b) Convert the following expressions to postfix i. (A + B) * (C - D) $ E * F ii. ((A (B + C) * D) $ (E + F) c) Define Queue. 6. a) Write a program to implement Circular Queues in C b) Write a note on Priority queues. 7. a) Write an algorithm to insert a node into a linked list. b) Compare the Dynamic and Array Implementation of Lists.
7 6
2 10 5 8 7
Section IV 8. a) Explain Doubly linked list. b) Write the tree traversal algorithms. 9. a) Construct the binary tree for the following data 15,4,8,9,2,13,1,6,10,11,14 b) Write a program to implement simple insertion sort and trace with an example. 10. a) Explain tree sorting with an example. b) Write a program to perform binary search using recursion. 10 8 7 5 10 5