CISC 121 Lecture Notes - Lecture 37: Sorting Algorithm, Quicksort, Merge Sort

38 views3 pages
Verified Note

Document Summary

The partition function you"ve seen above can be improved with a better choice of pivot value than the first value in the list/sub-list. This code selects the median of the first, last, and middle values as the pivot value. Merge sort is usually expressed as a not-in-place, o(n log n) (bset, average, and worst case), divide-and- conquer, recursive sortiung algorithm that is easy to code and to understand. Quicksort is usually expressed as an in-place, recursive sorting algorithm that typically performs in o(n log n) time, but that can degrade to o(n2) in the worst cases. A linked list is a sequence of data items (elements) in memory. Each element of a linked ist is created indepent of the others. Most programming languages have excellent built-in support for lists or list-like structures (e. g. arrays), but not for linked lists. A linked list is an alternative structure to a list (or array).

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents