Introduction to Data Structures

Give me a minute or two to put my words together. It's my first time doing this so I'm still trying to figure how this works. Let's hope I don't bore you too much.

I would be talking about Data structures today, so grab a pop corn & let's roll.

data-structure (1).jpg

A common bad practice for programmers is learning to code without an in-depth knowledge of Data Structures It's quite unbecoming seeing a lot of Programmers engage on big projects without considering Data structures.

with that in mind, what is a Data Structure? A data structure is a specialized format for organizing, processing, retrieving and storing data. There are various types of data structures, both basic and advanced and they are all designed for specific purposes. just like we have different containers in our kitchen of various shapes and sizes, all used for various purposes.

building blocks.jpg

Data structures are the building blocks for many sophisticated projects. Using data structures is important, but choosing the appropriate data structure is even more important because choosing an inappropriate data structure could lead to slow unresponsive codes. A crate for instance is used to hold eggs and eggs alone, it would be unseemly to use the crate to store onions. That's exactly what happens using wrong data structures. with that in mind, Lets consider the Types of data structures.

  1. Array
  2. Stack
  3. Queue
  4. Linked list
  5. Tree
  6. Heap
  7. Graph
  8. Trie
  9. Hash table .. and lots more but for the scope of this lesson, I would be speaking only Arrays Arrays It is a container which can hold a fixed number of items. These items usually should be of the same type. Arrays are the most common Data structure type for representing Algorithm. They are sometimes called lists. If you need to store data and iterate, Arrays should be your best choice.

array push.png common actions(method) that can be performed on an array include a. push() - This allows us to add an element at the end of an array b. pop() - it allows us to delete the last item from an array c. unshift() - it allows us add element to the beginning of an array d. delete() - it allows us to remove an existing element from the array and re-organize all the other elements in the array e. insert() - it is used to insert one or more elements into an array f. spice() - it allows us to add an element at the middle of an array g. queue () - it allows us to delete elements from both ends (beginning and end) of an array Array can be classified as Static and Dynamic

  1. Static It is fixed in size after it has been defined. It is also called fixed-length arrays. It is used for low level programming languages like C++
  2. Dynamic: It expands as you add more elements. They have allocated memory at the run time with the heap. It is used for high level programming languages like JavaScript. I do hope you have learnt something from here today. Feel free to reach me on my social media handles Happy coding