Member-only story
Exploring Data Structures: Arrays, Lists, and Trees
Specifically, data structures are the main elements in the understanding of how data is stored and accessed in a program. There are several types of data structures in the most usage, which include: arrays, list, and trees. All of them are different targeted tools and provide certain benefits and opportunities. Knowledge of these structures is crucial when problem solving or fine tuning applications.
Arrays
An array is objects that have similar data types stored in chemical memory location that are close to an individual other. In an array, each item is assigned a number called an index through which to access or modify the element. Arrays are best used for organizing data of the same size that requires direct access as the data is arranged in sequential order.
For instance, if a program needs to store the daily temperatures of a week, an array can be used as:
static int temperatures[7] = {30, 32, 29, 28, 31, 33, 30};.
Arrays are advantageous in that they make it easier for the programmer to access data with a time of complexity order O(1). Of course, they have some problems, they are not capable to expand or shrink their size and need too much time to perform an insert or delete operation, or shift the elements.
Lists
It is worthy of note that list is a more dynamic data structure than an array. It has its type which include singly linked list type, doubly linked list…






