Posts

DATA STRUCTURE : ASSIGNMENT-3:SORTING TECHNIQUES(RECURSIVE)

 PRACTICE PROGRAM: 1) Write a C program to create a integer array with elements {888,111,666,444,222,999,333}  and sort the given array using Merge sort. ANS: #include <stdio.h> #include <conio.h> void merge(int a[], int first, int mid, int last) {     int i, j, k, b[20];     i = first;     j = mid + 1;     k = 0;     while (i <= mid && j <= last)     {         if (a[i] < a[j])         {             b[k++] = a[i++];         }         else         {             b[k++] = a[j++];         }     }     while (i <= mid)     {         b[k++] = a[i++];     }     while (j <= last)     {         b[k++] = a[j++];   ...

DATA STRUCTURE -ASSIGNMENT NO.1:

 PRACTICE PROGRAM: 1) Write a menu driven C program to perform the following operation on an integer array: a) Display the sum of elements at even subscript position of array b) Display the sum of elements at odd subscript position of array ANS: #include <stdio.h> #include <conio.h> int main() {     int a[10], i, n;     int choice, sum = 0;     printf("\n enter array limit:");     scanf("%d", &n);     printf("\n enter array elements:");     for (i = 0; i < n; i++)     {         scanf("%d", &a[i]);     }     printf("\n 1.sum of all even index element of an array.\n");     printf("\n 2.sum of all odd index element of an array.\n");     printf("\n.................................................!");     printf("\n enter your choice:");     scanf("%d", &choice);     switch (choice)     { ...

DATA STRUCTURE-ASSIGNMENT NO.2:

 PRACTICE PROGRAMS: 1) Write a C program to create a integer array with elements {56,23,11,67,12,89,2} and sort  the given array using bubble sort. ANS: #include <stdio.h> #include <conio.h> int main() {     int a[] = {56, 23, 11, 67, 12, 89, 2};     int i;     int temp, pass;     printf("\n the input array is: ");     for ( i = 0; i < 7; i++)     {         printf("\t%d",a[i]);     }          for (pass = 1; pass < 7; pass++)     {         for (i = 0; i < 7 - pass; i++)         {             if (a[i] > a[i + 1])             {                 temp = a[i];                 a[i] = a[i + 1];                 a[i + 1] = te...

PHP-ASSIGNMENT NO.2

PRACTICE PROGRAM :- 1. Write a PHP Script to display a maximum of two numbers. ANS: HTML CODE: <!DOCTYPE html> <html lang="en"> <head>     <meta charset="UTF-8">     <meta http-equiv="X-UA-Compatible" content="IE=edge">     <meta name="viewport" content="width=device-width, initial-scale=1.0">     <title>Document</title> </head> <body>     <form action="Q1.php">         <h1>finding maximum of two number!</h1>         Enter first number: <input type="text" name="first" ><br>         <br>         Enter second number: <input type="text" name="second"><br>         <br>         <button>max is!</button>     </form> </body> </html> PHP SCRIPT: <?php     $n1 = $_G...