0

In week 2 David mentions Algorithms e.g. Bubble sort, Binary search etc...

But why are they important? and where do they fit into the bigger picture?

I only did the Caesar cypher and Vigenere cypher from week 2, were they important if you were to do the "Crack" challenge?

3 Answers 3

1

Bigger picture:

In programming, there are certain tasks that appear over and over in some form or another. Sorting data is one of them. Linked lists are another. These tasks have been analyzed extensively and repeatedly, in order to find more and more efficient ways to do them.

Today, when encountering one of these tasks, there's no need to reinvent the wheel. It IS important to understand how to do them! As a new programmer, you really need to at least be familiar with these tasks and at least some of the ways to deal with them. Whenever you see something that seems like it's probably been done before, it probably has, and you should look for algorithms that already do the task and use those techniques yourself.

That's why algorithms are taught early in the class. They are fundamental tools for programming. If there's a task to be done, someone has probably already created some code for it. The more common the task, the more likely an algorithm has been written already, and the more likely that more efficient code for it already exists.

For example, there are many ways to sort data - bubble sorts, stone sorts, merge sorts, the list goes on. There have been whole college classes just on sorting data! You don't need to master them all, but you do need to know that they exist and to be familiar with some of the more popular ones. If you're more ambitious, you might want to study data sorting in depth. The point is, it's important to know that these algorithms exist, and to master at least some of them!

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

1
  • Does it pop up in any of the problem sets ? Commented Aug 7, 2019 at 17:58
0

It is easy to imagine a situation in which a sorting algorithm is useful. Imagine a phone book with a million names, randomly sorted, if we have to look for a specific name, in the worst case we will have to search a million names ... !!!. Combined with a sorting algorithms they are also more effective, in general, search algorithms. The binary search algorithm, for example, is enormously effective. In a search within an array of 500 elements we will need only nine or ten iterations to find a given element.

As for crack, it was originally thought for those people with some knowledge in programming, you must be the one who values whether you can do it or not.

0

Lectures often include information needed for future weeks' exercises.

You will definitely be seeing bubble sorts and binary searches in a future problem set - even though they're not necessary in Caesar or Vigenere.

Keep moving forward! :)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .