Question

Consider a TreeSet object has been initialized and added the following strings (in that order): "Einstein",...

Consider a TreeSet object has been initialized and added the following strings (in that order): "Einstein", "Newton", "Galilei", "Hawking", "Turing", "Liao". What are the strings returned by the following methods?

floor("Liao")

last()

first()


lower("Galilei")
ceiling("L")   

higher("Galilei")
higher("G")
floor("L")
ceiling("Liao")

Homework Answers

Answer #1

1. for floor("Liao"): Liao string will be returned.

2. for last(): Turing string will be returned.

3. for first(): Einstein string will be returned.

4. for lower("Galilei") : Einstein string will be returned.

5. for ceiling("L") : Liao string will be returned.

6. for higher("Galilei") : Hawking string will be returned.

7. for higher("G") : Galilei will be returned.

8. for floor("L") : Hawking will be returned.

9. for ceiling("Liao") : Liao will be returned.




I HOPE THIS WILL HELP

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Use object-oriented programming to write an application for a company that uses a subscription-based business model...
Use object-oriented programming to write an application for a company that uses a subscription-based business model to loan out clothes such as office and party wear to female clients. A subscription costs $69 per 4 weeks. A client can make unlimited loan requests during her subscription, as long as she has no previous loan that has not been returned. There can be only one piece of clothes in each loan request. The chosen piece of clothes takes a day to...
Strings The example program below, with a few notes following, shows how strings work in C++....
Strings The example program below, with a few notes following, shows how strings work in C++. Example 1: #include <iostream> using namespace std; int main() { string s="eggplant"; string t="okra"; cout<<s[2]<<endl; cout<< s.length()<<endl; ​//prints 8 cout<<s.substr(1,4)<<endl; ​//prints ggpl...kind of like a slice, but the second num is the length of the piece cout<<s+t<<endl; //concatenates: prints eggplantokra cout<<s+"a"<<endl; cout<<s.append("a")<<endl; ​//prints eggplanta: see Note 1 below //cout<<s.append(t[1])<<endl; ​//an error; see Note 1 cout<<s.append(t.substr(1,1))<<endl; ​//prints eggplantak; see Note 1 cout<<s.find("gg")<<endl; if (s.find("gg")!=-1) cout<<"found...
1)At 25°C, some second-order reaction 3 X (g)→ 2 Y (g) + Z (g) has a...
1)At 25°C, some second-order reaction 3 X (g)→ 2 Y (g) + Z (g) has a half-life of 5.82 hours when the initial concentration of X is 4.46 M. (a) What is rate constant for this reaction? (b) How much X will be left after 17.5 hours? Example of answer: (a) k = [type your answer] M–1 h–1; (b) [X]t = [type your answer] M. 2) For some second-order reaction: 3 X (g)→ Y (g) + Z (g). The following...
The following mechanism has been proposed for the gas-phase reaction of chloroform (CHCl3) and chlorine. Cl2...
The following mechanism has been proposed for the gas-phase reaction of chloroform (CHCl3) and chlorine. Cl2 ? 2Cl (fast, reversible) Cl + CHCl3 ? HCl + CCl3 (slow) Cl + CCl3 ? CCl4 (fast) What rate law does this mechanism predict? (Choose from the list below and enter your answers in alphabetical order, e.g. ABC ). A)k G) [HCl]1/2 M) [Cl]2 B) [HCl] H) [Cl2]1/2 N) [CHCl3]2 C) [Cl2] I) [Cl]1/2 O) [CCl3]2 D) [Cl] J) [CHCl3]1/2 P) [HCl]2 E)...
‎In this module we've been discussing fossil fuels and the impacts of their use. One of...
‎In this module we've been discussing fossil fuels and the impacts of their use. One of the impacts is an increase in acid deposition (or acid rain as many people refer to it). An acid can be neutralized by a base (also known as an alkali). Acid deposition can be neutralized by the addition of ‎‎agricultural lime‎‎ (an alkaline rock, not the tasty green fruit). The following exercise asks you to calculate how much ‎‎agricultural lime‎‎ it would take to...
1. Assume your blood has a pH of 7.4 and you have been producing urine with...
1. Assume your blood has a pH of 7.4 and you have been producing urine with a pH of 7.4 for a while. You drive to very high altitude (ca. 4,000 m) and spend several hours there. Your alveolar ventilation rate increases (as expected), and eventually this causes your blood pH to rise above 7.4 (your blood plasma becomes more basic than normal). \newline This change in blood pH will initiate compensatory homeostatic mechanisms in your kidneys ("renal compensation") that...
The following data (in thousands of dollars) have been taken from the accounting records of TCorp...
The following data (in thousands of dollars) have been taken from the accounting records of TCorp for the just completed year: Administrative expenses $ 600 Direct labor 800 Finished goods inventory, beginning 480 Finished goods inventory, ending 640 Manufacturing overhead 920 Purchases of raw materials 480 Raw materials inventory, beginning 160 Raw materials inventory, ending 280 Sales 3,960 Selling expenses 560 Work in process inventory, beginning 280 Work in process inventory, ending 200 Answer the two questions below. 1) What...
The project has been performing as planned, and the team members have been exhibiting increasing levels...
The project has been performing as planned, and the team members have been exhibiting increasing levels of trust between each other. The sponsor and the buyer have been satisfied with the delivery of business value, and user acceptance testing results are positive. A technical expert consulting with the team has expressed concerns that the team is not in agreement on the best way to deliver to the next review. If the project manager wants to support the team in reaching...
Mr. Wong is a 78-year-old male from mainland China, who has been admitted for rehabilitation following...
Mr. Wong is a 78-year-old male from mainland China, who has been admitted for rehabilitation following total hip replacement surgery. He has a poor appetite, has experienced weight loss, and has been unable to participate in physical therapy. Thus, he is not meeting his goals for rehabilitation. No evidence exists to suggest an underlying disease process. Ms. Faye, the nurse assigned to care for Mr. Wong is interested in learning what might be going on with Mr. Wong to better...
Mr. Wong is a 78-year-old male from mainland China, who has been admitted for rehabilitation following...
Mr. Wong is a 78-year-old male from mainland China, who has been admitted for rehabilitation following total hip replacement surgery. He has a poor appetite, has experienced weight loss, and has been unable to participate in physical therapy. Thus, he is not meeting his goals for rehabilitation. No evidence exists to suggest an underlying disease process. Ms. Faye, the nurse assigned to care for Mr. Wong is interested in learning what might be going on with Mr. Wong to better...