Introduction to Data Structure and Algorithm
Data structure
ADT
Atomic and Composite
Algorithms
Time and Space Complexity
Pseudo Code
So, what exactly is a data structure? What does it do, and why is it so important? A data structure is simply a way to store and organize data in a computer so we can use it effectively. Isn't it fascinating how we use data structures in our daily lives too? Think about how we organize plates after dinner, keep our shoes on the rack, or store files in a drawer. We do this so we can easily find them later. That's why data structures are so crucial. There are so many examples! Did you know we can store data in a linear form or a non-linear form? Some examples of data structures are stacks, queues, linked lists, trees, graphs, and more. How intriguing!
What do you mean by ADTs? Well, ADT stands for Abstract Data Types. And what does Abstract mean?
existing in thought or as an idea but not having a physical or concrete existence. - from the Oxford Dictionary
So, ADTs are data types that don't show the actual code or program of how they are made. Isn't it interesting that we use ADTs in our programs without worrying about how they are implemented? We just focus on using them. We know about some primitive data types like int and float, right? We use these types to store values and perform operations, like adding numbers stored in int or float. Have you ever wondered how they are implemented or what if we had to implement them ourselves? How cumbersome that would be! That's why ADTs are so important and useful. In stacks, queues, linked lists, and more, we use ADTs without knowing their implementation. ADTs come into play when we use them without having to worry about the details of how they work.
Atomic data types are basic types like int, float, and char. Composite data types are user-defined, like string, array, and stack. Composite types are created using atomic data types.
How do you get to the classroom? Imagine this: you wake up, brush your teeth, get dressed, pack your things, head to the bus stop or use your own vehicle, ride to college, park, and finally walk to the classroom. And just like that, you're there! The steps I mentioned are like an algorithm for reaching the classroom. Our goal? To get to the classroom. How do we achieve it? By following these steps. To solve a problem, we break it down into smaller steps. We tackle each step, and eventually, we find the solution. So, an algorithm is a step-by-step process to solve a given problem. Next time you want to reach the classroom, you follow the same steps, which is what we call an algorithm.
When we dive into the world of algorithms in computer science, isn't it fascinating how we also explore time and space complexity? Time complexity, for instance, is all about how much time an algorithm takes to finish. And then there's space complexity, which is about the amount of space an algorithm uses to get the job done. Isn't it intriguing how these concepts help us understand the efficiency of algorithms?
Pseudo Code is a type of code written in a way that's easy for humans to read and understand. It combines some programming syntax with natural language to clearly explain what the code does. Pseudo code helps in writing the actual code later. It is used to outline algorithms before they are executed on a computer.