This type of tree has all of its levels filled except for the last one, which is filled left to right.
A complete tree.
Is there a relationship between sibling nodes in a heap? If so, what is it?
No.
"" matches to the following regex:
"([a-z]|)+"
True
a
/ \
c d
/ \ / \
e f g h
/ \
i j
The in-order expression of this tree.
e c i f j a g d h
This collection structure is Last In First Out.
Stack
The substitution methods for replacing nodes when deleting from a binary search tree.
- If it's a leaf, just remove.
- If it only has 1 child, replace with child.
- Replace with leftmost right child.
- Replace with rightmost left child.
These are some properties of heaps.
- The maximum value is always at the root.
- Every sub-tree is also a valid heap
<assignment> ::= <variable> = <literalInteger>;<variable> ::= <letter>+
<literalInteger> ::= <digit>+
<letter> ::= <upperCaseLetter> | <lowerCaseLetter>
Assume valid definitions for upperCaseLetter, lowerCaseLetter, and digit. The following are valid expressions:
A. xyz = 1234;
B. int onlyLetters = 12345678;
C. v1 = v2;
D. v3 = 21;
A
a
/ \
c d
/ \ / \
e f g h
/ \
i j
The post-fix expression of this tree.
e i j f c g h d a
The differences between List, Set, and Map in the collection hierarchy.
- Lists are ordered collections that can contain duplicates.
- Sets are unordered collections that cannot contain duplicates.
- Maps are unordered key-value pairs that cannot contain duplicates keys, but can contain duplicate values.
This traversal of a binary search tree gives the elements in sorted order.
In-order
17
/ \
15 16
/ \ / \
10 13 12 2
/ \
3 9
If we add 18 to the tree, this node will be at the root.
18
We are searching for a jar file with the naming scheme of 2 capital letter initials of the programmer & the 4 digits of the ticket issue.
A. [A-Z]{2}[0-9]+.jar
B. [A-Z]{2-4}[0-9]{4}.jar
C. [A-z]{2}[0-9]{4}\.jar
D. [A-Z]{2}[0-9]{4}\.jar
D
a
/ \
c d
/ \ / \
e f g h
/ \
i j
The pre-fix expression of this tree.
a c e f i j d g h
This method must be implemented to implement the Comparable<E> interface.
compareTo(E)
The time complexity of accessing a value in a B+ tree.
O(log(n))
17
/ \
15 16
/ \ / \
10 13 12 2
/ \
3 9
This node will be the new root after removing 17.
16
[A-Z]?[a\-z]*
The following strings completely match with the above regex expression:
A. Abc
B. Aa-z
C. bc
D. aza-zaz-aza-za
E.
B, D, E
4 2 * 8 2 - 6 * 3 / +
evaluates to...
20
This data structure is quick for adding and removing from an end, but random access to the middle of this structure takes much more time.
If a B+ tree has 7 levels including the root node, how many disc accesses will it take to get to a leaf node assuming the root is in memory?
6
Build the following list into a heap structure:
[5, 8, 2, 4, 6, 1, 13]
13
/ \
8 5
/ \ / \
4 6 1 2
[A-Z][a-z]{2,19}@[a-z]{4,8}.com
The following match the above regex expression:
A. Thisisfake@gmail.com
B. Thisisfake@whoo.com
C. Helloworld@gmaildsd?com
D. Dontemailthis@hotmail*com
A, B, C, D
The post-order expression of
(p/(a-b))*c-(e%k+3)
pab-/c*ek%3+-
If you had an Array
A = [1,2,3,4,5,6,7,8,9]
and you had the memory address of the first element of A, and you went and you added 5 to this address, what would be stored there?
6