Which data structure is most efficient to find the top 10 largest items of the 1 million items stored in files?
Answers
Explanation:
We are interested in the design of "good" data structures and algorithms. A data structure is a systematic way of organizing and accessing data, and an algorithm is a step-by-step procedure for performing some task in a finite amount of time. To classify some data structures and algorithms as "good", we must have precise ways of analyzing them.
Analyzing the efficiency of a program involves characterizing the running time and space usage of algorithms and data structure operations. Particularly, the running time is a natural measure of goodness, since time is precious.
terms are the foundation terms of a data structure.
Interface − Each data structure has an interface. Interface represents the set of operations that a data structure supports. An interface only provides the list of supported operations, type of parameters they can accept and return type of these operations.
Implementation − Implementation provides the internal representation of a data structure. Implementation also provides the definition of the algorithms used in the operations of the data structure.
Characteristics of a Data Structure
Correctness − Data structure implementation should implement its interface correctly.
Time Complexity − Running time or the execution time of operations of data structure must be as small as possible.
Space Complexity − Memory usage of a data structure operation should be as little as possible.
Need for Data Structure