100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
D278 - questions from the Zybook -3(156 questions and answers). $16.49   Add to cart

Exam (elaborations)

D278 - questions from the Zybook -3(156 questions and answers).

 7 views  0 purchase
  • Course
  • D278 Scripting and Programming Foundations
  • Institution
  • D278 Scripting And Programming Foundations

D278 - questions from the Zybook -3(156 questions and answers).

Preview 4 out of 31  pages

  • August 20, 2024
  • 31
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
  • D278 Scripting and Programming Foundations
  • D278 Scripting and Programming Foundations
avatar-seller
GUARANTEEDSUCCESS
D278 - questions from
the Zybook #3(156
questions and
answers)
Indicate whether the algorithm correctly solves the
problem


Problem: A stack of 1000 name tags is unsorted
but should be sorted. Algorithm:
(1) Remove one tag, start a new stack.
(2) Remove another tag, place in sorted order in
new stack.
(3) Repeat step 2 until no tags remain in original
stack. - answer yes


Indicate whether the algorithm correctly solves the
problem


Problem: A stack of 1000 name tags is unsorted
but should be sorted. Algorithm:

,(1) Start 26 new stacks for names starting with A,
B, ..., Z.
(2) Remove one tag, place in appropriate new
stack, in sorted order in that stack.
(3) Repeat step 2 until no tags remain in original
stack.
(4) Stack the 26 stacks into one stack in sorted
order. - answer yes


Indicate whether the algorithm correctly solves the
problem


Problem: Values for variables x and y should be
swapped. Algorithm:
(1) Copy y's value into x.
(2) Copy x's value into y. - answer no


Consider the problem of finding the maximum of
five positive values, such as values 2 1 6 2 4.
Indicate if the algorithm is correct, namely if max
will end having the maximum value.


max = 0
for each value
if value > max

,max = value
else
max = 0 - answer incorrect, the else part shouldn't
be there


Consider the problem of finding the maximum of
five positive values, such as values 2 1 6 2 4.
Indicate if the algorithm is correct, namely if max
will end having the maximum value.


max = 0
for each value
if value > max
max = value - answer correct


Consider the problem of finding the maximum of
five positive values, such as values 2 1 6 2 4.
Indicate if the algorithm is correct, namely if max
will end having the maximum value.


max = 0
for each value
if max < value
max = value - answer correct

, starting with 1st item, then check each item until
found, or until reaching the lists end ( this type of
search can be slow) - answer linear search


this one check the ranges middle. if the value is
greater, search is made on the upper half, if less,
on lower half. Search continues until found, or no
range remains - answer Binary search


Consider linear search vs. binary search
algorithms, on a list with 500 ascending values: 3,
7, 9, ..., 923, 925.


For linear search, about how many comparisons
are needed to determine if 924 exists? - answer
500


Consider linear search vs. binary search
algorithms, on a list with 500 ascending values: 3,
7, 9, ..., 923, 925.


For binary search, about how many comparisons
are needed to determine if 924 exists? - answer 10


Consider linear search vs. binary search
algorithms, on a list with 500 ascending values: 3,
7, 9, ..., 923, 925.

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

Will I be stuck with a subscription?

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

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

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