Can you use the random_shuffle generic algorithm with a list container? What about a vector container? Why or why not?

What will be an ideal response?


The random_shuffle algorithm requires random access iterators. The list doesn’t have them but the vector does. So random_shuffle does not work with the list container but does with the vector.

Computer Science & Information Technology

You might also like to view...

To find the character at a certain index position within a String, use the method ________.

a. getChars, with the index as an argument b. getCharAt, with the index as an argument c. charAt, with the index as an argument d. charAt, with the character you are searching for as an argument

Computer Science & Information Technology

Which type of function is not a member of a class but has access to the private members of the class?

a. static b. constructor c. destructor d. friend e. None of these

Computer Science & Information Technology

What is the difference between an if statement and a switch statement?

A. The if is used in functions, the switch is used in main. B. They are identical and any place you can use an if, you can use a switch. C. The if statement allows for complicated condition checking, the switch does not. D. The switch statement allows for complicated condition checking, the if does not.

Computer Science & Information Technology

?Match each e-mail part with its description.

A. ?contains the actual message content  B. ?contains information about the message  C. ?may appear at the bottom of an email message; contains standard information about the sender D. ?used to send mail to people who should be aware of the email but are not the main recipients  E. ?text in a subject line indicating a message is forwarded 

Computer Science & Information Technology