|
<?xml version='1.0' encoding='utf-8' standalone='yes' ?> |
|
<map> |
|
<string name="lib_lumadhs_l2_pro_key">0</string> |
|
<string name="lib_lumadls_l4_key_front">0</string> |
|
<string name="pref_sabre_key_main">1</string> |
|
<string name="pref_double_tap_key">zoom</string> |
|
<string name="lib_contrast_2_key_front">0</string> |
|
<string name="pref_qjpg_key">97</string> |
|
<string name="lib_saturation2_key">0</string> |
|
<string name="lib_gainlarge_key_5">0</string> |
|
<string name="lib_darkenlight_key_front">0</string> |
|
<string name="lib_gainlarge_key_3">0</string> |
|
<string name="lib_gainlarge_key_4">0</string> |
|
<string name="bl0_key_front">64</string> |
|
<string name="pref_max_focus_value_key">10.0</string> |
|
<string name="lib_lumadms_l1_key">0</string> |
|
<string name="lib_gainlarge_key_2">0</string> |
|
<string name="lib_dehazedexpo_key_2">0</string> |
|
<string name="lib_dehazedexpo_key_3">0</string> |
|
<string name="cw_rg_key_2">0.5925</string> |
|
<string name="lib_hightlight2_key_2">0</string> |
|
<string name="pref_switch_to_previous_mode_command_string">71</string> |
|
<string name="cw_rg_key_4">0.5925</string> |
|
<string name="cw_rg_key_3">0.5925</string> |
|
<string name="lib_dehazedexpo_key_4">0</string> |
|
<string name="cw_rg_key_5">0.5925</string> |
|
<string name="lib_dehazedexpo_key_5">0</string> |
|
<string name="lib_smoothingnew_key_front">0</string> |
|
<string name="pref_gammacurve_preset_key_5">0</string> |
|
<string name="lib_hightlight2_key_3">0</string> |
|
<string name="lib_hightlight2_key_4">0</string> |
|
<string name="lib_volumeprocessing1_key_front">0</string> |
|
<string name="lib_hightlight2_key_5">0</string> |
|
<string name="pref_noise_modeler_manual_b_2_key_front">1.0785347E-5</string> |
|
<string name="lib_lumadm_l4_key">0</string> |
|
<string name="lib_lumadhs_l5_pro_key">0</string> |
|
<string name="pref_gammacurve_preset_key_3">20</string> |
|
<string name="pref_noise_modeler_manual_d_2_key_front">-8.484603E-8</string> |
|
<string name="pref_gammacurve_preset_key_4">0</string> |
|
<string name="pref_gammacurve_preset_key_2">0</string> |
|
<string name="lib_chromaa_key_front">0</string> |
|
<string name="lib_brightnessintensity_key_4">0</string> |
|
<string name="lib_brightnessintensity_key_3">0</string> |
|
<string name="lib_brightnessintensity_key_5">0</string> |
|
<string name="lib_hdr2_key_front">0</string> |
|
<string name="pref_camera_hdrplus_option_available_key">1</string> |
|
<string name="lib_lumadmsabre_l5a_key">0</string> |
|
<string name="lib_brightnessintensity_key_2">0</string> |
|
<string name="lib_lumaa_key">0</string> |
|
<string name="lib_lumadnewa_pro_key">0</string> |
|
<string name="lib_tripod_key">0</string> |
|
<string name="pref_awb_key">28</string> |
|
<string name="lib_lumadlsabre_l1a_key_2">0</string> |
|
<string name="lib_lumadlsabre_l1a_key_3">0</string> |
|
<string name="lib_lumadlsabre_l1a_key_4">0</string> |
|
<string name="lib_lumadlsabre_l1a_key_5">0</string> |
|
<string name="lib_lumadh_l1_key_front">0</string> |
|
<string name="gr_5_key">-0.148</string> |
|
<string name="pref_model_key_tele">11</string> |
|
<string name="lib_softsharpb_key">0</string> |
|
<string name="lib_lumadls_l5_pro_key">0</string> |
|
<string name="lib_skipmetadatacheck_pro_key">0</string> |
|
<string name="lib_lumadh_l3_key">0</string> |
|
<string name="lib_lumadms_l4_key_front">0</string> |
|
<string name="lib_cg5_key_3">0</string> |
|
<string name="lib_cg5_key_2">0</string> |
|
<string name="lib_contrast_1_pro_key">0</string> |
|
<string name="lib_sabrecontrast_key_5">0</string> |
|
<string name="lib_sabrecontrast_key_4">0</string> |
|
<string name="lib_sabrecontrast_key_3">0</string> |
|
<string name="lib_lumadls_l2_pro_key">0</string> |
|
<string name="lib_lumadmsabre_l4b_key">0</string> |
|
<string name="lib_sabrecontrast_key_2">0</string> |
|
<string name="lib_cg6_key">0</string> |
|
<string name="lib_cg5_key_5">0</string> |
|
<string name="h_bg_key_front">0.27259</string> |
|
<string name="lib_cg5_key_4">0</string> |
|
<string name="lib_hdrratio2_key_front">0</string> |
|
<string name="lib_temporal_radius_key_front">0</string> |
|
<string name="lib_hardjpgquality_key_front">0</string> |
|
<string name="lib_temporalbin_key_2">0</string> |
|
<string name="lib_lumadh_l3_pro_key">0</string> |
|
<string name="pref_raw_key_wide">0</string> |
|
<string name="lib_temporalbin_key_3">0</string> |
|
<string name="pref_color_key">0</string> |
|
<string name="lib_smoothingnew_key_2">0</string> |
|
<string name="lib_smoothingnew_key_3">0</string> |
|
<string name="lib_lutnoisefix_pro_key">0</string> |
|
<string name="lib_smoothingnew_key_4">0</string> |
|
<string name="lib_smoothingnew_key_5">0</string> |
|
<string name="pref_video_stab_button_untouched_count">9</string> |
|
<string name="lib_lumab_key_3">0</string> |
|
<string name="lib_lumab_key_2">0</string> |
|
<string name="pref_Copmode_video_key">0</string> |
|
<string name="lib_spatialdenmi2_key_3">0</string> |
|
<string name="lib_spatialdenmi2_key_2">0</string> |
|
<string name="pref_Copmode_motion_key_2">0</string> |
|
<string name="pref_Copmode_motion_key_3">0</string> |
|
<string name="pref_Copmode_motion_key_4">0</string> |
|
<string name="lib_lumadlsabre_l4b_pro_key">0</string> |
|
<string name="lib_lumadmsabre_l5_pro_key">0</string> |
|
<string name="pref_chameleon_control_key">1</string> |
|
<string name="lib_spatialdenmi2_key_5">0</string> |
|
<string name="lib_spatialdenmi2_key_4">0000F0FF</string> |
|
<string name="lib_orgb_key_2">0</string> |
|
<string name="lib_liteldrhigh_key_5">0</string> |
|
<string name="lib_liteldrhigh_key_3">0</string> |
|
<string name="pref_satCCT_R_key_front">1.0</string> |
|
<string name="lib_liteldrhigh_key_4">0</string> |
|
<string name="lib_orgb_key_5">0</string> |
|
<string name="lib_orgb_key_4">0</string> |
|
<string name="lib_orgb_key_3">0</string> |
|
<string name="lib_lumadhsabre_l3b_key_4">0</string> |
|
<string name="lib_zipper3_key_5">0</string> |
|
<string name="lib_lumadhsabre_l3b_key_3">0</string> |
|
<string name="lib_zipper3_key_4">0</string> |
|
<string name="lib_zipper3_key_3">0</string> |
|
<string name="lib_zipper3_key_2">0</string> |
|
<string name="lib_lumadhsabre_l3b_key_5">0</string> |
|
<string name="pref_Copmode_motion_key_5">0</string> |
|
<string name="lib_liteldrhigh_key_2">0</string> |
|
<string name="user_7_text"></string> |
|
<string name="lib_lumadhsabre_l3b_key_2">0</string> |
|
<string name="lib_spatialdenmi2_pro_key">0</string> |
|
<string name="lib_hdrbrightness_key_3">0</string> |
|
<string name="lib_sabrelnewn_l5_key_front">0</string> |
|
<string name="lib_hdrbrightness_key_2">0</string> |
|
<string name="lib_expocor_pro_key">0</string> |
|
<string name="lib_hdrbrightness_key_5">0</string> |
|
<string name="lib_hdrbrightness_key_4">0</string> |
|
<string name="lib_lumadms_l5_key_2">0</string> |
|
<string name="lib_lumadms_l5_key_3">0</string> |
|
<string name="lib_lumadmsabre_l3_key_front">0</string> |
|
<string name="fix_resolution_key_2">0</string> |
|
<string name="lib_lumadms_l5_key_4">0</string> |
|
<string name="fix_resolution_key_3">0</string> |
|
<string name="lib_lumadms_l5_key_5">0</string> |
|
<string name="lib_lumadhsabre_l2b_pro_key">0</string> |
|
<string name="fix_resolution_key_4">0</string> |
|
<string name="lib_dehazedregulator2_pro_key">0</string> |
|
<string name="fix_resolution_key_5">0</string> |
|
<string name="pref_camera_raw_output_option_available_key">0</string> |
|
<string name="lib_lumadmsabre_l2_pro_key">0</string> |
|
<string name="pref_opmode_portrait_key_2">0</string> |
|
<string name="pref_opmode_portrait_key_4">0</string> |
|
<string name="pref_opmode_portrait_key_3">0</string> |
|
<string name="gr_3_key">-0.148</string> |
|
<string name="lib_sharpgain_key_front">0</string> |
|
<string name="lib_lumadl_l1_pro_key">0</string> |
|
<string name="lib_hdrsabrecalcval1_key">0</string> |
|
<string name="rg_5_key">-0.94</string> |
|
<string name="a_rg_key">0.87653</string> |
|
<string name="bg_5_key">-0.914</string> |
|
<string name="lib_sabrelnewn_l8_key">0</string> |
|
<string name="lib_ncontrast1_pro_key">0</string> |
|
<string name="lib_appdigainset_key_front">0</string> |
|
<string name="pref_noise_modeler_manual_c_3_key">-8.484603E-8</string> |
|
<boolean name="OpenButtonListExtenderRight" value="true" /> |
|
<string name="lib_sabrenoiseestimals_pro_key">0</string> |
|
<string name="pref_opmode_portrait_key_5">0</string> |
|
<string name="lib_dehazedblack_key_front">0</string> |
|
<string name="lib_lumadlsabre_l3b_key_4">0</string> |
|
<string name="lib_lumadlsabre_l3b_key_3">0</string> |
|
<string name="lib_allowtemporalbinning_key_front">0</string> |
|
<string name="rr_4_key">1.68</string> |
|
<string name="lib_lumadlsabre_l3b_key_5">0</string> |
|
<string name="lib_hdrrangeminus_pro_key">0</string> |
|
<string name="lib_lumadlsabre_l3b_key_2">0</string> |
|
<string name="pref_show_button_ois">0</string> |
|
<string name="pref_video_aspect_ratio">SIXTEEN_BY_NINE</string> |
|
<string name="lib_lumadm_l4_key_front">0</string> |
|
<string name="lib_sabrelnew_l1_key_front">0</string> |
|
<string name="br_4_key">0.119</string> |
|
<string name="pref_satCCT_key">1.0</string> |
|
<string name="lib_lumadl_l4_pro_key">0</string> |
|
<string name="lib_resamplmethod_key_front">0</string> |
|
<string name="lib_hdrsabrecalcval1_pro_key">0</string> |
|
<string name="pref_has_shown_longp_education">0</string> |
|
<string name="lib_vignettec_key_front">0</string> |
|
<string name="pref_awbrec_key">1</string> |
|
<string name="bl0_key_main">64</string> |
|
<string name="lib_lumadhsabre_l1a_key_3">0</string> |
|
<string name="lib_lumadhsabre_l1a_key_2">0</string> |
|
<string name="lib_sharpmini_key_5">0</string> |
|
<string name="lib_lumadhsabre_l1a_key_5">0</string> |
|
<string name="lib_raisrzftuning2_pro_key">0</string> |
|
<string name="lib_sharpmini_key_4">0</string> |
|
<string name="lib_lumadhsabre_l1a_key_4">0000F0FF</string> |
|
<string name="lib_lumab_key_front">0</string> |
|
<string name="lib_sharpmini_key_3">0</string> |
|
<string name="lib_sabrenoiseestimals_key_front">0</string> |
|
<string name="lib_sharpmini_key_2">0</string> |
|
<string name="d50_bg_key_front">0.52432</string> |
|
<string name="lib_lightfix2_key">0</string> |
|
<string name="lib_exposition_ldr_key">0</string> |
|
<string name="pref_switch_key">7</string> |
|
<string name="lib_lumalevel_preset_key_2">0</string> |
|
<string name="lib_lumalevel_preset_key_3">0</string> |
|
<string name="lib_lumalevel_preset_key_4">6666663F15CDCC4C3E1D1093243F0A0F0D9A99193F15CDCCCC3D1DD08A203F0A0F0DCDCCCC3E15CDCCCC3D1D54EEF13E0A0F0DCDCC4C3D15CDCCCC3D1D93D7B93E0A0A0DCDCC4C3D1DAF3C9F3D000000000000000000000000000000000A0F0D66662640159A99193E1DAE50223F0A0F0DCDCCCC3F15CDCCCC3D1D95806D3E0A0F0DCDCC8C3F150AD7A33D1D09997A3E0A0F0D0000003F158FC2F53D1D0E06743E0A0A0DCDCCCC3E1D68CEB13E000000000000000000000000000000000A0F0D00000040159A99193E1D14FA003F0A0F0D6666A63F15CDCCCC3D1D49CCBD3E0A0F0DCDCC8C3F15CDCCCC3D1D37E0A43E0A0F0D0000003F15295C0F3E1D7B0A023F0A0A0DCDCC4C3E1DD1FF143F</string> |
|
<string name="lib_lumalevel_preset_key_5">0</string> |
|
<string name="lib_lumadh_l2_key_3">0</string> |
|
<string name="pref_Copmode_experimental_key_4">0</string> |
|
<string name="pref_img_key_2">0</string> |
|
<string name="lib_lumadh_l2_key_4">0</string> |
|
<string name="pref_Copmode_experimental_key_3">0</string> |
|
<string name="pref_img_key_3">0</string> |
|
<string name="lib_lumadh_l2_key_2">0</string> |
|
<string name="pref_Copmode_experimental_key_5">0</string> |
|
<string name="pref_img_key_4">0</string> |
|
<string name="lib_nightmodeexposition_pro_key">0</string> |
|
<string name="pref_img_key_5">0</string> |
|
<string name="lib_hdreffectint_key">0</string> |
|
<string name="lib_hotpixelsuppres_key_front">0</string> |
|
<string name="lib_cg4_key_front">0</string> |
|
<string name="lib_hardux_pro_key">0</string> |
|
<string name="pref_Copmode_experimental_key_2">0</string> |
|
<string name="lib_shadowtuning_key_5">0</string> |
|
<string name="lib_lumadlsabre_l4a_key_5">0</string> |
|
<string name="lib_shadowtuning_key_4">0</string> |
|
<string name="lib_sharpnessb_key">0</string> |
|
<string name="lib_sabresharp3_key_front">0</string> |
|
<string name="lib_shadowtuning_key_3">0</string> |
|
<string name="lib_shadowtuning_key_2">0</string> |
|
<string name="pref_xmlfilename_key">1</string> |
|
<string name="lib_lighting_key_5">0</string> |
|
<string name="lib_lighting_key_4">0</string> |
|
<string name="lib_lumadlsabre_l4a_key_2">0</string> |
|
<string name="lib_lighting_key_3">0</string> |
|
<string name="lib_lighting_key_2">0</string> |
|
<string name="lib_lumadlsabre_l4a_key_3">0</string> |
|
<string name="lib_lumadlsabre_l4a_key_4">0</string> |
|
<string name="lib_hdrratio2_key">0</string> |
|
<string name="lib_lumadmsabre_l5a_pro_key">0</string> |
|
<string name="lib_lumadm_l2_key_3">0</string> |
|
<string name="lib_lumadm_l2_key_2">0</string> |
|
<string name="lib_shastaforce_pro_key">0</string> |
|
<string name="lib_downsamplebybeforemerge_pro_key">0</string> |
|
<string name="lib_lumadm_l2_key_5">0</string> |
|
<string name="lib_tuncolsatpar2_key_front">0</string> |
|
<string name="lib_lumadm_l2_key_4">0</string> |
|
<string name="lib_preservinghigh_key">0</string> |
|
<string name="pref_exposure_5th_key">-3</string> |
|
<string name="lib_lumadm_l2_key">0</string> |
|
<string name="lib_lumadh_l2_key_5">0</string> |
|
<string name="lib_spatiala_pro_key">0</string> |
|
<string name="lib_depth1_pro_key">0</string> |
|
<string name="pref_g_matting_key">0</string> |
|
<string name="lib_lumadlsabre_l1b_key_front">0</string> |
|
<string name="lib_lumadlsabre_l4a_key">0</string> |
|
<string name="lib_lumadh_l5_key">0</string> |
|
<string name="lib_lumadl_l1_key_front">0</string> |
|
<string name="lib_volumeprocessing2_key_3">0</string> |
|
<string name="lib_volumeprocessing2_key_2">0</string> |
|
<string name="pref_Copmode_key_front">0</string> |
|
<string name="lib_temporalbin_key_4">0</string> |
|
<string name="lib_lumanew_pro_key">0</string> |
|
<string name="lib_temporalbin_key_5">0</string> |
|
<string name="lib_sabresharp_pro_key">0</string> |
|
<string name="pref_microvideo_mode_previous">1</string> |
|
<string name="lib_sabre2_key_2">0</string> |
|
<string name="lib_sabrelnewn_l5_key_4">0</string> |
|
<string name="lib_sabrelnewn_l4_pro_key">0</string> |
|
<string name="lib_sabre2_key_3">0</string> |
|
<string name="lib_sabrelnewn_l5_key_5">0</string> |
|
<string name="lib_sabre2_key_4">0</string> |
|
<string name="lib_sabre2_key_5">0</string> |
|
<string name="lib_raw_compress_key_2">0</string> |
|
<string name="lib_raw_compress_key_3">0</string> |
|
<string name="support_link">https: |
|
<string name="lib_red_key_2">0</string> |
|
<string name="lib_raw_compress_key_4">0</string> |
|
<string name="lib_red_key_3">0</string> |
|
<string name="lib_raw_compress_key_5">0</string> |
|
<string name="lib_red_key_4">0</string> |
|
<string name="lib_tripod_key_front">0</string> |
|
<string name="lib_red_key_5">0</string> |
|
<string name="lib_lumadnewa_key_front">0</string> |
|
<string name="pref_gamma_curve_mode_key">-1</string> |
|
<string name="lib_lumadmsabre_l5a_key_2">0</string> |
|
<string name="pref_exynosfix_key_2">0</string> |
|
<string name="pref_exynosfix_key_3">0</string> |
|
<string name="pref_exynosfix_key_4">0</string> |
|
<string name="pref_exynosfix_key_5">0</string> |
|
<string name="lib_lumadmsabre_l5a_key_5">0</string> |
|
<string name="lib_sabrelnewn_l5_key_2">0</string> |
|
<string name="lib_lumadmsabre_l5a_key_4">0</string> |
|
<string name="lib_lumadmsabre_l5a_key_3">0</string> |
|
<string name="lib_sabrelnewn_l5_key_3">0</string> |
|
<string name="lib_lumadhs_l3_key_front">0</string> |
|
<string name="pref_iso_noise_coeff_key">0.5</string> |
|
<string name="lib_lumadlsabre_l2_key_front">0</string> |
|
<string name="pref_design_key">1</string> |
|
<string name="lib_sabrecontrastsharp_key_4">0</string> |
|
<string name="lib_withtetmismatch_key_front">0</string> |
|
<string name="lib_sabrecontrastsharp_key_5">0</string> |
|
<string name="pref_switch_to_next_mode_command_string">72</string> |
|
<string name="pref_social_app_com_instagram_android">1</string> |
|
<string name="lib_spatiala_key_2">0</string> |
|
<string name="lib_spatiala_key_3">0</string> |
|
<string name="lib_exposure_darker_pro_key">02102F1E</string> |
|
<string name="lib_spatiala_key_4">0</string> |
|
<string name="lib_lumadhsabre_l4b_key_front">0</string> |
|
<string name="lib_spatiala_key_5">0</string> |
|
<string name="lib_sabrecontrastsharp_key_2">0</string> |
|
<string name="lib_sabrecontrastsharp_key_3">0</string> |
|
<string name="cw_bg_key_5">0.38687</string> |
|
<string name="lib_cg4_pro_key">0</string> |
|
<string name="cw_bg_key_3">0.38687</string> |
|
<string name="cw_bg_key_4">0.38687</string> |
|
<string name="cw_bg_key_2">0.38687</string> |
|
<string name="lib_vignettec_key">0</string> |
|
<string name="lib_denoise_key">0</string> |
|
<string name="pref_show_buttons_key">1</string> |
|
<string name="lib_lumadms_l5_key_front">0</string> |
|
<string name="pref_focus_lock_time_key">2</string> |
|
<string name="lib_saturation_key_4">0</string> |
|
<string name="lib_lumadhsabre_l4a_key_front">0</string> |
|
<string name="lib_saturation_key_3">0</string> |
|
<string name="lib_saturation_key_5">0</string> |
|
<string name="pref_social_app_com_google_android_youtube">0</string> |
|
<string name="lib_softsharpa_pro_key">0</string> |
|
<string name="lib_temporala_key">0</string> |
|
<string name="lib_hdrrangeplus_pro_key">0</string> |
|
<string name="lib_lumadmsabre_l3b_pro_key">0</string> |
|
<string name="pref_opmode_experimental_key">0</string> |
|
<string name="lib_lumadnewa_key_4">0</string> |
|
<string name="green_key_main">1.0</string> |
|
<string name="lib_lumadnewa_key_3">0</string> |
|
<string name="lib_lumadnewa_key_2">0</string> |
|
<string name="lib_gamma_key_3">1</string> |
|
<string name="lib_lumadnewa_key_5">0</string> |
|
<string name="lib_hdrbrightness_key">0</string> |
|
<string name="lib_lumasmoothing_key_4">0</string> |
|
<string name="pref_opmode_portrait_key_front">0</string> |
|
<string name="lib_lumasmoothing_key_5">0</string> |
|
<string name="lib_lumadm_l4_pro_key">0</string> |
|
<string name="lib_lumasmoothing_key_2">0</string> |
|
<string name="lib_lumasmoothing_key_3">0</string> |
|
<string name="lib_lumadmsabre_l2a_key_front">0</string> |
|
<string name="lib_saturation_key_2">0</string> |
|
<string name="user_5_text"></string> |
|
<string name="pref_global_hue_key_2">0</string> |
|
<string name="lib_spatialdenmi2_key">0</string> |
|
<string name="pref_auto_ns_key">1</string> |
|
<string name="bl2_key_wide">64</string> |
|
<string name="pref_global_hue_key_5">0</string> |
|
<string name="lib_lumadhs_l4_key_front">0</string> |
|
<string name="pref_global_hue_key_3">0</string> |
|
<string name="pref_global_hue_key_4">0</string> |
|
<string name="lib_lumadlsabre_l1_key_front">0</string> |
|
<string name="pref_has_checked_gouda_mode">1</string> |
|
<string name="CCT_WB_intensity_key_5">1.0</string> |
|
<string name="lib_init_params_key_front">0</string> |
|
<string name="lib_colprocessing_key">0</string> |
|
<string name="lib_exposition_key">0</string> |
|
<string name="lib_lumadhsabre_l4_pro_key">0</string> |
|
<string name="lib_volumeprocessing2_key_front">0</string> |
|
<string name="lib_chromab_key_front">0</string> |
|
<string name="lib_sharpnessnoisemodel_key">0</string> |
|
<string name="pref_opmode_video_key_5">0</string> |
|
<string name="pref_aemode_astro_key">4</string> |
|
<string name="pref_opmode_video_key_4">0</string> |
|
<string name="pref_opmode_video_key_3">0</string> |
|
<string name="pref_opmode_video_key_2">0</string> |
|
<string name="pref_noise_modeler_manual_d_1_ke |
|
package main |
|
|
|
import ( |
|
"fmt" |
|
"os" |
|
"io" |
|
) |
|
|
|
type BinaryNode struct { |
|
left *BinaryNode |
|
right *BinaryNode |
|
data int64 |
|
} |
|
|
|
type BinaryTree struct { |
|
root *BinaryNode |
|
} |
|
|
|
func (tree *BinaryTree) insert(data int64) *BinaryTree { |
|
if tree.root == nil { |
|
tree.root = &BinaryNode{ data: data, left: nil, right: nil }; |
|
} else { |
|
tree.root.insert(data); |
|
} |
|
|
|
return tree; |
|
} |
|
|
|
func (node *BinaryNode) insert(data int64) { |
|
if node == nil { |
|
return; |
|
} else if data <= node.data { |
|
if node.left == nil { |
|
node.left = &BinaryNode{ data: data, left: nil, right: nil }; |
|
} else { |
|
node.left.insert(data); |
|
} |
|
} else { |
|
if node.right == nil { |
|
node.right = &BinaryNode{ data: data, left: nil, right: nil }; |
|
} else { |
|
node.right.insert(data); |
|
} |
|
} |
|
} |
|
|
|
func print(w io.Writer, node *BinaryNode, ns int, ch rune) { |
|
if node == nil { |
|
return; |
|
} |
|
|
|
for i := 0; i < ns; i++ { |
|
fmt.Fprint(w, " ") |
|
} |
|
|
|
fmt.Fprintf(w, "%c:%v\n", ch, node.data) |
|
|
|
print(w, node.left, ns+2, 'L') |
|
print(w, node.right, ns+2, 'R') |
|
} |
|
|
|
func main() { |
|
tree := &BinaryTree{}; |
|
|
|
tree.insert(1). |
|
insert(-2). |
|
insert(-3). |
|
insert(-4). |
|
insert(-5). |
|
insert(3). |
|
insert(4). |
|
insert(5). |
|
insert(6). |
|
insert(7). |
|
insert(3). |
|
insert(+2); |
|
|
|
print(os.Stdout, tree.root, 0, 'T'); |
|
} |
|
|
|
/* |
|
1 |
|
/ \ |
|
-2 3 |
|
/ / \ |
|
-3 3 4 |
|
/ \ \ |
|
-4 -2 5 |
|
/ \ |
|
-5 6 |
|
\ |
|
7 |
|
// \\ |
|
|
|
print |
|
|
|
|