Data Structures arrange collections of data items so that they can be used efficiently. Data structures aim to enhance efficiency of the usability and operations of data. More specifically, they are used during the run time of an application to build efficient connections to the application’s data. A stronger data structure should ensure a faster application.
Physical data structures consist of arrays and link lists. They are referred to as physical because they define how the data should be organized in the memory. They will also be responsible for maintaining the data.
Arrays always have a fixed size. They are statically created in either the stack or the heap. Arrays are useful if you know exact size of the data structure (i.e: the length of the array).
Linked Lists are dynamically created data structures that contain a collection of nodes where each node contains data and links to the next node. Unlike arrays, linked lists have a dynamic length and can grow or shrink as needed. Linked Lists are always created in the heap, but the head pointer (the start of the chain) can be located in the stack. Linked lists are useful if the size of the data structure is unknown.
Logical data structures are broken up into linear linear, non-linear, and tabular data structures. They determine what methods and operations can be used to view and manipulate data; and when to use them. Unlike physical data structures, logical data structures are not responsible for maintaining actual data.
Logical data structures are implemented by physical data structures, meaning each logical data structure will use an array, link list, or a combination of the two to work.
Stacks are linear data structures. They work on a last-in-first-out discipline.
Queues are linear structures. They work on a first-in-first-out discipline.
A datatype is defined as a representation of data and an operation on data. 2 byte integers (for example) are represented as 16 bits: 1 sign bit and 15 data bits and they can use arithmetic operations with other integers. The Integer is an example of a primitive data type, meaning that it is understood by the compiler without any additional logic.
Abstract data types are called such because they hide internal details. In Object Oriented Programming, objects and classes are referred to as abstract data types because their internal details are not inherently known. They require definitions in order to be understood by the compiler.