100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
CSE 2050 Exam 2 $7.99   Add to cart

Exam (elaborations)

CSE 2050 Exam 2

 2 views  0 purchase
  • Course
  • Institution

Exam of 5 pages for the course Pulmonary Rosh at Pulmonary Rosh (CSE 2050 Exam 2)

Preview 2 out of 5  pages

  • July 16, 2024
  • 5
  • 2023/2024
  • Exam (elaborations)
  • Questions & answers
avatar-seller
CSE 2050 Exam 2
Average Running time of Hash Mapping for put and get - ANS-O(1)

Basic Methods of Mapping - ANS-get - returns the value of the key, if it exists
put - inserts the key with its value to the mapping

Benefit of Using Selection Sort - ANS-It only makes one swap per element (O(n)), which
can reduce memory cost

Best and Worse Case for Selection Sort - ANS-Best Case: reverse sorted, though
O(n^2), randomized sometimes
Worst Case: if just one object are out of places

Best and Worst Case for Bubble Sort - ANS-Best Case: if only one item (particularly the
rabbit) is unsorted, O(n)
Worst Case: O(n^2), has to go through every item (reversed sorted list, turtle,
randomized)

Best and Worst Case for Insertion Sort - ANS-Best Case: only one object out of place
O(n) swap
Worst Case: reversed sorted (O(n^2))

Best Case for Binary Search - ANS-O(1), if median happens to be the item

Binary Search - ANS-An ordered list is divided in 2 with each comparison.

Combine - ANS-Combines all the small solutions from each sub problems to a solution
for the big problem

Compare Insertion Sort vs Selection Sort (3) - ANS-1) Number of comparisons is less
than number of swaps in insertion
2) Insertion is generally more efficient
3) O(n) swaps in selection vs O(n^2) swaps in insertion

Conquer - ANS-Solve the sub problem recursively until a solution to the sub problem is
found

Divide - ANS-Splitting the big problem into subproblems

, Drawbacks of Recursion - ANS-Can be slow, take a lot of memory space, can solve the
same subproblems repeatedly

Dynamic Programming - ANS-Sub-problems are solved from the bottom up. Each
problem is trivially solved as the combination of previously-solved subproblems.

Greedy Algorithm - ANS-an algorithm that always tries the solution path that appears to
be the best.

Hash Collision - ANS-two (or more) keys hash to same slot

Hash function - ANS-Takes a key and return an integer, which can be used to define
what "bucket" it should go in

Hash Table - ANS-A table of information that is accessed by way of a shortened search
key (the hash value).

Invariant - ANS-something that holds true throughout the execution of a code

Invariant for Bubble Sort - ANS-The biggest items of the list are in their sorted, final
position after each loop

Invariant for Insertion Sort - ANS-After each loop, a small portion of the list, or sub list,
are sorted, but does not mean that each element are in their final position

Invariant for Selection Sort - ANS-Same thing with Bubble Sort, where the biggest items
of the list are in their sorted, final position after each loop

Mapping - ANS-is a collection of key-value pairs such that the keys are unique

Memoization - ANS-Before attempting to solve a new sub-problem, a collection is
referenced to see if this sub-problem has already been solved.

Merge Sort - ANS-Sorting algorithm that keeps splitting the list by halves until the list
has one item in it, which when recursively calls back up, it will compare each values
from each list and sort it until a final sorted list is produced

MergeSort vs QuickSort (3) - ANS-1) MergeSort requires more memory
2) MergeSort has a complicated divide step, QuickSort has a complicated conquer step

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 or Stuvia-credit 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 lydiaomutho. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

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

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

75323 documents were sold in the last 30 days

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

Start selling
$7.99
  • (0)
  Add to cart