100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
DSA Final Questions and Answers Fully Solved $11.49   Add to cart

Exam (elaborations)

DSA Final Questions and Answers Fully Solved

 8 views  0 purchase
  • Course
  • DSA
  • Institution
  • DSA

Exam of 6 pages for the course DSA at DSA (DSA Final)

Preview 2 out of 6  pages

  • August 29, 2024
  • 6
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
  • DSA
  • DSA
avatar-seller
Dreamer252
DSA Final


We no longer have to worry about resizing and we no longer need to shift when
removing.

However, we lose direct index access and each item added is double the size. - answer
What are some advantages to using a Singly Linked List over a Resizable Array
implementation? Disadvantages?

Worst Case RA: N
Average Case: n/2

Worst Case SLS: n
Average Case: n/2 - answerWhat is the computational time for an array based
implementation of List? SLS?

Worst Case: n/2
Average Case: n/4 - answerWhat is the computational time for a Doubly Linked List?

True, if there is no items, the front and back references of the head node links to itself. -
answerTrue or False: There is no null references in a Circularly Doubly Linked List

Worst Case: n/4
Average Case: n/8 - answerWhat is the computational time for a CDLS?

In a LIFO (Last In First Out) fashion. Items are added at the end of the list (push) and
removed from the front of the list (pop) - answerHow does a stack store information?

FIFO (First In First Out) fashion. Items are added to the front and removed from the
front. - answerHow does a Queue store information?

Sequential Searching - answerComparing items in the list one by one until we find what
we are looking for.

We can either have it so that we are eagerly stopping (if found, stop, else continue) or
we are eagerly advancing (if not found continue, else stop)

Best Case Stopping: 2 if successful, 1 if not
Worst Case: 2n if successful, 2n-1 if not
Avg: n if successful, n-1 if not

, Best Case Advancing: 2 for both unsuccessful and successful
Worst: n+1
Average: (n+1) / 2

Eagerly advancing is obviously the best solution - answerWhat are two different ways of
handling Sequential Search? What are their differences in computational time? What is
definitively a better solution?

Binary Search - answerStarting off with a pivot position in a sorted list, make a pivot
position in the middle of the list. If the search key is >pivot, search left, if <pivot, search
left. If it is equal to the pivot, we have found it.

Best Case Stopping: 1 if successful, 2logn if unsuccessful
Worst Case: 2logn-1 if successful, 2logn if not
Avg: logn-1 successful, logn unsuccessful

Eagerly Advancing: log2n + 1 for all cases - answerShow the differences in
computational time between eagerly stopping and advancing Binary Search

Recursion - answerThe act which a function calls itself directly or indirectly in order to
solve a problem

It can be cleaner and simpler in a lot of cases and some problems are just inherently
recursive.

However, performing recursive calls in many cases can absolutely obliterate your RAM
space. - answerWhat are some of the advantages of recursion? Disadvantages?

Base Case - answerThe stopping case of a recursive function

Recursive Case - answerThe case where when the function makes a call to itself

n = 0 or n = 1, return 1

n > 1, return n*factorial(n-1) - answerShow the base cases and recursive cases for
factorial

Recursive: n operations, 2n execution stack operations

Iterative: n operations, 2 execution stack operations - answerShow the computational
differences between recursive factorial and iterative factorial

n = 0, return 0
n = 1, return 1

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 Dreamer252. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

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

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

84866 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
$11.49
  • (0)
  Add to cart