Computers and Technology

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.

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 18:30, Jessieeeeey
Kto rozmawia z clamentain przez krótkofalówke w the walking dead która śledzi lee w 4 epizodzie
Answers: 1
image
Computers and Technology, 22.06.2019 22:00, lgary9462
Perform the following tasks: a. create a class named testclass that holds a single private integer field and a public constructor. the only statement in the constructor is one that displays the message “constructing”. write a main()function that instantiates one object of the testclass. save the file as testclass. cpp in the chapter 08 folder. run the program and observe the results. b. write another main()function that instantiates an array of 10 testclass objects. save the file as test class array. c . run this program and observe the results.
Answers: 1
image
Computers and Technology, 23.06.2019 00:30, amy20021
Write the html code to make a link out of the text “all about puppies”. it should link to a pdf called “puppies. pdf” inside the “documents” folder. the pdf should open in a new window.
Answers: 2
image
Computers and Technology, 23.06.2019 04:31, hargunk329
Q13 what function does a security certificate perform? a. creates user accounts b. scrambles data c. identifies users d. creates password policies e. provides file access
Answers: 1
Do you know the correct answer?
Let D represent a data structure, and let add and remove denote the appropriate operations on that p...

Questions in other subjects:

Konu
Mathematics, 23.03.2021 21:30
Konu
Mathematics, 23.03.2021 21:30
Konu
Law, 23.03.2021 21:30
Konu
Mathematics, 23.03.2021 21:30