Basically I have a very strange and unique taste of things when it comes to my major, and the field I've been most interested in since the age of 4, which is computers and Computer Science. For those who don't know, there's a difference between the two while they are connected. I did enjoy things like programming, solving problems and even for a while working with web services and servers, but Computer Science or CS, is far beyond that. Basically the fundamentals of CS has roots within logic and mathematics, and not much calculus, but rather set theory, matrices, algebra and analysis. I went from doing simple things and tricks to using applications to make movies, animations, video games to programming to more sophisticated programming and then I got into college, studying CS and learning most of it from the beginning and doing it the right way this time.
But the question I keep asking myself is that, which of the many fields in CS interest me more?
The answer is simple, I for now enjoy a great number of the fields I study each semester, but for now, my favorites were none other than Automata Theory and consequently Compilers design.
I've also enjoyed Data Structures and Algorithms since I started studying them. I understand data structures as not just a course in CS, but something that is valuable and useful in life. Nobody that I've seen teach that course at least here teaches it right.
They follow a specific guideline, teaching it in a way that is 95% technical, when really, it can be taught a lot better than that. I always say `data structures` is a very clean and organized company managed via `algorithms`.
Basically the system you have in your closet for instance, on its own can be considered a data structure and you follow a way or an algorithm to put new clothes in or take them out.
Think about it, how much resources we're wasting just because our eyes lie or estimate poorly. Truth is, the very goal of data structures is you creating the perfect way to put data together and use them so that we save time, and storage.
Data structures is very easy to comprehend, and once you do, then understanding the various data structures that are being used today will be easy as well. Basically, a problem that is stated at the very begging has to do with Arrays.
Arrays are computer data structures used in programming. Basically they are reserved space in your computer's memory. Basically a computer has a limited amount of memory, able to store, let's say a number of words, or numbers. Let's say for a specific problem, you need 100 numbers. In math, would you name the numbers a,b,c,d.....,z,aa,ab,ac and so on so that you could assign values to them, or would you index them in a set like a0, a1, a2, and so on?
The same thing is possible with arrays, and the computer software detects array rooms based on their index. It takes the least amount of time to access a subset i or the i-th number or word of an array if you know the array and the number i. Basically the least amount of time it takes to access a number or word in an array, is just when you know the index number. This can be portrayed by assuming a street consisting of 100 houses, and you're looking for a Mr. Smith and you don't know which house he lives in. You have to check all 100 households at worst(assuming he's in the last one) asking for him. But if you were looking for a man in the third house, then you'd go straight to that house.
Now the question pops, how can we solve this problem. Of course, searching is hard in an unsorted list or array. The answer is our own sort of index. Let's say the problem now is finding a Mr. Smith in a hotel. You know he's a guest and he's in his room. The first thing you do is ask the front desk about which room he's in. If they're cooperative, they'll say for instance he's in room 53. You'll go straight to that room. But a hotel never arranges room numbers based on guest names. That is impossible. Even if they did, you'd have to check each floor and each door for his name if they're not sorted. But we'll get to this in a minute.
Let's say you create another list that consists of a name and a room number. If you have that list sorted, then it doesn't take you up to 100 name readings to find Mr. Smith. Your way or algorithm of searching the list may differ from others. That's another problem called Binary Search.
Binary Search is way to search a list, but only a sorted list. That way, you look up into the middle member or cell or room or even hotel floor, but in this case, names. You look up the 50th guest in the list of all 100 sorted by their names. If the name comes before Mr. Smith, for instance Mr. Rogers, you need to look in the half list starting from 51 to 100. If not, then 1 to 49. If it had been Mr. Smith, then you'd been done already. You do this again with the half lists and look up 75 or 25. and you keep doing this until you either find what you are looking for, or you get a list of 1 member and that member is not Mr. Smith in which case Mr. Smith is not a guest on that list, bummer!
It can be proven that Binary Search would do log2 n searches instead of n, where n is the number of items on the sorted list. However, this is where the real question is. Sorting a list takes time, which can be estimated also. If you had a list of n people, would you sort it and run Binary Searches, or just look it up the old fashioned way, which we call Linear Search?
Now if you found this article interesting, I suggest you follow up on DSA, and I think you'd do a perfect job. If not, then best of luck.