Which of these sorting algorithms only works on integers

Assignment Help C/C++ Programming
Reference no: EM131065011

Question 1: Which of these data structures allow duplicate values? Choose all that apply.

Queue

Set

Priority queue

List

Question 2. Which of these data structures is most similar to a dictionary, in which more information about an entity is retrieved based on its key?

Stack

Set

Priority queue

Map

Question 3. If you add several objects to a HashSet and it appears that there are multiple copies of the same item, what have you most likely forgotten to do?

override toString()

declare a class field as the key

override equals() and hashcode()

implement Serializable

Question 4. In order to use a TreeMap, which of the following must be true?

the keys must be a class that implements Comparable or you must pass the TreeMap constructor a Comparator for the key objects

the values must be a class that implements Comparable or you must pass the TreeMap constructor a Comparator for the value objects

the keys must be numeric

all of these

Question 5. Which of these is approximately the largest value of n that is feasible for an exponential algorithm on modern computers?

n=3

n= 30

n=300

n=3000

Question 6. What is the time complexity of this method?

public static intnumberOfLargest(int[] data)

{

int max = Integer.MIN_VALUE;

int count = 0;

for (int d: data)

{ if (d > max) { max = d; } }

for (int d: data) { if (d == max) { count++; } }return count;}

Question 6 options:

constant

quadratic

logarithmic

linear

Question 7. What is the time complexity of this method? public static void printMultiplicationSquare(int n) { for (inti=1; i<= n; i++) { for (int j=1; j<=n; j++) { System.out.print(i*j + "\t"); } System.out.println("\n"); }}

constant

quadratic

logarithmic

linear

Question 8. You need to choose a sorting algorithm that is as fast as possible, and memory space is in short supply. Which of these is the best choice?

bubble sort

merge sort

heap sort

they are all equivalent

Question 9. Which of these sorting algorithms only works on integers? Choose all that apply.

quick sort

bucket sort

heap sort

radix sort

Question 10. What does this array look like after the first pass of bubble sort? Assume the values are being sorted into ascending (smallest-to-largest) order.

15, 27, 3, 9, 17, 46, 14, 22, 8

Question 10 options:

15, 27, 3, 9, 17, 14, 22, 8, 46

15, 3, 9, 17, 27, 14, 22, 8, 46

3, 8, 9, 14, 15, 17, 22, 27, 46

15, 27, 3, 9, 17, 8, 14, 22, 46

Question 11. Which of these are characteristics of a heap? Choose all that apply. (Be careful not to confuse heaps with binary search trees.)

each node has at most two children

every node is greater than both of its children

every node is larger than its left child and smaller than its right child

the largest value is in the bottom-right node

Question 12. You need to write a program that frequently adds and removes items at the beginning of a list. Is it better to use an ArrayList or a LinkedList?

ArrayList

LinkedList

the choice doesn't matter in this case

Question 13. You need to write a program that frequently retrieves items from specific indices in a list. Is it better to use an ArrayList or a LinkedList?

ArrayList

LinkedList

the choice doesn't matter in this case

Question 14. You need to write a program that frequently iterates through all the items in a list. Is it better to use an ArrayList or a LinkedList?

ArrayList

LinkedList

the choice doesn't matter in this case

Question 15. If an ArrayList has reached its capacity and you try to add another item, there is a performance hit while a new, larger list is created and the values from the current list are copied over to it. How can this delay be avoided?

add all the items at once

set the initial capacity of the list to an estimate of the number of items it will need to hold

multi-thread your application

add items to the beginning rather than the end of the list

Question 16. What is the third value in the breadth-first traversal of this binary search tree?

2

7

14

23

Question 17. What is the third value in the inorder traversal of this binary search tree?

12

14

10

23

Question 18. What is the third value in the preorder traversal of this binary search tree?

12

14

2

16

Question 19. What is the third value in the postorder traversal of this binary search tree?

23

46

12

16

Question 20

LinkedHashSet

HashSet

TreeSet

1.Very efficient; items are stored unordered

2.Items are stored in the order they are added

3.Items are stored in their 'natural' ordering

Question 21. Match the following complexity terms with their Big-O notation.

Constant

logarithmic

cubic

exponential

linear

quadratic

1.O(n)

2.O(n2)

3.O(log n)

4.O(1)

5.O(n3)

6.O(2n)

Question 22. Put the following time complexities in order from smallest to largest.

cubic

constant

linear

quadratic

exponential

logarithmic

Reference no: EM131065011

Questions Cloud

Calculate the moment of inertia ix for the composite : Calculate the moment of inertia Ix for the composite circular area shown in the figure.
What is the standard deviation of stock a : What is the standard deviation of stock A? What is the expected rate of return for stock B? Based on the risk (as measured by the standard deviation) and return of each stock which investment is better?
Familiarize yourself with this website : Familiarize yourself with this website that gives all of the data requirements for shipments in an Amazon fulfillment center. Please notice the detail given to every aspect of the shipment. Read the requirements and watch the video on pallet loadi..
Design - uml diagrams and overall design : CE00882-4 -  Design - UML diagrams and overall design and implement Java Code - a well-documented code should be submitted.
Which of these sorting algorithms only works on integers : What is the third value in the postorder traversal of this binary search tree? What is the third value in the preorder traversal of this binary search tree?
Determine the flange width b : The wide-flange beam section shown in the figure has a total height of 250 mm and a constant thickness of 15 mm.Determine the flange width b if it is required that the centroidal moments of inertia Ix and Iy be in the ratio 3 to 1, respectively.
Determine the product of inertia ixy for the quartercircular : Using integration, determine the product of inertia Ixy for the quarter-circular spandrel shown in Case 12, Appendix D.
Complete a draft of your marketing communications plan : Your document should include all of the main sections of the plan with headings and subheadings where relevant. Each section should briefly describe the contents that will be included in each section.
Determine the distance to the centroid c of composite area : Determine the distance to the centroid C of the composite area shown in the figure.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd