This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#helper function to estimate long/lat range based on long/lat and range in km | |
def calc_longlat_range(longitude, latitude, range_km): | |
from math import cos, radians, pi | |
r = 6370 | |
alpha = radians(latitude) | |
circum = 2 * pi * cos(alpha) * r | |
km_per_long = circum / 360 | |
km_per_lat = pi * r / 180 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#test cases | |
in_order_1 = "ABCDEFG" | |
pre_order_1 = "DBACEGF" | |
post_order_1 = "ACBFGED" | |
in_order_2 = "CBAD" | |
pre_order_2 = "BCAD" | |
post_order_2 = "CDAB" | |
def convert(in_order, pre_order): |