Find the signed binary expansion of the number -6.
To convert a negative number into its signed binary representation using two’s complement:
10110
11010
11100
10101
Step 1: Understanding Signed Binary Representation
In signed binary representation, negative numbers are represented in two’s complement form.
The two’s complement representation uses the most significant bit (MSB) to indicate the sign of the number, where ‘0’ represents positive and ‘1’ represents negative numbers.
Step 2: Find Binary Expansion for 6
The binary representation of +6 is 0110
in 4-bit binary.
Step 3: Apply Two’s Complement to Get -6
To convert 6 to -6, we perform the following steps:
0110
→ 1001
1001 + 1 = 1010
Thus, the two’s complement representation of -6 in 4-bit is 1010
.Step 4: Extending to 5 Bits for Signed Expansion
To extend this to 5 bits, we need to add an additional '1' at the left for the negative sign, resulting in 11010
.
Thus, the correct answer is (B).
Consider the following algorithm someAlgo that takes an undirected graph \( G \) as input.
someAlgo(G) Let \( v \) be any vertex in \( G \).
1. Run BFS on \( G \) starting at \( v \). Let \( u \) be a vertex in \( G \) at maximum distance from \( v \) as given by the BFS.
2. Run BFS on \( G \) again with \( u \) as the starting vertex. Let \( z \) be the vertex at maximum distance from \( u \) as given by the BFS. 3. Output the distance between \( u \) and \( z \) in \( G \).
The output of tt{someAlgo(T)} for the tree shown in the given figure is ____________ . (Answer in integer)
In a B+- tree where each node can hold at most four key values, a root to leaf path consists of the following nodes:
\( A = (49, 77, 83, -) \)
\( B = (7, 19, 33, 44) \)
\( C = (20^*, 22^*, 25^*, 26^*) \)
The *-marked keys signify that these are data entries in a leaf. Assume that a pointer between keys \( k_1 \) and \( k_2 \) points to a subtree containing keys in \([ k_1, k_2 )\), and that when a leaf is created, the smallest key in it is copied up into its parent. A record with key value 23 is inserted into the B+- tree. The smallest key value in the parent of the leaf that contains 25* is __________ . (Answer in integer)
A meld operation on two instances of a data structure combines them into one single instance of the same data structure. Consider the following data structures:
P: Unsorted doubly linked list with pointers to the head node and tail node of the list.
Q: Min-heap implemented using an array.
R: Binary Search Tree.
Which ONE of the following options gives the worst-case time complexities for meld operation on instances of size \( n \) of these data structures?
Suppose the values 10, −4, 15, 30, 20, 5, 60, 19 are inserted in that order into an initially empty binary search tree. Let \( T \) be the resulting binary search tree. The number of edges in the path from the node containing 19 to the root node of \( T \) is __________. (Answer in integer)
Three villages P, Q, and R are located in such a way that the distance PQ = 13 km, QR = 14 km, and RP = 15 km, as shown in the figure. A straight road joins Q and R. It is proposed to connect P to this road QR by constructing another road. What is the minimum possible length (in km) of this connecting road?
Note: The figure shown is representative.
For the clock shown in the figure, if
O = O Q S Z P R T, and
X = X Z P W Y O Q,
then which one among the given options is most appropriate for P?