CSci 227 Syllabus    Resources    Coursework



Laboratory Exercise 10
CSci 227: Programming Methods
Department of Computer Science
Hunter College, City University of New York
Spring 2025


Learning Objectives:

Software Tools Needed: Web browser to access textbook and an IDE (on-line or on computer) with core Python 3.6+ loaded.


Classic Sorts

The textbook covers several canonical sorts. We will focus on three of them:

Bubble Sort: A straightforward sort that's easy to implement:

Insertion Sort: A slightly more complicated sort with the nice property that elements that if some elements are already in order, they stay in order (the sort is "stable"):



Merge Sort: A recursive sort with better running time (worst case complexity of O(n lg n) versus O(n^2)):



Built-In Sorts

Python has some sorting functions built-in to the core language. Read through the Python How-To page on the basic sorting functions:



Quizzes and Code Reviews

There are weekly written quizzes and code reviews in 1001G, 11:30-5:30, Mondays-Fridays when classes are in session. No appointments are needed for CSCI 227 students.

Additional Practice

For additional practice on core Python, see the HackerRank prepare series:

HackerRank: Prepare Python

Click the Easy/Medium option on the right hand menu, and work through their Python challenges.

For more practice on using sorting to solve problems, here are some popular ones from LeetCode: