Is Quick Sort a Divide & Conquer approach? [closed]

我们两清 提交于 2019-12-06 00:26:26
entelkedi

Divide & Conquer algorithms have 3 stages:

  1. Divide,
  2. Conquer,
  3. Combine,

For merge sort (http://www.cs.umd.edu/~meesh/351/mount/lectures/lect6-divide-conquer-mergesort.pdf):

  1. Divide: Split the array into 2 subarrays,
  2. Conquer: Merge sort the resulting subarrays recursively,
  3. Combine: Merge the two sorted subarrays into a single sorted list.

For quick sort (https://www.cs.rochester.edu/~gildea/csc282/slides/C07-quicksort.pdf):

  1. Divide: First rearrange then split the array into 2 subarrays,
  2. Conquer: Quick sort the resulting subarrays recursively,
  3. Combine: None.

Note: Thanks to University of Rochester and University of Maryland CS departments.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!