Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: entages on investments while you are retired aig; (g o t _ a e ), and a list of tuples of e i e e t h u e , where the first value is a rwhrts rtrmn_oss string ­ the name of the house and the second is the annual rent of it. The function should return the name of most expensive house one can afford, without getting into debts. Implement the function using binary search. Note that the list of tuples won’t be sorted according to their prices. First, sort the list of houses by their prices and then run a binary search, to find your house. complete choosing_retirement_home(savings,g o t _ a e , e i e e t h u e ) rwhrtsrtrmn_oss. The function should return a string ­ the name of the chosen retirement house. Write your code in the appropriate place in the template. Theoretical and practical important CS comment: Linear search is always faster than first sorting and then performing a binary search. (Even if the search is efficient, which bubble sort isn't). We ask you for this implementation only as an exercise. While retired, you will need some leisure activity. You must write some functions for a Battleship game. See rules here:­of­Battleship.htm The following ass...
View Full Document

This document was uploaded on 03/20/2014 for the course CMSC 67101 at Hebrew University of Jerusalem.

Ask a homework question - tutors are online