Monday, August 28, 2023

SYB.B.A.(C.A.) Sem III : Data Structure Slip 17 Que - 1 B

SAVITIBAI PHULE UNIVERSITY OF PUNE

S. Y. B.B.A. (C.A.) Semester III

Practical Examination

Lab Course: (CA-306) Computer Laboratory Based on 302, 304 and 305 Data Structure, Angular JS/ PHP, Big Data / Block Chain 

/* Q.1 B) Write a 'C' program to accept the names of cities and store them in array. Accept the city name from user and use linear search algorithm to check whether the city is present in array or not */

#include<stdio.h>

#include<stdlib.h>

#define MAX 30

void CreateArray(char A[][MAX], int n)

{

     int i = 0;

     fflush(stdin);   

     printf("\n\nEnter the City names to store into the Array: \n");

     for ( i = 0; i < n; i++)

          fgets(A[i], sizeof(A[i]), stdin);

}

void DisplayArray(char A[MAX][MAX], int n)

{

     int i = 0;

     printf("\n\nThe City names are: \n");

     for ( i = 0; i < n; i++)

         printf("%s", A[i]);  

}

void LinearSearch(char A[][MAX], int n, char key[])

{

     int i = 0, flag = 0;

     for ( i = 0; i < n; i++){

         if ( strcmp(A[i], key) == 0){

              flag = 1;

              break;

         }

    }

     if (flag == 1)

        printf("\n\nThe %s city search at %d position in the Array", key, i+1);

     else

          printf("\n %s city not found in the Array\n", key); 

}

int main(){

    char A[MAX][MAX],  key[MAX];

    int num = 0, i=0;

    printf("Enter How many cities we want to in the array: ");

    scanf("%d", &num);

   CreateArray(A, num);

   DisplayArray(A, num);

   printf("\n\nEnter City name we want to search in the array: ");

   fgets(key, sizeof(key), stdin);

   LinearSearch(A, num, key);

   printf("\n\n");

    system("pause");

    return 0;

}

Sunday, August 20, 2023

SYB.B.A.(C.A.) Sem III : Data Structure Slip 10 Que - 1 B

SAVITIBAI PHULE UNIVERSITY OF PUNE

S. Y. B.B.A. (C.A.) Semester III

Practical Examination

Lab Course: (CA-306) Computer Laboratory Based on 302, 304 and 305 

Data Structure, Angular JS/ PHP, Big Data / Block Chain

/* 

   Q.1 B) Write a 'C' program to sort randomly generated array elements using insertion sort method. 

    (Use Random Function)

*/

#include<stdio.h>

#include<stdlib.h>

#define MAX 100


// CheckFor:  Create new Array 

void CreateArray(int A[], int n){

     

     // CheckFor: Declaration of local variable

     int i = 0;

        

     // LoopFor: Assingn the random array elements

     for ( i = 0; i < n; i++)

          A[i] = rand(); 

}


// CheckFor:  Display the Array

void DisplayArray(int A[], int n){


     // CheckFor: Declaration of local variable     

     int i = 0;

     

     // LoopFor: Display the array elements

     for ( i = 0; i < n; i++)

          printf("%d \t", A[i]); 

}


// CheckFor:  Sort the Array Element using Insertion Sort Algorithm

void InsertionSort(int A[], int n){

     

     // CheckFor: Declaration of local variable

     int i = 0, j = 0, key = 0;

     

     // LoopFor: Moving the Array from first to last element

     for( i = 1; i < n; i++){

          

          // CheckFor: Assign the first element of unsorted array for the key

          key = A[i];

          

          // LoopFor: Check the accurate position of the key element.

          for( j = i-1; (j >= 0) && (key < A[j]); j--){

                    A[j+1] = A[j];

          }

          

          // CheckFor: Place the accurate position of the key element.

          A[j+1] = key;

     }

     

     // CheckFor: Display the Sorted Array 

     printf("\n\nThe Sorted Array after Insertion Sort is: \n\n");

     for ( i = 0; i < n; i++)

         printf("%d \t", A[i]);   

}


int main(){

    int A[MAX], num = 0;

    

    // Accept the n number from user

    printf("Enter How many element we want to in array: ");

    scanf("%d", &num);

    

    // create n random element array

    CreateArray(A, num);

    

    // Display the given array

    printf("\n\nThe given array elements are:  \n\n");

    DisplayArray(A, num);

    

    // Sort the element using insertion sort algorithm

    InsertionSort(A, num);

    

    printf("\n\n");

    system("pause");

    return 0;

}

SYBSc(CS) Sem III : Data Structure Slip 5 : Que - 1

SAVITIBAI PHULE UNIVERSITY OF PUNE

S. Y. B.Sc. (Computer Science) Semester III

Practical Examination

SUBJECT: CS-233 Practical course based on CS231

 /* 

Q.1 Create a random array of n integers. Accept a value x from user and use linear search algorithm to check whether the number is present in the array or not and output the position if the number is present. 

*/

#include<stdio.h>

#include<stdlib.h>

#define MAX 100


// CheckFor:  Create new Array 

void CreateArray(int A[], int n){

     

     // CheckFor: Declaration of local variable

     int i = 0;

        

     // LoopFor: Assingn the random array elements

     for ( i = 0; i < n; i++)

          A[i] = rand(); 

}


// CheckFor:  Display the Array

void DisplayArray(int A[], int n){


     // CheckFor: Declaration of local variable     

     int i = 0;

     

     // LoopFor: Display the array elements

     for ( i = 0; i < n; i++)

          printf("%d \t", A[i]); 

}


// CheckFor:  Search the Array Element using Linear Search Algorithm

void LinearSearch(int A[], int n, int key){

     

     // CheckFor: Declaration of local variable

     int i = 0, flag = 0;

     

     // LoopFor: Moving the Array from first to last element

     for ( i = 0; i < n; i++){

         // CheckFor: Key element match into the Array elements

         // if Match then print the message

         if ( key == A[i]){

              flag = 1;

              break;

         }

     }

     

     // CheckFor: Key element does not found in Array

     if (flag == 1)

        printf("\n\nThe %d element search at %d position in Array", key, i+1);

     else

          printf("\n %d element not found in Array\n", key); 

}


int main(){

    int A[MAX], num = 0, key = 0;

    

    // Accept the n number from user

    printf("Enter How many element we want to in array: ");

    scanf("%d", &num);

    

    // create n random element array

    CreateArray(A, num);

    

    // Display the given array

    printf("\n\nThe given array elements are:  \n\n");

    DisplayArray(A, num);

    // Sort the element using insertion sort algorithm

    printf("\n\nAccept a value x from user we want to search in array: ");

    scanf("%d", &key);

    LinearSearch(A, num, key);

    printf("\n\n");

    system("pause");

    return 0;

}


SYBSc(CS) Sem III : Data Structure Slip 6 : Que - 1

 

SAVITIBAI PHULE UNIVERSITY OF PUNE

S. Y. B.Sc. (Computer Science) Semester III

Practical Examination

SUBJECT: CS-233 Practical course based on CS231

/* Q.1 Sort a random array of n integers (accept the value of n from user) in ascending order by using selection sort algorithm */

#include<stdio.h>

#include<stdlib.h>

#define MAX 100

// CheckFor:  Create new Array 

void CreateArray(int A[], int n){

     

     // CheckFor: Declaration of local variable

     int i = 0;

        

     // LoopFor: Assingn the random array elements

     for ( i = 0; i < n; i++)

          A[i] = rand(); 

}


// CheckFor:  Display the Array

void DisplayArray(int A[], int n){


     // CheckFor: Declaration of local variable     

     int i = 0;

     

     // LoopFor: Display the array elements

     for ( i = 0; i < n; i++)

          printf("%d \t", A[i]); 

}


// CheckFor:  Sort the Array Element using Selection Sort Algorithm

void SelectionSort(int A[], int n){

     

     // CheckFor: Declaration of local variable

     int i = 0, j = 0, loc = 0, min = 0, temp = 0;

     

     // LoopFor: Moving the Array from first to last element

     for ( i = 0; i < n-1; i++){

         

         // CheckFor: Assign the minimum element of Array and location

         min = A[i];

         loc = i;

         

         // LoopFor: Select the next minimum element from Array

         for ( j = i+1; j < n; j++){

             // CheckFor: Minimum element and change it and save its location

             if ( min > A[j]){

                  min = A[j];

                  loc = j;

             }

         }

         

         // CheckFor: Swap the the minimum element its correct position

         temp = A[i];

         

         A[i] = A[loc];

         

         A[loc] = temp;

     }

     

     // CheckFor: Display the Sorted Array 

     printf("\n\nThe Sorted Array after Selection Sort is: \n\n");

     for ( i = 0; i < n; i++)

         printf("%d \t", A[i]); 

}


int main(){

    int A[MAX], num = 0;

    

    // Accept the n number from user

    printf("Enter How many element we want to in array: ");

    scanf("%d", &num);

    

    // create n random element array

    CreateArray(A, num);

    

    // Display the given array

    printf("\n\nThe given array elements are:  \n\n");

    DisplayArray(A, num);

    

    // Sort the element using insertion sort algorithm

    SelectionSort(A, num);

    

    printf("\n\n");

    system("pause");

    return 0;

}


SYBSc(CS) Sem III : Data Structure Slip 4 Que - 1

SAVITIBAI PHULE UNIVERSITY OF PUNE

S. Y. B.Sc. (Computer Science) Semester III

Practical Examination

SUBJECT: CS-233 Practical course based on CS231

 

/* Q.1 Read the 'n' numbers from user and sort using bubble sort */

#include<stdio.h>

#include<stdlib.h>

#define MAX 100


// CheckFor:  Create new Array 

void CreateArray(int A[], int n){

     

     // CheckFor: Declaration of local variable

     int i = 0;

        

     // Checkfor: Accept the array elements

     printf("\n\nEnter the array element: \n");

     

     // LoopFor: Accepet the array elements

     for ( i = 0; i < n; i++)

          scanf("%d", &A[i]);

}


// CheckFor:  Display the Array

void DisplayArray(int A[], int n){


     // CheckFor: Declaration of local variable     

     int i = 0;

     

     // Checkfor: Display the array elements

     printf("The array elements are: \t");

     

     // LoopFor: Display the array elements

     for ( i = 0; i < n; i++)

          printf("%d \t", A[i]);  

}


// CheckFor:  Sort the Array Element using Bubble Sort Algorithm

void BubbleSort(int A[], int n){

     

     // CheckFor: Declaration of local variable

     int i = 0, j = 0, temp = 0;

     

     // LoopFor: Moving the Array from first to last element

     for( i = 0; i < n; i++){

          // LoopFor: Get element from unsorted array 

          // and check with sorted Array element           

          for( j = 0; j < n-i-1; j++){

               

               // Checkfor: First element is greater than second

               // if yes then swap the elements.

               if ( A[j] > A[j+1]){

                    temp = A[j];

                    A[j] = A[j+1];

                    A[j+1] = temp;

               }

          }

     }

     

     // CheckFor: Display the Sorted Array 

     printf("\n\nThe Sorted Array after Bubble Sort is: \n\n");

     for ( i = 0; i < n; i++)

         printf("%d \t", A[i]);    

}


int main(){

    int A[MAX], num = 0;

    

    // Accept the n number from user

    printf("Enter How many element we want to in array: ");

    scanf("%d", &num);

    

    // Accept the n element from user

    CreateArray(A, num);

    

    // Display the given array

    DisplayArray(A, num);

    

    // Sort the element using insertion sort algorithm

    BubbleSort(A, num);

    

    printf("\n\n");

    system("pause");

    return 0;

}


SYBSc (CS) Sem III : Data Structure Slip 3 Que - 1

SAVITIBAI PHULE UNIVERSITY OF PUNE

S. Y. B.Sc. (Computer Science) Semester III

Practical Examination

      SUBJECT: CS-233 Practical course based on CS231 

/*  Q.1 Sort a random array of n integers (accept the value of n from user) in ascending order by using insertion sort algorithm */

#include<stdio.h>

#include<stdlib.h>

#define MAX 100


// CheckFor:  Create new Array 

void CreateArray(int A[], int n){

     

     // CheckFor: Declaration of local variable

     int i = 0;

        

     // LoopFor: Assingn the random array elements

     for ( i = 0; i < n; i++)

          A[i] = rand(); 

}


// CheckFor:  Display the Array

void DisplayArray(int A[], int n){


     // CheckFor: Declaration of local variable     

     int i = 0;

     

     // LoopFor: Display the array elements

     for ( i = 0; i < n; i++)

          printf("%d \t", A[i]); 

}


// CheckFor:  Sort the Array Element using Insertion Sort Algorithm

void InsertionSort(int A[], int n){

     

     // CheckFor: Declaration of local variable

     int i = 0, j = 0, key = 0;

     

     // LoopFor: Moving the Array from first to last element

     for( i = 1; i < n; i++){

          

          // CheckFor: Assign the first element of unsorted array for the key

          key = A[i];

          

          // LoopFor: Check the accurate position of the key element.

          for( j = i-1; (j >= 0) && (key < A[j]); j--){

                    A[j+1] = A[j];

          }

          

          // CheckFor: Place the accurate position of the key element.

          A[j+1] = key;

     }

     

     // CheckFor: Display the Sorted Array 

     printf("\n\nThe Sorted Array after Insertion Sort is: \n\n");

     for ( i = 0; i < n; i++)

         printf("%d \t", A[i]);   

}


int main(){

    int A[MAX], num = 0;

    

    // Accept the n number from user

    printf("Enter How many element we want to in array: ");

    scanf("%d", &num);

    

    // create n random element array

    CreateArray(A, num);

    

    // Display the given array

    printf("\n\nThe given array elements are:  \n\n");

    DisplayArray(A, num);

    

    // Sort the element using insertion sort algorithm

    InsertionSort(A, num);

    

    printf("\n\n");

    system("pause");

    return 0;

}


Quick Sort Algorithm

 #include<stdio.h>

#include<stdlib.h>


int A[50], n;


// CheckFor:  Create new Array 

void CreateArray(){

     

     // CheckFor: Declaration of local variable

     int i = 0;

          

     // LoopFor: Accepet the array elements using random function

     for ( i = 0; i < n; i++)

          A[i] = rand(); 

}


// CheckFor:  Display the Array

void DisplayArray(){


     // CheckFor: Declaration of local variable     

     int i = 0;

     

     // Checkfor: Display the array elements

     printf("The array elements are: \t");

     

     // LoopFor: Display the array elements

     for ( i = 0; i < n; i++)

          printf("%d \t", A[i]); 

}


void QuickSort(int low, int high){

     // CheckFor: Declaration of local variable 

     int pivot, t, i, j;

     

     // CheckFor: Array is empty or not

     if ( low <= high){

          // CheckFor: Initialise the pivot, low and high

          pivot = A[low];

          i = low + 1;

          j = high;

          

          // LoopFor: Move from low to high

          while ( i <= j){

                // LoopFor: Check the condition for low and increases it value

                while ( pivot >= A[i] && i <= high)

                      i++;

                // LoopFor: Check the condition for high and decreases it value

                while ( pivot < A[j] && j >=  low)

                      j--;

                

                // CheckFor: low does not cross the high then swap low and high 

                // position elements into the array

                if ( i < j){

                     t = A[i];

                     A[i] = A[j];

                     A[j] = t;

                }

          }

          // CheckFor: low cross the high then swap pivot and high 

          // position elements into the array

          A[low] = A[j];

          A[j] = pivot;

          

          // After that divide the array from less than pivot and greater than pivot

          QuickSort(low, j-1);

          QuickSort(j+1, high);

     }

}

     

int main(){

    

    printf("How many element we want to enter into Array: ");

    scanf("%d", &n);

    

    CreateArray();

    DisplayArray();

    

    QuickSort(0, n-1);

    printf("\n");

    DisplayArray();

    printf("\n");

    system("pause");

    

    return 0;

}


Merge Sort Algorithm

 #include<stdio.h>

#include<stdlib.h>


int A[50], n;


// CheckFor:  Create new Array 

void CreateArray(){

     

     // CheckFor: Declaration of local variable

     int i = 0;

          

     // LoopFor: Accepet the array elements using random function

     for ( i = 0; i < n; i++)

          A[i] = rand(); 

}


// CheckFor:  Display the Array

void DisplayArray(){


     // CheckFor: Declaration of local variable     

     int i = 0;

     

     // Checkfor: Display the array elements

     printf("The array elements are: \t");

     

     // LoopFor: Display the array elements

     for ( i = 0; i < n; i++)

          printf("%d \t", A[i]); 

}


// CheckFor: Sort the Array Element using Merge Sort Algorithm

//           Combine the all element after division

void MergeSort(int low, int mid, int high)

{

     // CheckFor: Declaration of local variable

     int t[50], i, j, k;

     

     // CheckFor: Initialise the low, mid variable

     i = low;

     

     j = mid+1;

     

     k = low;

     

     // LoopFor: Move i from 0 to mid and j from mid+1 to high

     while ( (i <= mid) && (j <= high))

     {

          // CheckFor: If First half element is greater than second half element

          //           and copy the element into temporary array 

          if (A[i] >= A[j])

             t[k++] = A[j++];

          else

               t[k++] = A[i++];        

     }

     

     

     // LoopFor: Check remaining element of first half array

     while( i <= mid)

          t[k++] = A[i++];

     

     // LoopFor: Check remaining element of second half array           

     while( j <= high)

          t[k++] = A[j++];

     

     // LoopFor: Copy the all sorted element from temporary array to original array     

     for(i=1; i <= high; i++)

        A[i] = t[i];

}


// CheckFor: Sort the Array Element using Merge Sort Algorithm

//           Divide the array recursively on the basis of divide and conquer

void MergeSortDivide(int low, int high)

{

     // CheckFor: Declaration of local variable

     int mid = 0;

     

     // CheckFor: Empty array element

     if (low != high)

     {

             // CheckFor: Find the mid element of the array

             mid = ((low + high)/ 2);

             // CheckFor: Divide the array from low to mid

             MergeSortDivide(low, mid);

             // CheckFor: Divide the array from mid+1 to high

             MergeSortDivide(mid+1, high);

             // CheckFor: Combine and sort the array.

             MergeSort(low, mid, high);

     }

}                 

 

int main(){

    

    printf("How many element we want to enter into Array: ");

    scanf("%d", &n);

    

    CreateArray();

    DisplayArray();

    

    MergeSortDivide(0, n-1);

    printf("\n");

    DisplayArray();

    printf("\n");

    system("pause");

    

    return 0;

}


Wednesday, August 16, 2023

Data Structure Algorithm Programmatic Illustration

 ////////////////////////////////////////////////////////////////////////////////

//   Program Name: DataStructureAlgorithm.c

//   Description : This program shows the demonstration of all data structure

//                 algorithms.

//   Author :      Sunil V. Bhagwat

//   Created Date : 15 August 2023

//   Modified Date: 16 August 2023

////////////////////////////////////////////////////////////////////////////////                                                                                         




#include<stdio.h>

#include<stdlib.h>

#define MAX 100


// CheckFor:  Create new Array 

void CreateArray(int A[], int n){

     

     // CheckFor: Declaration of local variable

     int i = 0;

     

     // Checkfor: Accept the array elements

     printf("Enter the array element: \n");

     

     // LoopFor: Accepet the array elements

     for ( i = 0; i < n; i++)

          scanf("%d", &A[i]); 

}


// CheckFor:  Display the Array

void DisplayArray(int A[], int n){


     // CheckFor: Declaration of local variable     

     int i = 0;

     

     // Checkfor: Display the array elements

     printf("The array elements are: \t");

     

     // LoopFor: Display the array elements

     for ( i = 0; i < n; i++)

          printf("%d \t", A[i]); 

}


// CheckFor:  Sort the Array Element using Bubble Sort Algorithm

void BubbleSort(int A[], int n){

     

     // CheckFor: Declaration of local variable

     int i = 0, j = 0, temp = 0;

     

     // LoopFor: Moving the Array from first to last element

     for( i = 0; i < n; i++){

          // LoopFor: Get element from unsorted array 

          // and check with sorted Array element           

          for( j = 0; j < n-i-1; j++){

               

               // CheckFor: First element is greater than second

               // if yes then swap the elements.

               if ( A[j] > A[j+1]){

                    temp = A[j];

                    A[j] = A[j+1];

                    A[j+1] = temp;

               }

          }

     }

     

     // CheckFor: Display the Sorted Array 

     printf("\n\nThe Sorted Array after Bubble Sort is: ");

     for ( i = 0; i < n; i++)

         printf("%d \t", A[i]);    

}


// CheckFor:  Sort the Array Element using Insertion Sort Algorithm

void InsertionSort(int A[], int n){

     

     // CheckFor: Declaration of local variable

     int i = 0, j = 0, key = 0;

     

     // LoopFor: Moving the Array from first to last element

     for( i = 1; i < n; i++){

          

          // CheckFor: Assign the first element of unsorted array for the key

          key = A[i];

          

          // LoopFor: Check the accurate position of the key element.

          for( j = i-1; (j >= 0) && (key < A[j]); j--){

                    A[j+1] = A[j];

          }

          

          // CheckFor: Place the accurate position of the key element.

          A[j+1] = key;

     }

     

     // CheckFor: Display the Sorted Array 

     printf("\n\nThe Sorted Array after Insertion Sort is: ");

     for ( i = 0; i < n; i++)

         printf("%d \t", A[i]);   

}


// CheckFor:  Sort the Array Element using Selection Sort Algorithm

void SelectionSort(int A[], int n){

     

     // CheckFor: Declaration of local variable

     int i = 0, j = 0, loc = 0, min = 0, temp = 0;

     

     // LoopFor: Moving the Array from first to last element

     for ( i = 0; i < n-1; i++){

         

         // CheckFor: Assign the minimum element of Array and location

         min = A[i];

         loc = i;

         

         // LoopFor: Select the next minimum element from Array

         for ( j = i+1; j < n; j++){

             // CheckFor: Minimum element and change it and save its location

             if ( min > A[j]){

                  min = A[j];

                  loc = j;

             }

         }

         

         // CheckFor: Swap the the minimum element its correct position

         temp = A[i];

         

         A[i] = A[loc];

         

         A[loc] = temp;

     }

     

     // CheckFor: Display the Sorted Array 

     printf("\n\nThe Sorted Array after Selection Sort is: ");

     for ( i = 0; i < n; i++)

         printf("%d \t", A[i]); 

}


// CheckFor:  Search the Array Element using Linear Search Algorithm

void LinearSearch(int A[], int n, int key){

     

     // CheckFor: Declaration of local variable

     int i = 0;

     

     // LoopFor: Moving the Array from first to last element

     for ( i = 0; i < n; i++){

         // CheckFor: Key element match into the Array elements

         // if Match then print the message

         if ( key == A[i]){

              printf("\n\nThe %d element search at %d position in Array", key, i+1);

         }

     }

     

     // CheckFor: Key element does not found in Array

     if ( i > n-1)

          printf("\n %d element not found in Array\n", key); 

}


// CheckFor:  Search the Array Element using Sentinel Search Algorithm

void SentinelSearch(int A[], int n, int key){

     

     // CheckFor: Declaration of local variable

     int i = 0, last = A[n-1];

     

     // CheckFor: Assign last element as a key

     A[n-1] = key;

     

     // LoopFor: Search the given key element into the Array

     while ( A[i] != key)

           i++;

          

     // CheckFor: Reassign last element as a original value

     A[n-1] = last;

     

     // CheckFor: The given key is found in Array or not

     if ( (i < n-1) || (key == A[n-1])){

              printf("\n\nThe %d element search at %d position in Array", key, i+1);

     }

     else{

          printf("\n %d element not found in Array\n", key);

     }

}


// CheckFor:  Search the Array Element using Binary Search Algorithm (Non-Recursive)

void BinarySearch(int A[], int n, int key){

     

     // CheckFor: Declaration of local variable

     int Lower_Bound = 0, Upper_Bound = 0, Mid_Element = 0;

     

     // CheckFor: Assign the Upper_Bound

     Upper_Bound = n - 1;

          

     // LoopFor: Search the given key element into the Array

     while ( Lower_Bound <= Upper_Bound){

           Mid_Element = (Lower_Bound + Upper_Bound) / 2;

           

           // CheckFor: The given key is found in Array or not           

           if (A[Mid_Element] == key){

              printf("\n\nThe %d element search at %d position in Array", key, Mid_Element+1);

              break;

           }

           else if ( key > A[Mid_Element])

              // CheckFor: Set the lower bound of Array  

              Lower_Bound = Mid_Element + 1;

           else if ( key < A[Mid_Element])

               // CheckFor: Set the Upper bound of Array

               Upper_Bound = Mid_Element - 1;

     }

     

     if(Lower_Bound > Upper_Bound)

        printf("\nThe %d element does not found\n", key);

}


int main(){

    int A[MAX], num = 0, key = 0, Choice = 0;

    

    while(1){

        

        printf("Enter your choice: \n 1. Create Array \n 2. Display Array \n 3. Bubble Sort \n 4. Insertion Sort \n 5. Selection Sort \n 6. Linear Search \n 7. Sentinel Seach \n 8. Binary Search \n 9. Exit \n");

        scanf("%d", &Choice);

        

        switch(Choice){

           case 1:

                printf("Enter How many element we want to in array: ");

                scanf("%d", &num);

                CreateArray(A, num);

                break;

           case 2:

                DisplayArray(A, num);

                break;

           case 3:

                BubbleSort(A, num);

                break;

           case 4:

                InsertionSort(A, num);

                break;

           case 5:

                SelectionSort(A, num);

                break;

           case 6:

                printf("Enter element we want to search in array: ");

                scanf("%d", &key);

                LinearSearch(A, num, key);;

                break;                

           case 7:

                printf("Enter element we want to search in array: ");

                scanf("%d", &key);

                SentinelSearch(A, num, key);;

                break;

           case 8:

                printf("Enter element we want to search in array: ");

                scanf("%d", &key);

                BinarySearch(A, num, key);;

                break;

           case 9:

                exit(0);

        }                                                                                

    }

    

    system("pause");

    return 0;

}


SYBSc (CS) Sem III : Data Structure Slip 20 Que - 2

    SAVITIBAI PHULE UNIVERSITY OF PUNE S. Y. B.Sc. (Computer Science) Semester III Practical Examination       SUBJECT: CS-233 Practical cou...