ABOUT THE COURSE :
 
  This course is aimed at enabling the students to
- Formulate simple algorithms for arithmetic and logical problems
- Translate the algorithms to programs (in C language)
- Test and execute the programs and correct syntax and logical errors
- Implement conditional branching, iteration and recursion
- Decompose a problem into functions and synthesize a complete program using divide and conquer approach
- Use arrays, pointers and structures to formulate algorithms and programs
- Apply programming to solve matrix addition and multiplication problems and searching and sorting problems
- Apply programming to solve simple numerical method problems, namely rot finding of function, differentiation of function and simple integration
| Summary | |
|---|---|
| Course Type | Elective | 
| Duration | 12 weeks | 
| Category | Computer Science and Engineering | 
| Start Date | 22 Jan 2024 | 
| End Date | 12 Apr 2024 | 
| Exam Registration Ends | 16 Feb 2024 | 
| Exam Date | 21 Apr 2024 IST | 
Assignment Solutions :
Programming Assignment :
Week-09: Program-01 :
    Write a program to print all the locations at which a particular element (taken as input) is found in a list and
    also print the total number of times it occurs in the list. The location starts from 1.
    
For example, if there are 4 elements in the array
5
6
5
7
If the element to search is 5 then the output will be
5 is present at location 1
5 is present at location 3
5 is present 2 times in the array.
For example, if there are 4 elements in the array
5
6
5
7
If the element to search is 5 then the output will be
5 is present at location 1
5 is present at location 3
5 is present 2 times in the array.
for (c = 0; c < n; c++)
    {
      if (array[c] == search)
      {
         printf("%d is present at location %d.\n", search, c+1);
         count++;
      }
    }
   if (count == 0)
      printf("%d is not present in the array.", search);
   else
      printf("%d is present %d times in the array.", search, count);
 
   return 0;
}Week-09: Program-02 :
    Write a C program to search a given element from a 1D array and display the position at which it is found by using linear search function. The index location starts from 1.
  
position = linear_search(array, n, search);
 
   if (position == -1)
      printf("%d is not present in the array.", search);
   else
      printf("%d is present at location %d.", search, position+1);
   return 0;
}
 
int linear_search(int a[], int n, int find) {
   int c;
   for (c = 0 ;c < n ; c++ )
    {
      if (a[c] == find)
         return c;
    }
   return -1;
}Week-09: Program-03 :
      Write a C program to search a given number from a sorted 1D array and display the position at which it is found using binary search algorithm. The index location starts from 1.
    
int first, last, middle;
   first = 0;
   last = n - 1;
   middle = (first+last)/2;
 
   while (first <= last) {
      if (array[middle] < search)
         first = middle + 1;
      else if (array[middle] == search) {
         printf("%d found at location %d.", search, middle+1);
         break;
      }
      else
         last = middle - 1;
 
      middle = (first + last)/2;
      }
   if (first > last)
      printf("Not found! %d isn't present in the list.", search);
 
     return 0;
      }Week-09: Program-04 :
      Write a C program to reverse an array by swapping the elements and without using any new array.
    
  int temp, end;
   end = n - 1;
   for (c = 0; c < n/2; c++) {
    temp       = array[c];
    array[c]   = array[end];
    array[end] = temp;
 
    end--;
  }CRITERIA TO GET A CERTIFICATE :
- Average assignment score = 25% of average of best 8 assignments out of the total 12 assignments given in the course.
- Exam score = 75% of the proctored certification exam score out of 100
- Final score = Average assignment score + Exam score
  YOU WILL BE ELIGIBLE FOR A CERTIFICATE ONLY IF AVERAGE ASSIGNMENT SCORE
    >=10/25 AND EXAM SCORE >= 30/75. If one of the 2 criteria is not met,you will not get the certificate even if the Final score >= 40/100.
 
 
 
 
 
Follow Us