Select true or false for the statements below. Explain your answers if you like to receive partial credit Select true or false for the statements below. Explain your answers if you like to receive partial credit   Which of the following is true about searching elements in an unordered array? With the data is unsorted, search is O(n) because if the element you are looking for is not there, you have to check every element in the array If you start at the end of the array and traverse to index 0, search improves to O(log n) because you only have to look at half of the array If you get lucky with checking the first element and find it immediately, then the worst case performance of search improves to O(n^2)

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Select true or false for the statements below. Explain your answers if you like to receive partial credit

Select true or false for the statements below. Explain your answers if you like to receive partial credit

 

  • Which of the following is true about searching elements in an unordered array?
    1. With the data is unsorted, search is O(n) because if the element you are looking for is not there, you have to check every element in the array
    2. If you start at the end of the array and traverse to index 0, search improves to O(log n) because you only have to look at half of the array
    3. If you get lucky with checking the first element and find it immediately, then the worst case performance of search improves to O(n^2)

 

  • Which of the following is true about searching elements in an ordered array?
    1. You cannot use binary search on an ordered array so the performance is O(n)
    2. If there are no holes in the array and the elements are all next to each other, then the performance for search improves to O(1)
    3. If you do a linear search on a sorted array, the performance improves to O(log n)

 

  • Which of the following is true about the insertBeforeCurrent function for a Circular Linked List (CLL) like you did in programming exercise 1?
    1. If the CLL is empty, you need to create the new node, set it to current, and have its next pointer refer to itself
    2. The worst case performance of the function is O(n)
    3. If you insert a new element with the same data value as the current node, the performance improves to O(log n)

 

  • Given a stack implemented as a standard linked list (only a head pointer) with O(1) push and O(1) pop, and the following functions are performed in sequence:

 

Push(“Charmander”), Push(“Squirtle”), Push(“Bulbasaur”), Pop(), Push(“Larvitar”), Push(“Eevee”), Pop(), Pop()

 

         Which of the following is true after all the functions are executed?

  1. Charmander and Squirtle will be the only elements left on the stack
  2. The head node will be pointing to Charmander
  3. If you Push(“Pikachu”), it will be the last node of the linked list

 

  • Which of the following is true about using the binary search algorithm in a sorted array with no holes and always keeping the order of the array intact?
  1. Binary search improves the performance of delete to O(log n)
  2. Binary search improves the performance of update to O(log n)
  3. Binary search improves the performance of search to O(log n)

 

  • Given an array [10 9 8 7 6 5 4 3 2 1], which of the following is true of the following sorting algorithms if we wanted to sort this array into ascending order?
    1. If we used optimized bubble sort on this array, the performance is O(n)
    2. If we used MergeSort on this array, the performance is O(n log n)
    3. If we used InsertionSort on this array, the performance is near O(n)

 

 

  • Which of the following is true about Big-O notation?
  1. If we say an algorithm performs at O(n), you will get the same number of operations executed no matter how large the data set grows in size
  2. If algorithm 1 is O(n) and algorithm 2 is O(1), algorithm 1 is considered to be significantly better than algorithm 2
  3. O(n log n) is significantly better than O(n)

 

  • Which of the following is true about the delete function in a standard linked list (only a head pointer and nodes only having a next pointer)?
  1. There is only 1 scenario to consider when looking for a node to delete in a linked list
  2. When you traverse the list to find the element to delete, it improves the performance to O(1)
  3. You should always check first to see if the list is empty before attempting to find and delete a node

 

  • Which of the following is true about the Mergesort algorithm applied to an array of numbers that are all different?
  1. Memory usage is efficient because all swaps take place within the same array
  2. Performance is consistently at O(n log n) for all array scenarios
  3. When the partition function completes on the array, the pivot element will always be in the exact center of the array

 

  • Which of the following is true about the linked list functions where the linked list only contains a head pointer?
  1. If the linked list is ordered, you can use binary search and improve the performance to O(log n)
  2. The worst case performance of the delete function is in the same Big-O category as the worst case performance of the delete function with an unordered array
  3. If the node you are deleting is at the end of the list, the performance is O(1)

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Arrays
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education