data structure or algorithm design?
Anybody know what is data structure or algorithm design? What are the sample programs? Please help. I am confuse about this topic. =(
- 8 years agoFavorite Answer
Stack, Queue or simply a linked list or even an array is a data structure. Data structure means how you are going to store your data so that you can have efficient addition, deletion, look-up of elements in that list. Addition of an element to an array takes O(1) time (adding the element at last), while look-up takes O(N) (you need to search the whole array, if it is not sorted).
There are other complex data structures like Binary Search Tree, Heap, Graph. All these data structures aim at providing faster look-up, insertion, deletion. Think as if you were to sort an array and you have to choose which sorting algorithm to use. You can choose insertion sort which takes O(N^2) or you can go with merge-sort which is O(NlogN). When writing programs, it is all about speed. So people use some of the existing data structures or even come up with their own data structures depending on their requirements. I hope this helps.
- pyronLv 44 years ago
Your two previous publications all in favour of pc programming. C++ is a language. It has a bunch of syntax you be taught to use. Additionally they had a moderate introduction to computer science. You got here throughout loops, float control, and your normal big contiguous container (arrays). Pc science principles aren't tied down to a language. Loops for illustration, aren't whatever certain to C++. Considering the fact that it is this sort of predominant assemble, every real (Turing complete) language implements it in some manner. C++ has even as and for loops. Python, for example has no direct an identical to C++'s for loop. Nevertheless it has a foreach loop, that enables iteration over a sequence. The identical computer science idea is expressed otherwise in Python. But it's the equal, language impartial idea. Data constructions and algorithms can be your first actual pc science direction. Yes, C++ is also used. Or perhaps yet another C like language. However you won't be focusing on C++. You'll be able to be specializing in CS concepts. DS&A also occurs to be a predominant path, and a basis course. You could simplistically describe an approach to CS issues as: figure out information buildings wanted, after which the algorithms to operate on those knowledge structures. You cannot proceed with out going via DS&A. Your earlier two guides interested by getting C++ syntax proper. So none of your difficulty sets/homework assignments quite confirmed your capacity to clear up arbitrary issues and to be equipped to visualize an implementation for it. This can be a 2d turning factor for many aspiring pc science pupils. In the event you don't like programming itself, good that is that. However you also have got to be capable to imagine a technique to an arbitrary problem. It is not going to be, k this is a crisis, let's appear up a equivalent quandary in the textbook and reuse the code. You are given a quantity of concepts (knowledge constructions and algorithms), and also you have got to put them together arbitrarily to remedy your predicament at hand. For some men and women, that is easy, and for some people, it can be regularly not possible. They get the programming syntax. They understand the concept of a particular constitution. They just cannot put 2 and a couple of together. That is why, you must take this course early on. You'll know for distinct when you like pc science. You can even have the imperative groundwork imperative for different CS courses. Because this is in particular a principal thinking direction, try to in finding either classmates who you recognize for certain are competent to manage the ideas with no trouble and breeze through the direction, or work along with your TAs and professors. It might be particularly dangerous in case your C++ is shaky. Or anything language is used in DS&A path. If it can be C++, get a good C++ guide. C++ Primer (4th model) through Lippman is golden. Accelerated C++ by Koenig is a further first-class booklet, nevertheless it's extra like a book you be trained from than a reference booklet. There is different evolved C++ books to have, however you don't particularly want them for the DS&A direction.