What Are Linear Data Structures? Dzone Big Data
Download 25.91 Kb. Pdf ko'rish
|
LDS
- Bu sahifa navigatsiya:
- Comment (0) Save Tweet Why should I care
- In 5 Minutes or Less
What Are Linear Data Structures? by Dave Saunders CORE · Mar. 20, 22 · Big Data Zone · Tutorial Like (7) Comment (0) Save Tweet Why should I care? We use these data structures every day in programming. Even if you're already familiar with them, it's helpful to recap them occasionally. In 5 Minutes or Less: As we said in the introduction, a data structure is 'linear' if the elements form a sequence. That means that the data structure has a first and last element, and each element is connected to its previous and next element. An 'array' is a linear data structure; the items are stores sequentially. A 'graph' is not a linear data structure; any node can be linked to any other node in the graph - there is no fixed 'sequence'. (if you're not familiar with graphs, don't worry - there's a newsletter coming up that explores them in detail). Let's take a look at some common linear data structures... Arrays If you've done any programming, you're almost certainly familiar with the concept of arrays. An array is like a bookcase; the items are stored next to each other, but we can jump to any item we like to read it. The items in the array have an 'index' that allows us to reference them directly. image on an array with some elements in The ability to jump to any item we like to read its value is called 'random access', and is a huge advantage of an array. We take this for granted, but this is not a property that many other 'linear data structures' have, as you'll see below. When we allocate an array, we have to determine up-front how much space we need. If we fill our array, we have to stop and allocate some more space. That means that while normal inserts into the array are very fast, occasionally we have to pause for a short time to make the array bigger - which takes some time. Download 25.91 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling