Answer the following questions true (T) or false (F)
1. A binary search starts at the beginning of the collection of items.
2. An iterative method always calls itself.
3. A method that is declared as static is an object method.
1. False.
2. False.
3. False.
You might also like to view...
Which of the following attributes displays the audio controls in the Web page?
A. controls="controls" B. loop ="loop" C. src ="url" D. autoplay ="controls"
Encryption converts unencrypted, plain text into code called ________
A) keychains B) ciphertext C) WPA2 encryption D) decrypted
(Bucket Sort) A bucket sort begins with a one-dimensional vector of positive integers to be sorted and a two-dimensional vector of integers with rows indexed from 0 to 9 and columns indexed from 0 to n – 1, where n is the number of values to be sorted. Each row of the two-dimensional vector is referred to as a bucket. Write a class named BucketSort containing a function called sort that
operates as follows: a) Place each value of the one-dimensional vector into a row of the bucket vector, based on the value’s “ones” (rightmost) digit. For example, 97 is placed in row 7, 3 is placed in row 3 and 100 is placed in row 0. This procedure is called a distribution pass. b) Loop through the bucket vector row by row, and copy the values back to the original vector. This procedure is called a gathering pass. The new order of the preceding values in the one-dimensional vector is 100, 3 and 97. c) Repeat this process for each subsequent digit position (tens, hundreds, thousands, etc.). On the second (tens digit) pass, 100 is placed in row 0, 3 is placed in row 0 (because 3 has no tens digit) and 97 is placed in row 9. After the gathering pass, the order of the values in the one-dimensional vector is 100, 3 and 97. On the third (hundreds digit) pass, 100 is placed in row 1, 3 is placed in row 0 and 97 is placed in row 0 (after the 3). After this last gathering pass, the original vector is in sorted order.Note that the two-dimensional vector of buckets is 10 times the length of the integer vector being sorted. This sorting technique provides better performance than a bubble sort, but requires much more memory—the bubble sort requires space for only one additional element of data. This comparison is an example of the space–time trade-off: The bucket sort uses more memory than the bubble sort, but performs better. This version of the bucket sort requires copying all the data back to the original vector on each pass. Another possibility is to create a second two-dimensional bucket vector and repeatedly swap the data between the two bucket vectors.
The parent of a node located at index i is located at ____.
A. 2i + 1 B. 2i + 2 C. é(i - 1) / 2ù D. ë(i - 1) / 2û