Peter could be referring to Jesus or to God. In other words, He does not experience it in a linear fashion as we do, but is able to interact with time as He chooses. The exact timespans chosen ('one day' and 'a thousand years') are immaterial and symbolic of short and long periods in this context, making the point that God transcends time. The logic of the specific verse in question is that using merely human standards of the comprehension of the passage of time and applying them to God is inappropriate. 9 The Lord is not slow to fulfill his promise as some count slowness, but is patient toward you, not wishing that any should perish, but that all should reach repentance. Then he argues that they are myopic in their view of time:ĨBut do not overlook this one fact, beloved, that with the Lord one day is as a thousand years, and a thousand years as one day. 7But by the same word the heavens and earth that now exist are stored up for fire, being kept until the day of judgment and destruction of the ungodly. 4They will say, “ Where is the promise of his coming? For ever since the fathers fell asleep, all things are continuing as they were from the beginning of creation.” ESVįirstly, Peter asserts they are wrong about the eventual outcome:ĥFor they deliberately overlook this fact, that the heavens existed long ago, and the earth was formed out of water and through water by the word of God, 6and that by means of these the world that then existed was deluged with water and perished. The 'scoffers' of earlier in the chapter are questioning whether God will return at all, given the apparent delay:ģknowing this first of all, that scoffers will come in the last days with scoffing, following their own sinful desires. Space complexity is O(1) because an extra variable key is used.Peter is urging his audience to regard God as 'patient' in regard to bringing about the conclusion of His plan, rather than 'slow', and not to doubt His eventual arrival. It occurs when the elements of an array are in jumbled order (neither ascending nor descending).
![dsa ir a-22 dsa ir a-22](https://img.yumpu.com/22022703/1/500x640/ir-a-22-small-projects-exempt-from-dsa-review-state-of-california.jpg)
So, there are only n number of comparisons. When the array is already sorted, the outer loop runs for n number of times whereas the inner loop does not run at all. Thus, the total number of comparisons = n*(n-1) ~ n 2 In this case, worst case complexity occurs.Įach element has to be compared with each of the other elements so, for every nth element, (n-1) number of comparisons are made. Suppose, an array is in ascending order, and you want to sort it in descending order. Insertion Sort in Python, Java, and C/C++ Place 4 behind 1 Place 3 behind 1 and the array is sorted
![dsa ir a-22 dsa ir a-22](https://media.springernature.com/lw685/springer-static/image/art%3A10.1038%2Fs41467-019-14272-1/MediaObjects/41467_2019_14272_Fig1_HTML.png)
![dsa ir a-22 dsa ir a-22](https://demo.vdocuments.mx/img/378x509/reader024/reader/2021022501/5868ca8d1a28ab5e408c0aec/r-1.jpg)
Take the second element and store it separately in key.Ĭompare key with the first element. The first element in the array is assumed to be sorted.Suppose we need to sort the following array. In the same way, other unsorted cards are taken and put in their right place.Ī similar approach is used by insertion sort. If the unsorted card is greater than the card in hand, it is placed on the right otherwise, to the left. We assume that the first card is already sorted then, we select an unsorted card. Insertion sort works similarly as we sort cards in our hand in a card game. Insertion sort is a sorting algorithm that places an unsorted element at its suitable place in each iteration. Decrease Key and Delete Node Operations on a Fibonacci Heap.