Dynamic Structures using High-Level Programming Languages.
Comparative Programming Languages with Kristoffer Hebert
What is a Dynamic Structure?
Dynamic structures or Dynamic Data structures can remove or add memory as needed at runtime. Common examples are Linked Lists, Heaps, Stacks, Queues and Trees.
Static Memory means memory size is fixed and determined at compilation. Imagine a room with 3 boxes. You fill 3 boxes and can’t add more items to that room. In languages like C++, the Array data structure has a fixed size. The Vector is a dynamic length Array in C++.
// Arraylet x = Array(3)console.log(x.length)
// returns 3x// returns undefined, because index does not exist
Dynamic memory means that memory can grow or shrink, at code runtime. Imagine a room filled with 3 boxes, you can add and removed boxes when needed. You fill 3 boxes, and add 3 more, for a total of 6 boxes. This is the default behavior of an Array in Node.js
// Dynamic Arraylet x = console.log(x.length)
// returns 0// Runtime
// returns 3
The following code implements a simplified Linked List, in various coding languages. However, Linked Lists are data structures native to Java and C++.