Deck 4: Loops

Full screen (f)
exit full mode
Question
Show the BST after inserting 45, 43, 100, 34, 23, and 3 into an empty BST.
Use Space or
up arrow
down arrow
to flip the card.
Question
a.Suppose you need to store a list of elements, if the number of elements in the program is fixed, what data structure should you use? (array, ArrayList, or LinkedList)
b.If you have to add or delete the elements at the beginning of a list, should you use ArrayList or LinkedList?
c.If most of operations on a list involve retrieving an element at a given index, should you use ArrayList or LinkedList?
Question
Assume the load factor threshold is 75%. Show the hash table of size 11 after inserting entries with keys 14, 3, 24, 35, using separate chaining. Show the hash table after removing 24.
Question
Assume the load factor threshold is 75%. Show the hash table of size 11 after inserting entries with keys 14, 3, 24, 35, using linear probing. Show the hash table after removing 24.
Question
For the AVL tree in the preceding figure, show the new AVL tree after adding element 50. Which node was unbalanced? What rotation did you perform in order to rebalance the tree?
Question
Add the elements 40, 135, 9, 11, 3, 102, into a heap in this order. Draw the final heap.
Question
Suppose that the text consists of characters a, b, c, d, e, f, g, h and frequency of these characters in the text is as follows:
a: 30
b: 25
c: 40
d: 9
e: 20
f: 3
g: 12
h: 23
Draw a Huffman tree to obtain the code for these characters.
Question
Given the following heap, show the resulting heap after removing 62 from the heap. Given the following heap, show the resulting heap after removing 62 from the heap.  <div style=padding-top: 35px>
Question
Show the BST after deleting 60 from the following BST. Show the BST after deleting 60 from the following BST.  <div style=padding-top: 35px>
Question
Show the balance factor of each node in the following tree. Show the balance factor of each node in the following tree.  <div style=padding-top: 35px>
Question
Show the BST after deleting 15 from the following BST. Show the BST after deleting 15 from the following BST.  <div style=padding-top: 35px>
Question
Show the inorder, preorder, and postorder of the following BST. Show the inorder, preorder, and postorder of the following BST.  <div style=padding-top: 35px>
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/12
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 4: Loops
1
Show the BST after inserting 45, 43, 100, 34, 23, and 3 into an empty BST.
2
a.Suppose you need to store a list of elements, if the number of elements in the program is fixed, what data structure should you use? (array, ArrayList, or LinkedList)
b.If you have to add or delete the elements at the beginning of a list, should you use ArrayList or LinkedList?
c.If most of operations on a list involve retrieving an element at a given index, should you use ArrayList or LinkedList?
a. Array
b. LinkedList
c. ArrayList
3
Assume the load factor threshold is 75%. Show the hash table of size 11 after inserting entries with keys 14, 3, 24, 35, using separate chaining. Show the hash table after removing 24.
4
Assume the load factor threshold is 75%. Show the hash table of size 11 after inserting entries with keys 14, 3, 24, 35, using linear probing. Show the hash table after removing 24.
Unlock Deck
Unlock for access to all 12 flashcards in this deck.
Unlock Deck
k this deck
5
For the AVL tree in the preceding figure, show the new AVL tree after adding element 50. Which node was unbalanced? What rotation did you perform in order to rebalance the tree?
Unlock Deck
Unlock for access to all 12 flashcards in this deck.
Unlock Deck
k this deck
6
Add the elements 40, 135, 9, 11, 3, 102, into a heap in this order. Draw the final heap.
Unlock Deck
Unlock for access to all 12 flashcards in this deck.
Unlock Deck
k this deck
7
Suppose that the text consists of characters a, b, c, d, e, f, g, h and frequency of these characters in the text is as follows:
a: 30
b: 25
c: 40
d: 9
e: 20
f: 3
g: 12
h: 23
Draw a Huffman tree to obtain the code for these characters.
Unlock Deck
Unlock for access to all 12 flashcards in this deck.
Unlock Deck
k this deck
8
Given the following heap, show the resulting heap after removing 62 from the heap. Given the following heap, show the resulting heap after removing 62 from the heap.
Unlock Deck
Unlock for access to all 12 flashcards in this deck.
Unlock Deck
k this deck
9
Show the BST after deleting 60 from the following BST. Show the BST after deleting 60 from the following BST.
Unlock Deck
Unlock for access to all 12 flashcards in this deck.
Unlock Deck
k this deck
10
Show the balance factor of each node in the following tree. Show the balance factor of each node in the following tree.
Unlock Deck
Unlock for access to all 12 flashcards in this deck.
Unlock Deck
k this deck
11
Show the BST after deleting 15 from the following BST. Show the BST after deleting 15 from the following BST.
Unlock Deck
Unlock for access to all 12 flashcards in this deck.
Unlock Deck
k this deck
12
Show the inorder, preorder, and postorder of the following BST. Show the inorder, preorder, and postorder of the following BST.
Unlock Deck
Unlock for access to all 12 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 12 flashcards in this deck.