in Education by
I have seen similar questions and read a lot of the answers. One would think that I would know it then, however some of the answers were contradictory and now I am more confused than when I started. My quest started of as - what is the difference between a Heap and a Priority Queue. To where I learned that Heap was a data structure and Priority Queue was a abstract data type. But why? So far I found this answer to be the best: Simply put, the relation between data structure and abstract data type is the same as the relation between algorithm and pseudo-code. The first is an idea, the second a formal description (abstract, inaccessible). Some mention that ADT is a language dependent term. Since it describes “data types not included in the standard library”. So in Java or JS a Heap is not in the standard library, but previously I learned that heaps are a data structure and not an abstract data type? Can someone clarify in general what a data structure and abstract data type is? JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
A Priority Queue is an abstract data type, it can be implemented in many different ways. A Heap is a data structure, the way it stores data and how it works with it are both well defined. Using a heap to implement a priority queue is a good idea because the way a heap operates on the data aligns very well with the way a priority queue works. If you check the documentation for java.util.PriorityQueue you will see the following comment: An unbounded priority queue based on a priority heap You could think of an ADT as a high level logical description (what it does) while a data structure defines exactly how the data is stored and manipulated (how it's done). Could you implement a priority queue using some other data structure? of course, probably not as efficiently though.

Related questions

0 votes
    How can you set priority for the work queue?...
asked Nov 6, 2020 in Technology by JackTerrance
0 votes
    How many types of data structures does R language have? (a) 2 (b) 3 (c) 5 (d) 8 I have ... Functions and Debugging of R Programming Select the correct answer from above options...
asked Feb 12, 2022 in Education by JackTerrance
0 votes
    Index structures are referred to as __________ since they provide a path through which data can be ... Operation in division Query Processing Techniques of Database Management...
asked Oct 10, 2021 in Education by JackTerrance
0 votes
    All pandas data structures are ___ mutable but not always _______mutable. (a) size, value (b) semantic, ... and answers pdf, Data Science interview questions for beginners...
asked Oct 29, 2021 in Education by JackTerrance
0 votes
    Arrays are best data structures (a) For relatively permanent collections of data (b) For the size of the ... , Database Interview Questions and Answers for Freshers and Experience...
asked Oct 11, 2021 in Education by JackTerrance
0 votes
    I have to unmarshall a XML(XML version 1) to get the values and put these ones in a new version ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 8, 2022 in Education by JackTerrance
0 votes
    There is no summary available of the big O notation for operations on the most common data structures ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 22, 2022 in Education by JackTerrance
0 votes
    There is no summary available of the big O notation for operations on the most common data structures ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 21, 2022 in Education by JackTerrance
0 votes
    In Mercury I can use: A = B^some_field := SomeValue to bind A to a copy of B, except that ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 4, 2022 in Education by JackTerrance
0 votes
    In Mercury I can use: A = B^some_field := SomeValue to bind A to a copy of B, except that ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 4, 2022 in Education by JackTerrance
0 votes
    In Mercury I can use: A = B^some_field := SomeValue to bind A to a copy of B, except that ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 4, 2022 in Education by JackTerrance
0 votes
    Which of the following is the base layer for all of the sparse indexed data structures? (a) SArray (b ... questions and answers pdf, Data Science interview questions for beginners...
asked Oct 29, 2021 in Education by JackTerrance
0 votes
    How to get prints of shared object memory maps or heap memory maps for a given process? (a) jmap ... programming questions and answers pdf, java interview questions for beginners...
asked Oct 26, 2021 in Education by JackTerrance
0 votes
    In an application that uses heap, the memory for data is allocated ____________ (a) logical (b) dynamically (c) ... Security questions and answers pdf, mcq on Cyber Security pdf,...
asked Nov 4, 2021 in Education by JackTerrance
...