100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.6 TrustPilot
logo-home
Exam (elaborations)

CS DSA QUESTIONS AND ANSWERS

Rating
-
Sold
-
Pages
5
Grade
A+
Uploaded on
29-08-2024
Written in
2024/2025

Exam of 5 pages for the course DSA at DSA (CS DSA)

Institution
DSA
Course
DSA

Content preview

CS DSA

In order to do an exact-match search, the key values must define a total order -
answerfalse

One good general-purpose solution to the problem of getting a key from a record is to
define a special method such as ".key()" - answerfalse

{Most programming languages will let us re-define "<" and ">" to handle comparison of
arbitrary objects| We can generally rely on "<" and ">" to let us compare arbitrary record
types} - answerfalse

Defining a record's key field is a property of - answerthe context of the search

In order to be able to sort, the key values must define a total order - answertrue

One good general-purpose solution to the problem of getting a key from a record is to
store Key/Value pairs in the search structure - answertrue

The problem with using a ".key()" method to get the key from a record is that we can't
use this same method to get different fields for different searches - answertrue

n the linked implementation of a queue, a new item would be added to the - answerrear

Which data structure allows insertion only at the back, and removing only from the
front? - answerQueue

Which boolean expression indicates whether the values for the nodes pointed to by p
and q are the same? Assume that neither p nor q is null. - answerp.element() ==
q.element()

Stack A has entries a, b, c (in that order with a on top), while Stack B is initially empty.
When an entry is popped out of stack A, it can be printed immediately or pushed to
stack B. When an entry is popped out of stack B, it can only be printed. Which of the
following permutations of a, b, c is not possible to print? - answerc a b

Which data structure is used for recursion - answerstack

The term "FIFO" is associated with which data structure? - answerqueue

The terms "insert" and "delete" are traditionally associated with which data structure(s)?
- answerList

, Which of the following is not a linear data structure? - answerTree

When is Bubble Sort a good choice for sorting an array? - answerThere is no situation
where Bubble Sort is the best choice over all of the others in this chapter

Bubble Sort (as the code is written in this module) is a stable sorting algorithm. Recall
that a stable sorting algorithm maintains the relative order of records with equal keys. -
answertrue

What is the worst-case time for Bubble Sort (as the algorithm is presented in this
module) to sort an array of nn records? - answerO(n^2)

What is the running time of Bubble Sort when the input is an array where all record
values are equal? - answerO(n^2)

What is the running time of Bubble Sort (as the algorithm is presented in this module)
when the input is an array that has already been sorted? - answerO(n^2)

What is the running time for Bubble Sort when the input array has values that are in
reverse sort order? - answerO(n^2)

In which cases are the time complexities the same for Bubble Sort (as the algorithm is
presented in this module)? - answerWorst, Average and Best

The order of the input records has what impact on the number of comparisons required
by Bubble Sort (as presented in this module)? - answerNone

In the worst case, the total number of swaps done by Selection Sort is closest to: -
answern

The order of the input records has what impact on the number of comparisons required
by Selection Sort (as presented in this module)? - answerNone

What is the average-case time for Selection Sort to sort an array of n records? -
answerO(n^2)

Selection sort is simple, but less efficient than the best sorting algorithms. - answerTrue

Which statement best characterizes Selection Sort (as the code is written in this
module)? Recall that a stable sorting algorithm maintains the relative order of records
with equal keys. - answerSelection Sort is not stable, but with minor modifications it
could be made so

In which cases are the time complexities the same for Selection Sort? - answerWorst,
Average and Best

Written for

Institution
DSA
Course
DSA

Document information

Uploaded on
August 29, 2024
Number of pages
5
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Dreamer252 NBursing
View profile
Follow You need to be logged in order to follow users or courses
Sold
485
Member since
3 year
Number of followers
297
Documents
21392
Last sold
4 days ago

4.0

118 reviews

5
63
4
22
3
18
2
2
1
13

Trending documents

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions