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 15:30
When creating a budget, log fixed expenses before income. after income. after savings. at the top.
Answers: 1
question
Computers and Technology, 22.06.2019 20:00
Amanda needs to create an informative print brochure for her local library’s fundraiser dinner. what critical detail must she have before she starts designing the brochure?
Answers: 1
question
Computers and Technology, 22.06.2019 20:50
What is the difference between windows 7 and windows 10?
Answers: 1
question
Computers and Technology, 22.06.2019 21:40
Develop a function to create a document in the mongodb database “city” in the collection “inspections.” be sure it can handle error conditions gracefully. a. input -> argument to function will be set of key/value pairs in the data type acceptable to the mongodb driver insert api call b. return -> true if successful insert else false (require a screenshot)
Answers: 2
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
Social Studies, 16.09.2019 04:30
question
Biology, 16.09.2019 04:30
question
Biology, 16.09.2019 04:30
question
Mathematics, 16.09.2019 04:30
Questions on the website: 13722367