CSci 227 Syllabus    Resources    Coursework



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


Learning Objectives:

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


Trees

In lecture, we introduced representing trees with linked Nodes as well using arrays. Work through Sections 6.2-6.6 of the textbook:



Heaps

In lecture, we used trees to implement heaps and priority queues. Work through Sections 6.9-6.11 of the textbook:



Python has a built-in implementation of heaps that is quite useful. The documentation is below. Read through it, and then try Program 27:



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. Make sure to complete Quiz 11 and Code Review 11 by Friday, 3 May (extra day due to Spring Break).

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 trees and heaps to solve problems, here are some popular ones from LeetCode: