"Incomplete Binary Search Tree implementation.
Author: Francois Pitt, March 2013,
Danny Heap, October 2013.
"
class BST:
"A Binary Search Tree."
def _init_(self: 'BST', container: list=None) -> None:
"
Initialize this BST by inserting the items from conta
"Incomplete Binary Search Tree implementation.
Author: Francois Pitt, March 2013,
Danny Heap, October 2013.
"
class BST:
"A Binary Search Tree."
def _init_(self: 'BST', container: list =None) -> None:
"
Initialize this BST by inserting the items from cont
Term test #1 | Solutions
CSC 148H1
Question 1.
October 2013
[12 marks]
I have left out the documentation for function s(n). Work out what it produces, starting at the smallest
n and working up.
def s(n: int) -> tuple:
"For you to figure out."
if n = 1:
re
"Incomplete Binary Search Tree implementation.
Author: Francois Pitt, March 2013,
Danny Heap, October 2013.
"
class BST:
"A Binary Search Tree."
def _init_(self: 'BST', container: list=None) -> None:
"
Initialize this BST by inserting the items from conta
def square_root(x,eps):
"use Newton's method"
this_guess=1.0
next_guess=0.5*(this_guess+x/this_guess)
i=1
while (i<=10) and (abs(this_guess-next_guess)>=eps):
this_guess=next_guess
next_guess=0.5*(this_guess+x/this_guess)
i=i+1
if (i=11) and (abs(this_gue
class E2Error(Exception):
pass
class E2OddError(E2Error):
pass
def raiser(x: 'String'):
"(object) -> Exception
identity the cause of exception
>raiser('Go sue me!')
E2Error: Big Apple
"
if x = 'Go sue me!':
raise E2Error('Big Apple')
else:
try:
x = int(x)
CSC148, Exercise #3
due 9:59 p.m. March 13th, 2014
There are two parts to this exercise. For each part, there is a single le you must submit | make sure
that you read the submission instructions carefully!
general advice
Before you begin coding, make sure
def sum_and_deep(tree: 'Treelist', sum: 'int'=0,
deep: 'int'=0) -> 'collection of list':
if tree is None:
return [sum, deep]
new_sum = sum + tree[0]
new_deep = deep + 1
if tree[1] is None:
pass
else:
possible = sum_and_deep(tree[1], sum + tree[0], deep +
#!/usr/bin/env python
# pep8.py - Check Python source code formatting, according to PEP 8
# Copyright (C) 2006-2009 Johann C. Rocholl <johann@rocholl.net>
# Copyright (C) 2009-2012 Florent Xicluna <florent.xicluna@gmail.com>
#
# Permission is hereby grant
CSC148H1, Winter 2014
Exercise 1
Due: by 9:59 p.m. on Thursday January 16th, 2014
There are two unrelated parts to this exercise. For each part, there is a single file you must submit
make sure that you read the submission instructions carefully! The fil
Will the Real Garamond Please Stand Up
Garamond fonts are nearly as plentiful as mosquitoes in August. Theres a version from International Typeface Corporation (ITC), a version developed for Adobe Systems, one produced by the Monotype foundry, another dra
F A C U LT Y O F G R A D U AT E S T U D I E S
The Uni v er siT y of BriTish ColUmBia
THE GRAD GUIDE
WELCOME
Choosing UBC Deans Message 3 4
BEFORE YOU ARRIVE AT UBC
Contacting Your Graduate Program International StudentsApplying for a Study Permit Getting