C Programming with Array and Linked List This

  • Slides: 15
Download presentation
C++ Programming with Array and Linked List This work created by Mr. Mithilesh Agrawal

C++ Programming with Array and Linked List This work created by Mr. Mithilesh Agrawal is licensed under the Creative Commons Attribution-Non Commercial 4. 0 International License. You are free to use, distribute and modify it, including for commercial purposes, provided you acknowledge the source.

* Learning Objectives Know & Identify Data structure and its categories v List down

* Learning Objectives Know & Identify Data structure and its categories v List down types of data structure under each categories v Explain the implementation of Arrays and Linked List in memory v Demonstrate the working of Arrays and Linked List v Write the algorithm and C++ Program for insertion into and deletion from Linked List and Arrays. v * Target v Audience Std. XI & XII, BCS, BCA, M. Sc. (CS), MCA * Tags of OER: Data Structure, Array, Linked List, Array Insertion algorithm v Array insertion program, Linked List deletion program v * Tools v used in OER Creation Power point Presentation which is to be uploaded on MOODLE site which is created as a OER. 2

Topics Covered What is Data Structure? * Introduction of an Array * Representation of

Topics Covered What is Data Structure? * Introduction of an Array * Representation of Array in Memory * Insertion and Deletion operation in an Array * Introduction to Linked List * Representation of Linked List in Memory * Insertion Operation * References * 3

Data Structure * A data structure is a way of organizing data that considers

Data Structure * A data structure is a way of organizing data that considers not only the items stored, but also their relationship to each other. * In general, day to day life, if we want to store any data in an well organized manner so that we can perform any operation like addition, deletion, updation then it can be done very effectively. 4

Reflection Spot on Array Reflection Spot: * Before going to next slide, pause for

Reflection Spot on Array Reflection Spot: * Before going to next slide, pause for a minute, think and write down the answer in your diary. * What are the different types of data structure available? 5

Data Structure * Two types of Data Structure are there: n Linear n Non

Data Structure * Two types of Data Structure are there: n Linear n Non * Data Structure and – linear Data Structure Arrays, Linked List, Stacks and Queues belong to linear Data structure. * Graphs and Trees belong to Non – linear data structure 6

Linear Data Structure - Arrays * Arrays are the most common Data Structure used

Linear Data Structure - Arrays * Arrays are the most common Data Structure used to store collections of elements in sequential order or in linear order. * Collection of elements are of Homogenous type i. e. of the same data type. * Linear Relationship between elements represented by means of Sequential Memory Locations. 7

Reflection Spot on Array Reflection Spot: * Before going to next slide, pause for

Reflection Spot on Array Reflection Spot: * Before going to next slide, pause for a minute, think and write down the answer in your diary. * How the linear data structure – Array implemented in memory? 8

Implementation of an array in Memory Marks 1000 * For Example: Consider an array

Implementation of an array in Memory Marks 1000 * For Example: Consider an array marks[10] which is represented in memory 1004 1006 1008 1010 Marks[10] Array Name 1002 1012 Index / Subscript 1014 1016 Figure: Memory Allocation of array name as Marks 1018 55 76 89 67 90 98 77 65 60 79 9

Reflection Spot: * Before going to next slide, pause for a minute, think and

Reflection Spot: * Before going to next slide, pause for a minute, think and write down the answer in your diary. * List out the some limitations of an Array. 10

Limitations of Arrays * The size of array is fixed i. e. it is

Limitations of Arrays * The size of array is fixed i. e. it is in static nature. * Memory space is wasted if defined length is more and have store less number of elements. * Inserting, Deletion, Searching operations is expensive when the array having large number of elements. 11

Assessment * The memory address of the first element of an array is called

Assessment * The memory address of the first element of an array is called a. floor address b. foundation address c. first address d. base address * Which of the following data structures are indexed structures? a. linear arrays b. linked lists c. both of above d. none of above * An array elements are always stored in ____ memory locations. a. Sequential b. Random c. Sequential & Random d. None of the above 12

Assessment * What do you mean by an array? *What * is meant by

Assessment * What do you mean by an array? *What * is meant by index of an element? What is the data type of elements of an array called? * What is the need for arrays? * Element amount[9] is which element of the array? 1. The eights 2. the ninth 3. the tenth 13

Reference * Data Structure – Lipschutz * Computer Science with C++ - Sumita Arora

Reference * Data Structure – Lipschutz * Computer Science with C++ - Sumita Arora * Programming in C & C++ - S. S. Khandare 14

Thank You !!! 15

Thank You !!! 15