blog




  • Essay / Bubble Algorithm Test - 966

    Course: ALGORITHM. Assignment No. 1.1Q – Discuss the complexity of bubble sort algorithm COMPLEXITY OF BUBBLE_SORTS ALGORITHM: If we talk about the complexity of bubble sort. Then, for bubble sort, our pseudo-code is: Procedure Bubble sort (a1, a2 . . . an) This is an arithmetic series. for i=1 to n-1 for j=1 to n-1 if aj>aj+1 then let's exchange aj and aj+1Let, we have the following list,{ 1 –11 50 6 8 –1} Using sorting bubbles in ascending orderAfter the first pass{-11 1 6 8 –1 50} (In this step we perform 5 comparisons)After the second pass{-11 1 6 -1 8 50} (In this step we perform 4 comparisons )After the third pass {-11 1 -1 6 8 50} (In this step we perform 3 comparisons) After the fourth pass{-11 -1 1 6 8 50} (In this step we perform 2 comparisons) After the fifth pass{-11 - 1 1 6 8 50} (In this step we take 1 comparison) Done From the above list we have 6 elements and there are 5 + 4 + 3 + 2 + 1 comparisons. In general, if we have a list of n elements, we will have the following list, (n-1) + (n-2)…. + 2 +1 = (n-1) n / 2 comparisons. The complexity here is based on the quadratic (degree 2) in n. For the best case: the time complexity of the best scenario is O(n). For the worst case: The time complexity of the best scenario is O(n2). Note: Bubble sort is not efficient, there are other sorting algorithms that are much faster. Assignment #1.2: Q - Discuss the complexity of search algorithms. Complexity of Algorithms: There are many search algorithms, among which linear search algorithm is one of the simplest and easy algorithms, but it also has complexity, which we discuss here. Let's determine if the number 3 is present in the following lists A = { 1 4 8 -1 3}B= ...... middle of document ......ent of Defense develops TCP/IP (Transmission Control Protocol/ Internet Protocol).• TCP/IP is a standard communications protocol, widely used in communications between different WANS and LANs.• Because its use is wide, it presents security concerns and increasing sharing of information transmitted over vulnerable communication lines. 1980s• This decade is the decade of personal computers and workstations (special purpose machines).• Personal computers gained popularity due to their ease of use.• Its graphical user interfaces (GUIs) are the key to success.• Sharing information between different computers through networks has become more efficient and convenient• Widespread use of the client/server computing model.• Clients request various services and servers perform the requested services. • Multiple threads of instructions that can execute independently. • Greater consideration in programming languages.