## Array C++ Insertion Sort

by Dinesh Thakur Category: Array Pointer and Union

Insertion Sort is a sorting technique based on the idea of inserting a new element in a set of given elements so that the resulting elements are also in sorted order. Suppose a set of 4 elements A[0], A[l], A[2], A[3] are to be sorted in ascending order. Initially sort A[0]and A[l] in ascending order. If A[l] is less than A[0], interchange their positions. Otherwise the positions of the elements remain the same. Next insert A[2] in the appropriate position so that the resulting array A[0], A[l] and A[2] remain sorted. The process is repeated in this manner.

## Array C++ Selection Sort

by Dinesh Thakur Category: Array Pointer and Union

In this method, the smallest item in a given series of n elements is found and is placed in the first position. Then the smallest item from the remaining (n-l) elements is found and is placed in the second position and so on. This method requires (n-l) passes for arranging n elements.

## Array C++ Bubble sort

by Dinesh Thakur Category: Array Pointer and Union

In Bubble sort, two consecutive elements in a given list are compared and their positions in the given list (array) are interchanged in ascending or descending order as desired. Consider the following series of numbers, which are to be arranged in ascending or descending order. The series of numbers to be arranged are presented in the form of an array. The input array has the following form:

## C++ Const Declaration for the size of an array

by Dinesh Thakur Category: Array Pointer and Union

## C++ Declaration of One Dimensional Arrays

by Dinesh Thakur Category: Array Pointer and Union

Arrays are declared as follows:

int p[5];

float temp[30];

char a[7];

## How to Declaring Array of Structures in c++

by Dinesh Thakur Category: Array Pointer and Union

An array of structures refers to an array in which each element is of structure type. To declare an array of structures, firstly, a structure is defined and then an array of that structure is declared. The syntax for declaring an array of structures is

## How to Declaring Nested Structures in c++

by Dinesh Thakur Category: Array Pointer and Union

Like other user defined data types, a structure can also include another structure, as its member, in its definition. A structure defined within another structure is known as a nested structure.

## How to Declaring and Accessing Structure Variables in c++

by Dinesh Thakur Category: Array Pointer and Union

A structure can be used in a program only if memory is allocated to it. The structure definition informs the compiler about the type and the number of data members in the structures. However, it does not allocate any memory for the structure. To use a structure in a program efficiently, a structure variable needs to be declared. The syntax for declaring a structure variable is

## Defining Structures in C++

by Dinesh Thakur Category: Array Pointer and Union

Like arrays, structures are also used to store a list of data items in a single variable. However, these data items may be of different data types. Structures are used whenever a programmer requires binding the same or different types of related data items together into a single entity.

## Multi-Dimensional Arrays in c++.

by Dinesh Thakur Category: Array Pointer and Union

Multi-dimensional arrays can be described as 'arrays of arrays', that is, each element of the array is itself an array. A multi-dimensional array of dimension n is a collection of items that are accessed with the help of n subscript values.

## Single-Dimensional Arrays in c++.

by Dinesh Thakur Category: Array Pointer and Union

A single-dimensional array is the simplest form of an array that requires only one subscript to access an array element. Like an ordinary variable, an array must have been declared before it is used in the program. The syntax for declaring a single-dimensional array is

## Difference between Structures and Unions

by Dinesh Thakur Category: Array Pointer and Union

Both the structures and unions are syntactically and functionally same, however, they differ in the way memory is allocated to their members. While declaring structure variables, the different members are stored in different, although, adjacent memory locations whereas different members of a union variable share the same memory location. The amount of memory sufficient to hold the largest member of a union is allocated to a union variable. Thus, a union enables the same block of memory to store variable of one type at one time and of different type at another time. To understand the concept of memory allocation to a union, consider these statements.

## Write A C++ Program Using Array Of Objects To Display Area Of Multiple Rectangles.

by Dinesh Thakur Category: Array Pointer and Union

## Write A C++ Program Using Reference Variable To Create Dynamic Objects.

by Dinesh Thakur Category: Array Pointer and Union

## Write A C++ Program To Depict Working Of Constructor & Destructor In Operations Performed Dynamically.

by Dinesh Thakur Category: Array Pointer and Union

## Write A C++ Program To Depict Use Of New & Delete Operators.

by Dinesh Thakur Category: Array Pointer and Union

## Write A C++ Program To Assign The Public Object Member Address To A Pointer.

by Dinesh Thakur Category: Array Pointer and Union

## Write A C++ Program For Using Class Pointer And Class Array Together.

by Dinesh Thakur Category: Array Pointer and Union

## Write A C++ Program For Adding Rational Numbers & Display OUTPUT As Numerator / Denominator.

by Dinesh Thakur Category: Array Pointer and Union

## Write A C++ Program To Incrementing And Decrementing An Object Pointer

by Dinesh Thakur Category: Array Pointer and Union

Page 10 of 18