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 18:10
How can i delete permalinks from a word press site?
Answers: 1
question
Computers and Technology, 23.06.2019 17:00
1. which of the following is not an example of an objective question? a. multiple choice. b. essay. c. true/false. d. matching 2. why is it important to recognize the key word in the essay question? a. it will provide the answer to the essay. b. it will show you a friend's answer. c. it will provide you time to look for the answer. d. it will guide you on which kind of answer is required.
Answers: 1
question
Computers and Technology, 23.06.2019 23:40
4. what is the reason for including the following code snippet in the header file animal.h? #ifndef animal_h #define animal_h class animal { public: animal(); animal(double new_area_hunt); void birth(); void hunt(double new_area_hunt); void death(); double get_area_hunt() const; private: double area_hunt; }; #endif
Answers: 3
question
Computers and Technology, 24.06.2019 13:00
If you add the following to the query grid in an access query, what is it called? salestaxamt: [salestaxrate]*[totalsale] formula calculated field total calculation
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
Mathematics, 27.02.2020 06:29
question
Health, 27.02.2020 06:29
question
Health, 27.02.2020 06:30
question
Mathematics, 27.02.2020 06:31
Questions on the website: 13722363