Blog

最小不平衡子树

Content #

插入20之后,从该叶子到树根路径上的所有节点,平衡因子都有可能改变,出现不平衡,有可能有多个节点的平衡因子的绝对值超过1。 从新插入的节点向上,找离新插入节点最近的不平衡节点,以该节点为根的子树被称为最小不平衡子树。只需将最小不平衡子树调整为平衡二叉树即可,其他节点不变。

平衡二叉树除了具有适度平衡性,还具有局部性:

  1. 在单次插入、删除后,至多有O(1)处出现不平衡;
  2. 总可以在O(logn)时间内,使这O(1)处不平衡重新调整为平衡。

From #

sub:二叉查找树(Binary Search Tree, BST)

二叉查找树(Binary Search Tree, BST) #

顺序查找与二分查找适合静态查找,如果在查找过程中有插入、删除等修改操作,两种方法在最坏和平均情况下者需要O(n)的时间。将二分查找策略与二叉树结合起来,单次修改和查找均在O(logn)时间内完成。

在二叉查找树中:

  1. 若任意结点的左子树不空,则左子树上所有结点的值均不大于它的根结点的值。
  2. 若任意结点的右子树不空,则右子树上所有结点的值均不小于它的根结点的值。
  3. 任意结点的左、右子树也分别为二叉搜索树。

二叉查找树的中序遍历是一个递增序列。

二叉查找树的删除操作 二叉查找树相对于散列表的优势

From #

依我看

Content #

  • I suppose/reckon/guess … I suppose/reckon 比 I guess更有把握。I reckon在英式英语中用得更多。 I suppose we can give it a try. I guess it’s hard to be a single mother. They will have to close the shop before the end of the year, I reckon.

  • Know what I think?

  • If you ask me …

From #

orientation

Content #

许多大学在正式开学前,都会为新生组织orientation(迎新),或 orientation week,帮助学生熟悉校园,办理入学事宜,更好地融入校园生活。

From #

promotion

Content #

A promotion is an activity that helps sell something, especially by giving something special, like a sale or discount.

There’s a promotion in this new coffee shop. If you buy a cup of coffee, you can get another one for free.

From #

应对惨淡的就业市场

Content #

  • a walk in the park 指轻而易举的事,就好像去公园散步一样简单。a piece of cake. Finding a new job isn’t a walk in the park, especially with the way things are these days. He’s used to hard work and thisis a walk in the park to him.

  • burn out 精神和体力耗尽。 But staying in this toxic environment is sucking the life out of me, and I’m almost burnt out. It’s h hight-pressure job and you could burn out young.

    ...

辞职的原因

Content #

  • breathe down someone’s neck 指某人紧紧盯住,或是监视你。呼吸就在你脖子附近,物理距离一定很近。 It’s awful having a boss who breathes down your neck all the time. It doesn’t help to breathe down someone’s neck. People need some breathing room to get things done.

  • be in it for oneself 表示自私自利,只为自己谋取利益。 The boss is always breathing down my neck, and my co-workers are so selfish. They’re just in it for themselves and no one cares about teamwork. She was so cold-hearted and just in it for herself.

    ...

tie up loose ends

Content #

You have to tie up loose ends, which is to say, to finish all your unfinished projects before leaving the job. 字面含义是把绳子松散的一段打结,引申出去就是将手上未做完的项目完成。

The author spent the last chapter of her book tying up loose ends.

Before moving out, Tom made a checklist to tie up loose ends.

From #

描述某人的特质

Content #

  • as straight as an arrow 诚实可靠,值得依赖。 Jake’s father is known for being straight as an arrow.

  • to face the music 为你做过的事件负责。 The villain had to face the music when the superhero caught him. After the teacher found out he cheated on the exam, he had to face the music and accept the F he was going to get.

  • to turn the tables 扭转局面。 The debate turned the tables, so now he’s the main candidate for mayor. I’m more into Shadow Guardian. He turns the tables on villains and always makes them to face the music.

    ...