As the weeks are passing, more challenges are coming in solving the problem sets.
This week 3 was about the algorithms. The challenging part for me in this week was to understanding the concept of time complexity notations like BIG O , Omega and theta.
Also got familiar with searching and sorting algorithms.
A) Linear search - we compare required element with each element in the list until we found.
B) Binary search - list must be sorted to apply binary search. then we start from middle and check if the required element is in the left part or right , then again we divide and conquer.
C) Bubble Sort - We usually bubbles the highest element to the last of the list. Procedure is swapping the adjacent elements if not in order in whole list. Then repeat again but not checking the sorted elements. If no swaps in first pass then elements are sorted.
D) Selection Sort - In this we search the smallest element from the list of unsorted array and swaps the smallest element with the first element of the unsorted array.
E) Merge Sort - In this we simply divide the list in two, then sort the left half and then right half and then merge.
Problem sets:
1) sort = In this problem , we have to find out from the three sorting programs that which program is using which sorting algorithm by the concept of time complexity.
2) Plurality = In this problem, we just have to create a voting system where n number of voters vote for the x number of candidates and whoever candidate gets more vote is the winner.
3) Runoff = It the another voting system where each voter can vote by setting preferences for the candidates and on the basis of that preferences we have to declare the winner.
4) Tideman = It was another voting system but very confusing so I left it for later.
Top comments (0)