Sei sulla pagina 1di 3

ASSIGNMENT-1(Array)

1.Program to insert, delete and search an element in an array


Program to insert, delete and search an element in an array is discussed here. Given an
array, the array operations like insert, delete and search an element in an array are performed and
the result is displayed.
If the position where the element to be inserted is greater than the size of an array
display Invalid Input.
Input format:

 Input consists of 3 integers and 1 array.


 Input the size of the array.
 Input the array elements.
 Input the position where the element should be inserted.
 Input the element to be inserted in that position.

2. Finding the Smallest and Largest Element in an Array


3. Program to check if two arrays are equal or not 
4. Program to find the largest palindrome in an array 
5. Program to remove duplicate elements in an array
6. Program to find the frequency of each element of an array 
7. Sort an Array According to the Order defined by Another array
For example,
Array A [] = {3, 6, 13, 3, 9, 10, 14, 6, 9, 13}
Array B[] = {6, 3, 9, 13, 10}
Output: {6, 6, 3, 3, 9, 9, 13, 13, 10, 14}
8. Find the Equilibrium Index of an Array
Program to find the equilibrium index of an array is discussed here. Equilibrium index
of an array is an index such that
Sum of elements at lower indexes = Sum of elements at higher indexes.
For example, consider the array a[] = {-7, 1, 5, 2, -4, 3, 0}. Here, a[0] + a[1] + a[2] =
a[4] + a[5] + a[6]. Hence, 3 is the equilibrium index.
9, Array Rotation | Program for Left and Right Rotation of an Array.
Array Rotation simply means shifting the array elements to the left or right of the
array by specified positions. An array can be rotated to the left(clockwise) or to the right
(anti-clockwise) to the given number of positions. Now let us look at a program for left
rotation of an array and right rotation of an array.
  Left Rotation of Array 
Left rotation of an array means shifting of the elements in an array towards the left as
shown in the below image. Left rotation means rotating the elements of the array in a
clockwise direction to the specified number of positions.
10. Array into Zigzag Fashion | Convert the given array into zigzag pattern.
Printing an array into Zigzag fashion is discussed here. Suppose you were
given an array of integers, and you are told to sort the integers in a zig-zag pattern. In
general, in a zig-zag pattern, the first integer is less than the second integer, which is
greater than the third integer, which is less than the fourth integer, and so on. Hence,
the converted array should be in the form of e1 < e2 > e3 < e4 > e5 < e6.

ASSIGNMENT-2(STRING)
1.Program to reverse a string.
2.Program to concatenate two strings.
3.Program to compare two strings.
4.Program to find the length of a string without using strlen()
function.
5.Program to find the length of a string using pointers.
6.Program to display the number of vowels in a given character
array.

7.Program to check if the given character is a vowel or consonant


using if-else.
8.Program to check if the given character is a vowel or consonant
using switch case.

Algorithm to check whether a given character is upper case,


lower case, number or special character
 Input the character.
 Find the ASCII value of the character.
 If the ASCII value of the character is between 65 and 90, print "Upper".
 If the ASCII value of the character is between 97 and 122, print "Lower".
 If the ASCII value of the character is between 48 and 57, print "Number".
 Else, print "Symbol".

9.Program to check whether a given character is upper case, lower


case, number or special character .

Potrebbero piacerti anche