COMS W3134 Lecture Notes - Lecture 15: Insertion Sort, Directed Acyclic Graph, Dspace
34 views3 pages
18 Dec 2020
School
Department
Course
Professor
Document Summary
Choose first item , or mid , or. Ans : choose median of three ( first , mid , last ) I how to choose pivot ? ( 5 ( 5 ( 5 ( 5 ( 5 ( 5 ( 5. 8 2416 make pivot rightmost item check that i is smaller more i. 2 416 i stop when i check that. Stop when j smaller than pivot larger than pivot j is larger. 2 89 7) 6 j j j repeat check i. 2 89 716 j i swap i and pivot to put pivot back. 8 ) reverse on left array , then right. 5 ) t left side is base case only 2 items , can "t do median of three. * once we reach a small array . we use insertion sort. G = ( v , el vertices & edges.