Skip to content

Latest commit

 

History

History
51 lines (28 loc) · 5.09 KB

How-To-Implement-Native-ES6--Data-Structures-Using-Arrays--.md

File metadata and controls

51 lines (28 loc) · 5.09 KB

How To Implement Native(ES6) Data Structures Using Arrays & Objects

Smart data structures and dumb code works better than the other way around -“Eric S. Raymond”


How To Implement Native(ES6) Data Structures Using Arrays & Objects

Smart data structures and dumb code works better than the other way around -“Eric S. Raymond”

https://data-flair.training/blogs/javascript-data-structures/

https://data-flair.training/blogs/javascript-data-structures/#### *Abstract Data type (ADT) is a type (or class) for objects whose behavior is*

defined by a set of value and a set of operations. The definition of ADT only mentions what operations are to be performed but not how these operations will be implemented.

Abstract Data Type(ADT) is a data type, where only behavior is defined but not implementation.

Opposite of ADT is Concrete Data Type (CDT), where it contains an implementation of ADT.

Examples:
Array, List, Map, Queue, Set, Stack, Table, Tree, and Vector are ADTs. Each of these ADTs has many implementations i.e. CDT. The container is a high-level ADT of above all ADTs.

Real life example:
book is Abstract (Telephone Book is an implementation)

Abstract data types, commonly abbreviated ADTs, are a way of classifying data structures based on how they are used and the behaviors they provide. They do not specify how the data structure must be implemented or laid out in memory, but simply provide a minimal expected interface and set of behaviors. For example, a stack is an abstract data type that specifies a linear data structure with LIFO (last in, first out) behavior. Stacks are commonly implemented using arrays or linked lists, but a needlessly complicated implementation using a binary search tree is still a valid implementation. To be clear, it is incorrect to say that stacks are arrays or vice versa. An array can be used as a stack. Likewise, a stack can be implemented using an array.

Since abstract data types don’t specify an implementation, this means it’s also incorrect to talk about the time complexity of a given abstract data type. An associative array may or may not have O(1) average search times. An associative array that is implemented by a hash table does have O(1) average search times.

Further Reading:

Keyed collections — JavaScript | MDN (mozilla.org)

Details of the object model — JavaScript | MDN (mozilla.org)

Set — JavaScript | MDN (mozilla.org)

Map — JavaScript | MDN (mozilla.org)

JavaScript data types and data structures — JavaScript | MDN (mozilla.org)

For more content… go to :

bgoonz - Overview
Web Developer, Electrical Engineer
https://bryanguner.medium.com/ https://portfolio42.netlify.app/…github.com

By Bryan Guner on May 15, 2021.

Canonical link

Exported from Medium on August 6, 2021.