THESE ARE TRUE/FALSE
1. False, Insertion sort sort one element at a time. Best time complexity measures when the list is already sorted. Best time complexity of insertion sort is O(n)
2. False, Bubble sort swaps adjacent elements to get sorted order. Best time complexity of bubble sort is O(n)
3. True, linked list is a data structure which connects nodes to form a sequence.
4. False, Binary search tree is a binary tree in which left child is less than parent and right child is greater than parent.To search element in binary search tree, we need to traverse the whole tree. Therefore, time complexity is O(h); h is the height of tree.
5. True, AVL Tree is a self balancing tree which has balancing factor of 1, 0, -1. New nodes are inserted at leaf node.
6.True, HashCode function returns hash value of the object in integer value. If two strings are equal , same hash value will be returned.
7.True, Separate chaining is a collision resolution technique which uses linked list. In separate chaining two elements can have same hash value.
THESE ARE TRUE/FALSE The best-time complexity for insertion sort is O(nlogn). The worst-time complexity for bubble...
The time-complexity of searching an AVL tree is in the worst case and in the average case. On), On) O(logot). O(log O ON), C(n) 0(), O(log) Question 16 2 pts The time-complexity of searching a binary search tree is in the worst case and in the average case (1), O(log) O(logn), O(log,n) On), On) 001), 001)
1. What is the worst case time complexity of insertion into a binary search tree with n elements? You should use the most accurate asymptotic notation for your answer. 2. A binary search tree is given in the following. Draw the resulting binary search tree (to the right of the given tree) after deleting the node with key value 8. 10 3. You have a sorted array B with n elements, where n is very large. Array C is obtained...
Match each problem to the time complexity class it likely belongs to: 1. O(1): Constant 2. O(n): Linear 3. O(n!): Factorial 4. O(logn): Logarithmic 5.O(n2): Quadratic 6. O(n3): Cubic OPTIONS: a. Find an element in an unsorted array b. Shortest path between two nodes in a graph c. Matrix multiplication d. Generate permutations of a string e. Add an element to the front of a linked list f. Find an element in a binary search tree
Assume a hash table is implemented using chaining with buckets implemented using sorted linked lists. What's the worst-case time complexity of inserting a data item? (n is the size of data) Oin None of these Oina) O(nLogin) O 0(1) D Question 22 2 pts Assume a hash table is implemented using chaining with buckets implemented using binary search trees. What's the average-case time complexity of searching for a data item? Assume the size of data, n, is not much larger...
Instead of using a linked list to resolve collisions, as in separate chaining, use a binary search tree. That is, create a hash table that is an array of trees. To display a small tree-based hash table, you could use an inorder traversal of each tree. The advantage of a tree over a linked list is that it can be searched in O(logN) instead of O(N) time. This time savings can be a significant advantage if very high load factors...
8 Sorting Algorithms: Bubble, selection, insertion, quick, merge, bucket, radix, counting. 1. A..Which of the above sorting algorithms does TimSort use? 2. Which of the above algorithms sort a REVERSE ORDER list in O(n2 ) (worst case)? 3. Which of the above algorithms sort a REVERSE ORDER list in O(nlogn) (worst case)? 4. Which of the above algorithms sort an ordered list , a reverse ordered list, and a random list (all three) in 0(nlogn) (worst case)? 5. Which of...
for java 4. Instead of using a linked list to resolve collisions, as in separate chaining, use a binary search tree. That is, create a hash table that is an array of trees. To display a small tree-based hash table, you could use an inorder traversal of each tree. The advantage of a tree over a linked list is that it can be searched in O(logN) instead of O(N) time. This time savings can be a significant advantage if very...
fill in the blank Binary Search Tree AVL Tree Red-Black Tree complexity O(log N), O(N) in the worst case O(log N) O(log N) Advantages - Increasing and decreasing order traversal is easy - Can be implemented - The complexity remains O(Log N) for a large number of input data. - Insertion and deletion operation is very efficient - The complexity remains O(Log N) for a large number of input data. Disadvantages - The complexity is O(N) in the worst case...
Puodace a char showing the number of moves required to solve the Towers of Hanoi puzle using t 30. What is an execution frame? What is an activation record? What is contained in it? 31. Write a recursive Java method that computes the factorial of a number 2. Linear search may require up to comparisons while binary search will only require roughly comparisons 33. Sort sorts a list of values by repetitively putting a particular value into its final, sorted,...
A skip list is a data structure that allows Oflog n) search complexity as well as O(log n)insertion complexity within an ordered sequence of n elements. A skip list is built in layers. Each layer is a linked list. The bottom layer is an ordinary ordered linked list. Each higher layer acts as an "express lane" for the lists below, where an element in layer L appears in layer L+1 (higher layer) with some fixed probability p. A search for...