Asap 19. 0() s 20. O(n) is 21. A hashing function matches fronm would be the bes
ID: 3706988 • Letter: A
Question
Asap 19. 0() s 20. O(n) is 21. A hashing function matches fronm would be the best. 23. The wont-time complexity for heap sont is O.Lnlign Section 2. Please pick one eorrecet anewer from the cheices Inade 1, MyArrayList and MyunkedList 2. A linked stracture consists of nodes Each node is dynamically created to boldm are two concrete implementations of MyListae) an element All the nodes are linked together to form a list (rus, false) 3 MyAbstractList partially implements Mylin-gns a 4. MyAmylist capacity is always greater than size and-is-by?'Elemnt " the list. (true, false) 5. MyLinkedList contains all the methods defined in MylList Additionally,My/LinkedList defines severs new methods that are appropriate for processing a linked list. (troe, false) 6. You can use a linked list to improve efficiency for adding and remove an element anywhere in a lis (true, false) 7. Node is defined as an inner class inside MyLinkedList (rue, false) 8. Node has a property named next that links to the node afher this node.(true, fale) 9. MyLinkedList has the properties named first and last to point to the nodes in a linked list true, fase) 10. last.next is always null. (truc, false) 11 Since the insertion and deletion operations on a stack ane made oaly at the end of the stack, uing array list to implement a stack is more efficient than a linked list. (s, false) 12. Since deletions are made at the beginning of the li?st,it s more efficient to implement a queue using linked list than an array list. (true, false) contains all the methods defined in MyLinkedList.(true, fase) 13. MyQueue contains all 14. A verage-case analysis is ideal, but perform probabilities and distributions of various input instances for difficult to perform, because it i hard to determine the relative many problems. (true, false) 15. A pivot can be chosen arbitrarily. (inus, false) 16. A pivot divides a list into two sublists,the elements in the first list are ao larger tha the pot ndt elements in the second list are larger than the pivot,(trus, false)Explanation / Answer
19. Constant O(1) is constant O(n) is Linear and O(n^2) is quadratic
20. Linear
21. Key to value, the Hashing function is generally used in HashMap, HashSet, where data is stored as key-value pairs
22.Insertion. I am quite doubtful but I think Insertion outperforms Bubble sort on sorted data
23. O(n log(n))
Section 2 :-
1. True List is the Parent interface of ArrayList and LinkedList
2.True, linklist are nodes consisting of data and a link to the other node. It is dynamically created and data is not stored consecutively in memory.
3.True, Abstract classes are usually a partial implementation of Interfaces. Here List is an Interface
4.True, If an element is deleted from the list, size reduces by 1.
5.True, Since LinkedList is the implementation class of List interface it will have all the functionality which List interface provides, additionally it has some more methods such as void addFirst(Object element) and void addLast(Object element).
6. False, Since in LinkedList, Random access is not allowed.As LinkedList does not implement the RandomAccess interface. We have to access elements sequentially starting from the first node. therefore for adding and removing ArrayList is the best choice and LinkedList is the worst choice.
7.True, This inner class is made static so that main can access it.
8. True. Since LinkedList consists of a node and a data, this node contains the address of the next node in the linkedlist.
9.True, the first is usually referred to as head pointer and last is referred to as the tail pointer.
10. True, the last node does not point to any other node. so it contains null in the address part of the node.
11.True,Since for adding and deletion we need to traverse the whole Linklist everytime till the end , so when the number of elemets increases time complexity increases, therefore Array List is a better pick.
12.True Since we have a head pointer and we do need to traverse the whole link list. so Linklist performs better
13.False , Queue only Contains all methods of List interface.
14. True , self explanatory
15. True, it is usually desired for the pivot to be chosen randomly. an example in the Random quick sort
16.True , practical application in Quick sort
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.