Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 7: Array.

Similar presentations


Presentation on theme: "Chapter 7: Array."— Presentation transcript:

1 Chapter 7: Array

2

3 Array: Introduction Many application require the processing of multiple data items that have common characteristics Array is the best option of variable to store such data which shares common name An array is a collection of data items, all of the same type, accessed using a common name. An array is a datastructure containing number of data value, all of which have the same datatype Common name is followed one or more subscripts

4 Array: Declaration Similar to normal variable but size should be defined Syntax: data_type array_name[size] Example: int roll[50];

5 Array: initialization

6 Getting values from user in array
Can be done using loop Eg:

7

8 Example 1: Program to enter n element in array and display their sum

9 Example 2: Program to enter array and display in reverse order
Program to find maximum and minimum number in array Program search a element in array

10 Example 3: Program to convert lowercase to uppercase

11 Best Appreciation Ever Made

12 Multi-dimentional Array
Syntax: data_type array_name[size1][size2]….[] Can be effectively used using n-nested loop

13 Multi-dimentional array example
Program to add, subtract two matric Program to Transpose matrix Program to find lower and upper triangular matrix Program to replace all no diagonal element to zero Program to find sum of all element in matrix Program to find sum of diagonal element

14 Sorting – Bubble sort

15 Bubble – Sort Implementation

16 Searching – Linear Search

17 Searching – binary search


Download ppt "Chapter 7: Array."

Similar presentations


Ads by Google