100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
cse 2050 exam 2 electric boogaloo Questions with 100% Actual correct answers | verified | latest update | Graded A+ | Already Passed | Complete Solution £6.37   Add to cart

Exam (elaborations)

cse 2050 exam 2 electric boogaloo Questions with 100% Actual correct answers | verified | latest update | Graded A+ | Already Passed | Complete Solution

 4 views  0 purchase

cse 2050 exam 2 electric boogaloo Questions with 100% Actual correct answers | verified | latest update | Graded A+ | Already Passed | Complete Solution

Preview 1 out of 4  pages

  • June 24, 2024
  • 4
  • 2023/2024
  • Exam (elaborations)
  • Questions & answers
All documents for this subject (68)
avatar-seller
Hkane
cse 2050 exam 2 electric boogaloo
Bubble Sort - ANS-Moving through a list repeatedly, swapping elements that are in the
wrong order.
def bubbleSort(arr):
n = len(arr)

# Traverse through all array elements
for i in range(n):

# Last i elements are already in place
for j in range(0, n-i-1):

# traverse the array from 0 to n-i-1
# Swap if the element found is greater
# than the next element
if arr[j] > arr[j+1] :
arr[j], arr[j+1] = arr[j+1], arr[j]

Selection Sort - ANS-A sorting routine that uses a nested loop process to systematically
select the best value among the unsorted elements of the array for the next position in
the array, starting with position zero all the way to the end.
Traverse through all array elements
for i in range(len(A)):

# Find the minimum element in remaining
# unsorted array
min_idx = i
for j in range(i+1, len(A)):
if A[min_idx] > A[j]:
min_idx = j

# Swap the found minimum element with
# the first element
A[i], A[min_idx] = A[min_idx], A[i]

Insertion Sort - ANS-A simple sorting algorithm that builds the final sorted array (or list)
one item at time. It is much less efficient on large lists than more advanced algorithms
such as quicksort, heapsort, or merge sort.

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller Hkane. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for £6.37. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

79271 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy revision notes and other study material for 14 years now

Start selling
£6.37
  • (0)
  Add to cart