subject

Let D represent a data structure, and let add and remove denote the appropriate operations on that particular structure (i. e. add is push if D is a Stack and enqueue if D is a Queue; remove is pop or dequeue respectively). Consider the following program. Procedure doSomething D := a data structure for(int i = 0; i < 10; i++) D. add(i) int num := random(D. size())* for(int j = 0; j < num; j++) print D. remove() end for end for while(!D. isEmpty()) print D. remove() end while *generates a random integer from the interval [0, D. size()) Determine if each of the following is a possible result of the procedure if (1) D is a Stack and (2) D is a Queue. Explain your reasoning.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 07:30
In the film "epic 2015," epic is the name for:
Answers: 3
question
Computers and Technology, 22.06.2019 13:00
Which part of the cpu accepts data?
Answers: 1
question
Computers and Technology, 22.06.2019 23:00
Is an attack that relies on guessing the isns of tcp packets
Answers: 2
question
Computers and Technology, 23.06.2019 12:00
From excel to powerpoint, you can copy and paste a. cell ranges and charts, one at a time. b. cell ranges and charts, simultaneously. c. charts only. d. cell ranges only.
Answers: 3
You know the right answer?
Let D represent a data structure, and let add and remove denote the appropriate operations on that p...
Questions
question
Mathematics, 10.11.2020 18:50
question
English, 10.11.2020 18:50
question
History, 10.11.2020 18:50
question
Mathematics, 10.11.2020 18:50
question
Mathematics, 10.11.2020 18:50
question
Spanish, 10.11.2020 18:50
Questions on the website: 13722367