Recent Posts
- jQuery attrAugust 12, 2021
- jQuery mouseenterAugust 9, 2021
- jQuery ToggleclassAugust 6, 2021
- jQuery attr
Many young programmers scour the web trying to find answers to this question: How to study Algorithms and Data structure? Certainly, a good place to start.
Many young programmers scour the web trying to find answers to this question: How to study Algorithm and Data structure? Certainly, a good place to start… But I believe a more relevant question would be this: What are algorithms and data structures, and why should I study them?
Let’s start with this motivating quote: “Every program depends on algorithms and data structures, but few programs depend on the invention of brand new ones.” — Kernighan & Pike
Wikipedia says “an algorithm is a self-contained step-by-step set of operations to be performed. Algorithms perform the calculation, data processing, and/or automated reasoning tasks.”
You’d be surprised that there are still some of us who could be tripping on words while trying to explain algorithms, data structures, and their importance.
Simply put, whether you are cooking a burger or adding two numbers, there’s an algorithm working its magic there. From monitoring stock markets to oil crises to determining crop yield to pairing soul mates, algorithms are omnipresent.
One definition from the Internet is this: An algorithm is a detailed step-by-step instruction set or formula for solving a problem or completing a task. You need to tell your computer what task to perform, right? You need algorithms or specific computational procedures to achieve the input–output relationship.
Repetition, sequencing and conditional logic or decision are computational concepts that manifest in your everyday life. Your morning routine can be an algorithm. Can you guess how?
Algorithms are much more than instructions. It doesn’t matter if you call them algorithms or programming basics, what matters is that they teach you to define clear steps and conceptualize solutions in terms of distinct steps in a process.
As we are computer science-mad people, I should do some fancy talking about a few algorithm types. Shopping for the prom dress, investing in stocks, or driving to the mall, you are using the greedy algorithm. In the hope of finding a global optimum, you find the locally optimum choice at each stage (Wikipedia).
If you know the famous traveling salesman problem in computational mathematics, then you’ll know how you can apply to delivering meals to homebound people.
On a good day, you go through the zillion names and find it quickly, that is, trying all possibilities till you get a solution that is good enough. A criminal can use the brute-force method, which is a trial-and-error approach, to crack data that is encrypted. This one doesn’t work so well if the complexity (size) of the problem increases.
Do you recall in the late 90s IBM’s Deep Blue used brute force methods to defeat the then reigning chess champion, Garry Kasparov? We have moved on and computational abilities have progressed beyond belief.
You have data compression algorithms using mp3 to JPEG to Zip that reduces the file size by saving oodles of time and space. Huffman is a widely used one; most repeating bytes represent the least number of bits.
This is also a greedy approach and works well to find the best encoding. You will need an algorithm that keeps the error between the desired and real output signals to a minimum for a satellite service or a factory robot, yes? This is the proportional integral derivative (PID) algorithm that uses a control loop feedback mechanism.
If you are from an electronics background, you know I am talking about PID control in heating and cooling systems. This algorithm might have lost to model predictive control (MPC) according to Harvard researchers working on artificial pancreas systems, but it is certainly working wonders for lab-on-a-chip devices.
This is a darling subject. I could go on. But I won’t, of course. Dutifully moving on to the next topic of this blog post—data structures.
No biggie this…data structure refers to an orderly arrangement of data. Something you need when you are arranging key documents in folders in a filing cabinet.
Imagine a legal clerk’s life without such a system! Shudder…Be it an encyclopedia or a bank statement, there is nothing random about these data summaries. Think not binary trees or associative arrays; think a shopping list. Much easier? Data structures store objects and allow their manipulation. You call a mathematical model of a data structure an abstract data type (ADT). Here, binary relationships can link objects.
Data structures can be linear (arrays, stacks, linked lists, or queues) or nonlinear (trees, graphs, tables, or sets).
Why am I talking about them? Well, abstractions help scientists focus on what’s really important, the big picture, and not exhaust their energies on the nitty-gritty.
ADT is a specification mechanism and important for organizing and manipulating data. A graph of fluctuating stock prices is an abstraction of how the money markets in the world are doing.
Or another everyday example of abstraction will be the car getting me to Walgreen’s to get Tylenol without me knowing exactly what’s happening under the hood.
Objects plus Operations equal ADT. The implementation is hidden. That is, the client knows what the operations are but don’t know how the type is implemented.
For example, to define an ADT, you will, therefore, need to define fields in a record or class and the routines or methods. Say, your library changes the program to store when overdue fines need to be paid. Although you might not know it, you are going to be shelling it out if need be.
But a data structure tells you how ADT is implemented and unlike the latter, it also tells you how the data is stored and how the operations work. For instance, Java source code should be accessible only to those who implement the classes, so other programmers can’t tamper with the software.
You will use an algorithm, looking up synonyms in a thesaurus, for example, typically with the data from your data structure, a thesaurus with words arranged alphabetically, for example. I guess you can’t really split them. What I mean to say is that “data structures organize data and algorithms use that organization.”
So this was just an easy-peasy explanation of the basics if you are blubbering like me when a kid asks you what data structures and algorithms are.
You need to understand these high-level building blocks as best as you can to start programming your way to success.
I will end with another motivating quote for all you programmers: “I will, in fact, claim that the difference between a bad programmer and a good one is whether he considers his code or his data structures more important.
Bad programmers worry about the code. Good programmers worry about data structures and their relationships.” – Linus Torvalds
Hope you like our this post also do read our other post.
MCP is the right place for best computer Courses institute and advance Courses in Mohali and Chandigarh.The Complete Programming Academy can change your life – providing you with the knowledge, skills, and performance in a second language which helps you to excel in your job.You can also Contact us for 6 month industrial training institute in Mohali.