![latoyatuggle23](/avatars/22127.jpg)
latoyatuggle23
24.05.2021 •
Computers and Technology
The following Integer values are pushed onto a stack, s. The values are pushed onto s in the order that they appear below (left to right).
1 7 4 6 10 9
Assume the following declaration has been made.
PriorityQueue priQue new PriorityQueuecinteger> :
Values are popped off the stack, s, and as each value is popped off the stack, it is inserted into the priority queue, priQue. The following code is then executed.
while (!priQueue.isEmpty()){
System.out.println (priQue.remove ())
The numbers printed to the screen would be:
Solved
Show answers
More tips
- W Work and Career How to Start Your Own Business: Tips and Recommendations...
- S Society and Politics 10 Tips for Boosting Your Self-Esteem...
- C Computers and Internet How to Create a Folder on Your iPhone?...
- G Goods and services How to sew a ribbon: Tips for beginners...
- F Food and Cooking How to Make Mayonnaise at Home? Secrets of Homemade Mayonnaise...
- C Computers and Internet Which Phone is Best for Internet Surfing?...
- F Food and Cooking Everything You Need to Know About Pasta...
- C Computers and Internet How to Choose a Monitor?...
- H Horoscopes, Magic, Divination Where Did Tarot Cards Come From?...
Answers on questions: Computers and Technology
- M Mathematics If a jacket was purchased at £75 and had 20% off, what would the price be? 0 000 (а) £15 (b) £70 (c) £60 (d) £65...
- C Chemistry Two pathways are possible, but often one is preferred. construct the preferred pathway for the synthesis of 2-propoxypropane from propene, with propene-derived alkyl halide and...
- H Health How do teenagers develop social maturity...
- E English How do Eli s attitude and feelings towards his father begin to resemble those of Rabbi Eliahou s son? What does he feel when his father dies and why?...
Ответ:
9 10 6 4 7 1
Explanation:
When the values are pushed to the stack they would end up in the stack in the same order as they go in.
1 7 4 6 10 9
when elements are popped from a stack they are removed from the end to the beggining of the stack, and since these elements are being added to the priorityQueue then priQue will have the following order
9 10 6 4 7 1
this will also be the order that the numbers will be printed out from left to right since priorityQueue remove method, removes the elements from left to right.
Ответ:
Short answer is C.