Which of the following interfaces works well for a data structure that can be used for a queue?
a) set
b) map
c) list
d) collection
in java
Ans: d) collection
Collection interface is used for a queue in java. It holds the elements that are to be processed in FIFO order.
Which of the following interfaces works well for a data structure that can be used for...
Please use Java only: Background: Java contains several different types of interfaces used to organize collections of items. You may already be familiar with the List interface, which is implemented by classes such as the ArrayList. A List represents a collection of elements from which elements can be stored or retreived, in which elements are ordered and can be retrieved by index. A List extends from a Collection, which represents a collection of elements but which may or may not...
Which of the folowing are interfaces in java? (a) HashMap (b) LinkedList (c) ArrayList (d) Set (e) HashSet (f) Map (g) List
Q-5 [10] List, stack, and queue. Which type of data access is provided by each stated abstract data types? (a [2) LIST: (b [2]) STACK: (c [2]) QUEUE Which data structure can be used to achieve each stated operation? (d [2) Reverse the order of a data sequence: e [2]) Preserve the order of data received:
PRONS AND CONS OF USING ARRAYS: Set 01: Pro: It can hold the collection of similar items Con: It can hold the collection of similar items only Set 02: Pro: Memory allocated is continuous. You can increment the index to move to next element. You can refer to any item in array using its index Con: Memory allocated is continuous. If that required amount of memory is not continuously avail, well, problem! Insertion and deletion in between the array are...
3. What Collection Framework classes can and can't do. Which of the following things can be done by collection classes (List, Set, or Map)? If you can do it, outline how, mentioning relevant methods, else say that it is impossible and why. A program is designed to have a TreeMap<Customer, String>, but Customer has no compareTo method. Is it possible to get the TreeMap to work without changing Customer.java? You have a Map of Strings to Integers. You want to make...
C++ queue data sructure ising linked list.
Design and implement a Queue data structure using linked list. Support the following usual operations: (a) default constructor (b) parameterized constructor to create a queue of user-specified capacity (c) enqueue (d) dequeue (e) is_full (f) is_empty display (h) destructor that deallocates all nodes (i) copy constructor (j) overloaded assignment operator Demonstrate using a main function.
i. In the space provided, write appropriate data structure for following applications: a. An operating system is to process requests for computer resources by allocating the resource in the order in which they are requested b. A word processor to have f key that causes the preceding command to be redisplayed. Every time the user presses f key, the program shows the command that preceded the one currently displayed C. dictionary of words used by a spelling checker to be...
Quick C Programming Questions: I) Which of the following is false? A) To pass a structure by reference, pass the address of the structure variable. B) A way to pass an array by value is to create a structure with the array as a member then pass the name of the structure. C) To pass a structure by reference, pass the name of the structure variable. D) Passing large structures by reference is more efficient than passing large structures by...
Data Structure ( PYTHON) 1 - What is the output to the terminal with this Python code Dick = [“white”; 0x000000, “black” ;0xFFFFFF] For item in dict; Print(item) 2 - Which condition must a linked list implementation of a queue satisfy when the queue is empty Front is empty Rear is empty Front is null Rear is null 3 - Which method is to be used with a list in Python? ...
Data Structure
Java code
Q2 [ 20 pts]. In computer science, a priority queue is an abstract data type which is like a regular queue data structure, but where additionally each element has a "priority" associated with it. In a priority queue, an element with high priority is served before an element with low priority. If two elements have the same priority, they are served according to the order in which they were enqueued A typical priority queue supports following...