관리 메뉴

Silver Library (Archived)

Types of algorithm 본문

F2. Problem & Solving/Solving

Types of algorithm

Chesed Kim 2022. 2. 14. 09:30
반응형

QuickSort

https://www.geeksforgeeks.org/quick-sort/

  1. Always pick first element as pivot.
  2. Always pick last element as pivot (implemented below)
  3. Pick a random element as pivot.
  4. Pick median as pivot.

The order of its process should be done in linear time. This is divide and conquer algorithm.

 

Merge Sort

https://www.geeksforgeeks.org/merge-sort/

Like QuickSort, this is divide and conquer algorithm.

https://www.geeksforgeeks.org/divide-and-conquer-algorithm-introduction/

 

Note:

  1. Quicksort is a sorting algorithm. The algorithm picks a pivot element and rearranges the array elements so that all elements smaller than the picked pivot element move to the left side of the pivot, and all greater elements move to the right side. Finally, the algorithm recursively sorts the subarrays on the left and right of the pivot element.
  2. Merge Sort is also a sorting algorithm. The algorithm divides the array into two halves, recursively sorts them, and finally merges the two sorted halves.

'F2. Problem & Solving > Solving' 카테고리의 다른 글

Finally...  (0) 2022.03.17
오랜만의 공개글.  (0) 2022.03.12
10869, 2588 사칙연산 - Python [특이사항]  (0) 2021.12.26
Algorithm - change of plan (language)  (0) 2021.11.16
Linear & binary search with Python  (0) 2021.11.15