Posts

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;

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 Sor

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 L

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: Dec

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++)          

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){            // CheckFo

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;