• Leetcode


    1. 多行注释:ctrl + /

    2. enumerae()函数

    将一个可遍历的数据对象组合为一个索引序列,同时列出数据和数据下标,如:

    seq = ['one', 'two', 'three']
    for i, element in enumerate(seq):
      print(i, element)

    0 one

    1 two

    3 three

    3. find shortest string in list, key=len可忽略

    min(list_name, key = len)

    4. 取余数:%,整除(向下取整)://

    5. Tree

    Binary Search Tree作用:speed up our binaryy search as we are able to find items faster

    Tree traversal: traversing means visiting and outputting the value of each node in a particular order

    *3种Depth First Traversals*

    a) In-order: In the case of binary search trees (BST), Inorder traversal gives nodes in non-decreasing order

    Until all nodes are traversed-
    Step 1: recursively traverse left subtree
    Step 2: visit root node
    Step 3: recursively traverse right subtree

    b) Pre-order: Preorder traversal is used to create a copy of the tree. Preorder traversal is also used to get prefix expression on an expression tree

    Until all nodes are traversed-
    Step 1: visit root node
    Step 2: recursively traverse left subtree
    Step 3: recursively traverse right subtree

    c) Post-order: Postorder traversal is used to delete the tree or get the postfix expression of an expression tree

    Until all nodes are traversed-
    Step 1:recursively traverse left subtree
    Step 2: recursively traverse right subtree
    Step 3: visit root node

    Depth First Traversals: 
    (a) Inorder (Left, Root, Right) : 4 2 5 1 3 
    (b) Preorder (Root, Left, Right) : 1 2 4 5 3 
    (c) Postorder (Left, Right, Root) : 4 5 2 3 1

  • 相关阅读:
    python常见排序算法解析
    分析python日志重复输出问题
    Mysql数据库基础
    横屏竖屏
    禁止iOS的弹性滚动 微信的下拉回弹
    移动性能
    取消双击上滑(针对iso)
    关于微信端 顶部会撑开页面的解决方案
    CSS动画简介
    browser-sync 使用简介
  • 原文地址:https://www.cnblogs.com/eleni/p/16077827.html
Copyright © 2020-2023  润新知