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
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...
Related questions
Question
Please help me the following question
- 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
- Which of the following is true about deleting elements in an unordered array?
- 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 - 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
- Fixing a hole in the array during a delete is why the performance of the algorithm is O(n2)
- None of the above
- The
- Which of the following is true about the binary search algorithm?
- Binary search improves the performance of search in a linked list from O(n) to O(log n)
- 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
- Binary search only works if the number of elements in the array is an even number
- None of the above
- Which of the following is true about inserting elements into a sorted array?
- 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)
- 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)
- 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)
- 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?
- The delete will always run faster if you used searchReverse instead of searchForward to find the node to delete
- When you find the node to delete, you must make sure only the “previous” pointer in the node after it is properly updated
- 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
- 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?
- The queue has 3 elements that contain a String value
- The next element that will be inserted will be at index 1 of the array
- The elements currently remaining in the queue are Haydn, Debussy and Bach (not necessarily in that order)
- None of the above
- Which of the following is true about recursion in general:
- Recursion improves performance of all O(n) algorithms to O(log n)
- The base case is often where the recursion stops
- The recursive or inductive case is where the recursion stops
- None of the above
- Given an array [1 2 3 4 5 6 7 8 10 9], which of the following is true?
- If we used InsertionSort on this array, the performance is near O(n)
- If we used QuickSort on this array, the performance is near O(n)
- If we used MergeSort on this array, the performance is near O(n log n)
- None of the above
- Which of the following concepts about a Binary Search tree is true?
- The performance of insert, search, update, and delete are all O(log n) in all situations
- 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
- If the tree is balanced, the search function optimally behaves like the binary search algorithm on a sorted array
- None of the above
- Which of the following is true about Big-O notation?
- It is an indicator of performance of an algorithm as the data that it is applied to grows in size
- 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
- Big-O is used to restate the software code in mathematical terms and acts as an alternative implementation of an algorithm
- None of the above
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
Recommended textbooks for you
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 Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
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 Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
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
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY