观众们好,
现在,我们将尝试解决一些问题/执行算法时,经常**向后和向前递增背后的秘密。
首先,什么是算法?
Yeah I could remember my first algorithm lectures vividly, my java lecturer asks us to pull out a page of the paper and make an airplane out of it.
Then she asked us how we emerged to making such similar planes?
Then everyone started narrating in different ways.
Then she replied; algorithm mustn't be written in the same pattern but often results to the same result. But as time goes on, i began to think that it's not all about writing the algorithm but the effectiveness of the algorithm.
因此,我今天告诉您,该算法用于分类解决程序问题的方法。 但是,请务必记住您的时间+空间的复杂性。 您开始考虑的人,忘记了您别无选择,只有找到一种提高算法技能的方法。
Simple advice from EmmanuelOnah!
So now haven known what algorithm is, what is ++?
++仅仅意味着递增1。它几乎与+1类似,但+1在某些方面没有效果,例如,尝试实现数组的弹出和峰值算法,看看使用++和+1会发生什么。
So no we know the meaning of ++.
那么什么是正向增量及其背后呢?
前向递增仅表示前缀递增:
++counter.
一世。 前向递增是将值递增1并立即返回的同时方式。 (我称它为异步增量(必须在生存之前取一个))。 注意:此过程中有两个值,即++(+ 1)和值本身(例如counter)。
发生的情况的分析:++在计数器离开(++ counter)之前出现,并且计数器说好,我会带你一起去,因为你来得早。
有时,在使用增量时会遇到一些逻辑错误。 有时我们增加一个值并尝试同时返回它,但是我们发现它返回的是在增加之前的初始值。 这是由于您在递增之前返回了它,这就是我们所说的后递增或后递增:
backWardIncrement++;
ii。 向后递增是在返回值后递增值的一种方法(请注意,仅在返回其初始状态后才递增。我称之为同步递增)。 请注意,此过程中有两个值,即++(+ 1)和要增加的主值(例如counter)。
分析它是如何发生的:++是在计数器消失或计数器仍处于活动状态时(计数器++)出现。 那会发生什么呢?
即将增加的计数器将告诉++我已经在生活,但是当我到达住所时,您可以将++(+ 1)带给我,然后我将其展示给别人 会议期间!
整个分析类似于++ counter和counter ++之间的情况。
See the code snippet below:
感谢您抽出宝贵时间阅读本文,
Written by Emmanuel Onah,
React and android native developer.
from: https://dev.to//emmanuelonah/the-secret-behind-the-hood-of-all-this-back-forward-70l