Which of the following is true about inserting elements in an unordered array? If you add an element at the beginning of the unsorted array, the performance is O(1) if you first shift all elements and then add the new element at index 0 If you add an element at the beginning of the unsorted array, the performance is O(1) if you move only the first element to the end and then insert the new element at index 0 Because you always have to check to see if the array has room for the new element first, the order will always at least be O(n) None of the above

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Please help me the following question

 

  • Which of the following is true about inserting elements in an unordered array?
    1. If you add an element at the beginning of the unsorted array, the performance is O(1) if you first shift all elements and then add the new element at index 0
    2. If you add an element at the beginning of the unsorted array, the performance is O(1) if you move only the first element to the end and then insert the new element at index 0
    3. Because you always have to check to see if the array has room for the new element first, the order will always at least be O(n)
    4. None of the above

 

  • Which of the following is true about deleting elements in an unordered array?
    1. The algorithm for deleting an element is to first search for the element to delete and then if found, remove it and fix the hole in the array
    2. The reason why we must fix the hole in the array after a delete is to ensure the insert, search, and update algorithms still work as designed
    3. Fixing a hole in the array during a delete is why the performance of the algorithm is O(n2)
    4. None of the above

 

  • Which of the following is true about the binary search algorithm?
  1. Binary search improves the performance of search in a linked list from O(n) to O(log n)
  2. The binary search algorithm starts in the middle of the array and then incrementally checks the element next to it until the element is found or the end of the array is reached
  3. Binary search only works if the number of elements in the array is an even number
  4. None of the above

 

  • Which of the following is true about inserting elements into a sorted array?
  1. You can use binary search to find the location to insert the new element, but because you then have to shift the elements to make room for the new one, the performance in the worst case is O(n)
  2. You can use linear search to find the location to insert the new element and then shift the remaining elements to make room for the new element. This results in a guaranteed performance of (n2)
  3. Instead of shifting the elements to make room for the new element, you can move the element there to end of the array and insert the new element to improve the performance to O(1)
  4. None of the above

 

 

 

 

  • Which of the following is true about the delete function for a Double Ended Doubly Linked List (DEDLL) like you did in programming exercise 1?
    1. The delete will always run faster if you used searchReverse instead of searchForward to find the node to delete
    2. When you find the node to delete, you must make sure only the “previous” pointer in the node after it is properly updated
    3. If the node found to delete is the only node in the DEDLL, you only have to set the head pointer of the DEDLL to null
    4. None of the above

 

  • Given a queue implemented as an array with a maximum capacity of 5 elements and O(1) insert and remove, and the following functions are performed in sequence:

 

Insert(“Mozart”), Insert(“Beethoven”), Insert(“Haydn”), Insert(“Chopin”), Insert(“Debussy”), Remove(), Remove(), Insert(“Bach”), Remove()

 

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

  1. The queue has 3 elements that contain a String value
  2. The next element that will be inserted will be at index 1 of the array
  3. The elements currently remaining in the queue are Haydn, Debussy and Bach (not necessarily in that order)
  4. None of the above

 

  • Which of the following is true about recursion in general:
    1. Recursion improves performance of all O(n) algorithms to O(log n)
    2. The base case is often where the recursion stops
    3. The recursive or inductive case is where the recursion stops
    4. None of the above

 

  • Given an array [1 2 3 4 5 6 7 8 10 9], which of the following is true?
    1. If we used InsertionSort on this array, the performance is near O(n)
    2. If we used QuickSort on this array, the performance is near O(n)
    3. If we used MergeSort on this array, the performance is near O(n log n)
    4. None of the above

 

 

 

  • Which of the following concepts about a Binary Search tree is true?
    1. The performance of insert, search, update, and delete are all O(log n) in all situations
    2. The update algorithm first searches for the node to update and then if found, changes its data value and moves to the leftmost location of the right subtree from where the node was originally found
    3. If the tree is balanced, the search function optimally behaves like the binary search algorithm on a sorted array
    4. None of the above

 

  • Which of the following is true about Big-O notation?
  1. It is an indicator of performance of an algorithm as the data that it is applied to grows in size
  2. If algorithm 1 performs at O(log n) and algorithm 2 performs at O(n), then we don’t yet know if algorithm 1 performs significantly better than algorithm 2 and further analysis on the algorithms is warranted
  3. Big-O is used to restate the software code in mathematical terms and acts as an alternative implementation of an algorithm
  4. None of the above
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY