Tag:Number of rounds

  • Animation algorithm: Sort Bubble Sort


    brief introduction Sorting is probably the most basic and commonly used of all algorithms. Sorting is a very classic problem. It reorders the items in an array (or a list) in a certain order. There are many sorting algorithms, each of which has its own advantages and limitations. Today we learn the simplest bubble sort […]

  • 34. Bubble sort


    Reference website https://visualgo.net/ Bubble sort: Compare the two numbers in pairs Before < after, the latter one continues to compare with the next one Before > after, switch positions, and then compare with the next one After the first round of comparison, the position of the last number can be determined The second round is […]

  • JS array bubble sort


    Bubble sort: Roulette, pairwise comparison, small front characteristic: 1. Number of rounds: length – 1 times in total 2. Number of comparisons in each round: as the number of rounds increases, the number of comparisons decreases code: Double loop represents the whole sorting process 1. Outer loop: control the number of rounds of comparison, from […]

  • Look at the animation algorithm: sort – select sort


    brief introduction Selection sorting is to select the largest or smallest element from the array, and then interact with the first or last element of the team. Because the first thing to do is a selection process, it is called selection sorting. Examples of selection sorting If we have an array: 29,10,14,37,20,25,44,15, how can we […]

  • 040_ array


    catalog array Definition of array Array creation Characteristics of arrays Use of arrays Two dimensional array Arrays class Bubble sort Simple optimization Sparse array array https://www.bilibili.com/video/BV12J41137hu/?p=51 Definition of array An array is an ordered collection of data of the same type. Array creation //Static initialization int[] nums1 = {1,2,3}; //Dynamic initialization int[] nums2 = new […]