###
Hacker News Comments on

Algorithms, Part I

Coursera
·
Princeton University
·
109
HN points
·
54
HN comments
*HN Academy has aggregated all Hacker News stories and comments that mention Coursera's "Algorithms, Part I" from Princeton University.*

**Course Description**

**HN Academy Rankings**

- Ranked #5 all time · view

**Provider Info**

#### Hacker News Stories and Comments

*All the comments and stories posted to Hacker News that reference this url.*

For formal resources:You might like the Princeton Algorithms Coursera course: https://www.coursera.org/learn/algorithms-part1

SICP is an amazing book, but I HIGHLY recommend you follow along with a lecture video as the textbook was designed to go along with lectures for electrical engineering computer science students. Brian Harvey's lectures are fantastic: https://www.youtube.com/watch?v=4leZ1Ca4f0g&list=PLhMnuBfGeC...

And maybe some math? All of this is kind of abstract to start out with. It might be useful to combine this with youtube videos on your project, because you may be discouraged with doing a lot of abstract work and not concrete work on your project.

Also, freecodecamp and youtube in general is an excellent resource if you're stuck on any particular part of CS. Freecodecamp has compiled a lot of the best videos across the internet on particular concepts and you can get a deep dive into a topic if you're ever stuck. Nowadays, if you're stuck, often viewing someone else's explanation can get you unstuck fairly quick.

⬐ Turing_MachineHarvey also has his own book, which is sort of an "intro to SICP". Available free online:⬐ activitypeaI've found Harvey's lectures do a little too much, and risk less motivated students missing the forest for the trees. In my experience, SICP really focuses on the core points and belabours them until it's 100% sure you got it.

My personal favourite is Sedgewick & Wayne's _Algorithms_.https://algs4.cs.princeton.edu/home/

You can even find an excellent two-part MOOC on Coursera:

https://www.coursera.org/learn/algorithms-part1

https://www.coursera.org/learn/algorithms-part2

Maybe it's not the "purest" class or book, but it's engaging and it lets you understand how algos work AND how to use them in practice.

⬐ cloverichSedgewick is a masterpiece but also overkill for interview prep. Interviews are mostly trivia and for that leet codes volume is your friend. Buy sedgewick for your long term growth but it will stand in the way of any near term interview prep, at least it did for me.⬐ musicaleThe annoying thing as you note is that in the long run Sedgewick >> Leetcode but in the short run it's probably reversed as whiteboard interviews often present algorithm puzzles that are variants of "have you seen this trick before?" and closer to Leetcode questions.I wonder though if "programming contest" (usually more like "algorithm puzzle contest") books like Skiena's might be useful, though I can't help but think that doing an algorithms course first shouldn't be useless.

Sedgewick's Algorithms [1] is pretty good. I found it way more approachable than CLRS. There's also a free course on Coursera[2] from him.1. https://www.amazon.com/Algorithms-4th-Robert-Sedgewick/dp/03...

⬐ wly_cdgrCame here so say this. The booksite has additional materials and, crucially, solutions to many of the exercises⬐ kitdI learned most of my algorithm knowledge from Sedgewick in the 1990s. There is a series that applies them to various languages (C,C++, Java, etc) that makes them very accessible and easy to experiment with.

It's a good question, but has multiple components.The first, and IMHO most important component of your question, is how to improve your actual written code. A few ideas:

~ Pair programming with an experienced programmer, if possible. If not, try to work on a project (even an open source one) with someone who is an experienced software developer and who does comprehensive code reviews. Code reviews from articulate, experienced developers are an excellent way to learn.

~ Write lots of code. Write code in new areas unrelated to your job. Try to find some small project or projects to do. Once you're done, reflect on what you've done and what you could do better next time.

~ Read books like Clean Code. It might also be wise to pick up a book on design patterns, particularly if you'll be working much in object-oriented languages like Java, C#, or C++.

~ Always read source code when possible. Using a new tool at work? If it's open source, go check out the code. Starting a new project? Go find similar projects on Github and browse the code. You could also find some well-known open source projects and read through their code. A good book for ideas on which open source projects to focus on is called The Architecure of Open Source Projects (there are two volumes, shown at the bottom of this page: http://aosabook.org/en/index.html)

~ Learn other programming paradigms, such as functional programming (maybe learn Haskell, or Scheme) or logic programming (learn Prolog). You may never use such languages in your work, but languages in other paradigms will provide you with both a better understanding of computation, and a bag full of useful techniques and ideas for your working language(s).

The next component is how to improve your understanding of data structures, algorithms, and other topics rooted in theoretical computer science.

~ Consider doing problems from sites like leetcode.com and hackerrank.com.

~ The book _Algorithms_ by Robert Sedgewick and Kevin Wayne is very good, as is their free two-part course algorithms and data structures offered on Coursera (https://www.coursera.org/learn/algorithms-part1).

~ Work all the way through the online book Structure and Interpretation of Computer Programs (https://mitpress.mit.edu/sites/default/files/sicp/full-text/...). It will not only touch on a number of important theoretical computer science topics, but you'll also get some good exposure to functional programming.

Finally, to learn commonly used technologies you see on HN, such as Docker or Kubernetes, you'll just need to get your hands dirty:

~ Rent a $5 server on Digital Ocean, or set up a home server, running a Linux distro like Debian or Ubuntu (which often makes installation easier), and start experimenting with them.

~ Continue following HN and reading about new technologies and programming languages.

~ Realize that it's critical for software developers to constantly learn new technologies. Otherwise, they very often become unemployable after a decade or two. HOWEVER, it's also critical that devs exercise restraint and good judgment when selecting technologies for important projects. For such projects, it's usually better to choose languages and technologies that have a proven record and that you personally have a good understanding of, over some new technology that's getting a lot of attention on HN.

With respect to all three of these components, it's a very good idea to maintain a blog and write about your experiences and projects. A blog will serve to not only consolidate your new knowledge, but also to improve your writing and help your career (a good technical blog will be a strong positive signal toward potential employers).

Don't worry about not having a traditional education in computer science. Lots of excellent senior devs I've worked with have no formal training in computer science. As long as you're motivated to constantly learn new languages, technologies, and techniques, and master the ones you already know, then few people will care (or even know) whether or not you have a CS degree.

If you're interested in implementing a hash table I would assume you're also generally interested in data structures and algorithms. I'd highly suggest the Algorithms, Part 1 class on Coursera. It's totally free and offered through Princeton. It covers hash tables in the last segment, albeit implemented in Java, but still very thorough and is a great introduction to common data structures/algorithms and analysis, like linked lists, union find, trees, quick sort and time/space complexity. https://www.coursera.org/learn/algorithms-part1

⬐ prad9104What level of math does one need to understand to take this course?⬐ tmh88jThe math is isn't advanced, any high schooler would've encountered it. Brush up on the basics of exponents and logarithms and you'll be fine.⬐ formerly_provenFor the data structure & algorithm courses I've seen, basically none.⬐ smabieI've ignored math prereqs my entire life and turned out fine. If you're genuinely interested, it's not too hard to learn the math as needed. It might actually be a better way to learn, because you're learning is always in service of other learning.I haven't taken that Coursera course, but in college, I believe only calc I and II are the prereqs for intro to data structures and algorithms. Though I know solid engineers who understand applied CS who don't have a good grasp of math at all.

⬐ labster> It might actually be a better way to learn, because you're learning is always in service of other learning.Me in freshman calculus: Why are we learning these Taylor series? It's so boring, and I'll never need to use it

Me three years later in upper-division meteorology: It turns out 90% of what we do is numerical methods because fluid dynamics is hard with limited data.

It's definitely easier for me to learn things when I have an application for it.

It is true that for some many it is challenging to have a high quality online course.I believe some courses could be taken online. For example, here is an amazing course on Algorithms and Data Structures by Robert Sedgewick https://www.coursera.org/learn/algorithms-part1? at Coursera. It works really well for the online format. So, not all online classes suck.

My major was Physics and I was teaching all five years of the Graduate school. I do not have a slightest clue how is it possible to teach Physics remotely at the acceptable quality.

⬐ ntsplnkv2Of course the inherent meaning in the statement is that a large portion of these things do suck, for most people.I find it telling that most people who start an online course never finish them - why? The experience isn't worth it.

Just like a video call hasn't replaced person-person interaction, nor can an online course truly replace an in-person class - so many more things happen in the classroom or at a university than at home. There is intelligence in human interaction. This is what silicon valley misses.

⬐ frankie_t> I find it telling that most people who start an online course never finish themI wouldn't go this far. Enrolling to an online course is essentially an effortless endeavour, unlike on-campus studying. You don't pay anything (or pay less), you don't have to move physically, you (sometimes) can go at your own pace, you can take just this one course instead of the whole curriculum, etc.

⬐ tdfx⬐ woofie11I would be curious to see how many people who audit university courses for no cost/credit finish them.The majority of online courses suck.But a minority are far better than in-person.

Toss digital scaling in, and it's not a question of if, but when and how. There are real problems people haven't solved, but most of those have to do with how students discover and find good courses, accreditation, etc.

I like Algorithms by Robert Sedgewick. It's a great book. He also has free online courses based on the books that are of excellent quality:- https://www.coursera.org/learn/algorithms-part1

- https://www.coursera.org/learn/algorithms-part2

There's a website for the book as well, that has code that is well organized and commented.

Unfortunately excellent books like "Programming Pearls" have code examples that use weird naming conventions that just make me just want to punch the wall.

For competitive programming and interviews, Antti Laaksonen's books are fantastic: https://www.cses.fi/book/index.php

⬐ M5x7wI3CmbEem10I’ve heard that Part 1 of the algorithms course is sufficient for new grad interviews. Can you verify?⬐ 29athrowawayI got an interview that involved part 2 (substring search), which I solved using KMP.⬐ M5x7wI3CmbEem10senior interview or new grad?⬐ 29athrowaway⬐ blackrockPhone interview for a senior role, not onsite.⬐ M5x7wI3CmbEem10> I’ve heard that Part 1 of the algorithms course is sufficient fornew gradinterviewsIt sounds like you got hazed.I still don’t understand why these software interviews do this. Especially when the work in question, is derivative, and mostly just reformulating other ideas and libraries.

It’s like, how often are you going to have to reinvent your own Red Black Binary Search Tree to solve some obscure business problem? Most of the time, the business doesn’t give a damn. Just throw your data into a database, and be done with it. Then use some queries to filter through your data, and get the data you need to solve the problem at hand.

And usually, by looking at someone’s code style, you know how good they really are. You can determine, if (1) they are at a hackerish level and their code has bugs and occasionally breaks, or (2) if their code is really solid software engineering level quality that’s airtight and can survive anything you throw at it.

⬐ 29athrowawayI prefer these interviews rather than take-home projects, which usually take longer and can be cheated.A company once sent me a really long take home exercise that took like 3 full days to implement to completion. I said: no thanks, and in the same 3 days I had multiple interviews and even got an offer.

1. CS50 [difficulty level: medium, has certificate: Yes] https://www.edx.org/course/cs50s-introduction-to-computer-sc...2. Algorithms [difficulty level: hard, has certificate: No] https://www.coursera.org/learn/algorithms-part1

3. Nand2Tetris [difficulty level: ok, has certificate: Yes] https://www.coursera.org/learn/build-a-computer

https://www.coursera.org/learn/algorithms-part1

For CS theory, I would rather suggest you to focus on classic CS courses, here's my list:0. Do not touch "Introduction to Algorithms" until you are in a dream job.

1. CS 61A: The Structure and Interpretation of Computer Programs https://cs61a.org/

2. CS61B: Data Structures http://datastructur.es/sp16/

3. Coursera: Princeton Algorithm https://coursera.org/learn/algorithms-part1

4. CMU 15213 CSAPP https://courses.cs.washington.edu/courses/cse351/16sp/videos...

5. Keep moving.

⬐ non-entity> Do not touch "Introduction to Algorithms" until you are in a dream jobAny idea why? Its unlikely I'll ever land my "dream job" butnim curious as to the reasoning.

⬐ resouer⬐ sbmthakurIt's an awesome book but kinda theoretical, I'd suggest to read and digest it slowly after you got a great job, not before.⬐ p_lIf by "Introduction to Algorithms" we mean the infamous book by Cormen et al...When I propose to use it to prevent sea rise by drying the sea I only half jest. It's IMO one of the worst books to use except as reference when you already have a good grounding.

Why not "Introduction to Algorithms"?⬐ resouer⬐ b3b0pditto, it's an awesome book but kinda theoretical, I'd suggest to read and digest it slowly after you got a great job, not before.Is the Stanford Algorithms course a good or equal substitute? I started the Princeton one, but the homework was... just not what I would have expected or often threw me for a loop.⬐ resouerPrinceton one is not job interview focused, but is good for one to get started in this field.

This was a homework assignment in Robert Sedgewick's Algorithms course on Coursera!https://www.coursera.org/learn/algorithms-part1

Great class and fun assignment!

⬐ fizwhizWasn't the first assignment about detecting percolation using the union find datastructure? IIRC, sedgwick's class doesn't cover dynamic programming directly at all.⬐ ChickenosaurusSeam carving is the second assignment of Algorithms Part II. I also highly recommend Princeton's Algorithms course on Coursera.⬐ fizwhizAh, I haven't taken Part II of the course. Probably not a bad idea to start :)

For more on percolation, the first exercise in this course is pretty cool:

> I wonder if there are similar courses on CS algorithms for people who didn't study CS in college.This might be a bit more challenging and less hand holding than the nand2tetris course but if you are up for it, why not go with the best? Sedgewick Algorithm book has been one of the standard algorithm books in universities for a long time.

https://algs4.cs.princeton.edu/home/

⬐ volkischQuestion: Why not CLRS instead of Sedgewick's book/course?

If you prefer watching videos/working through a MOOC for this stuff, I can highly recommend Robert Sedgewick's Algorithms I on Coursera: https://www.coursera.org/learn/algorithms-part1If you don't know his name, you should - he's written some of the best books on these algorithms and his MOOC is similarly rich in visualizations and concrete examples that help you develop the intuition for the algorithms. Also incidentally his doctoral advisor was Donald Knuth, who he evidently learned a lot from.

maybe take a look how he teaches: https://www.coursera.org/learn/algorithms-part1

Good for you young jedi. I started coding around that age as well. I made the mistake of not going through comp-sci but have still been able to work for Google, publish books, lead teams and companies and products. You'll do just fine.You have the ability to write some code! If you want to get a jumpstart, you should take the princeton algorithms course (for free!): https://www.coursera.org/learn/algorithms-part1

Or read the textbook by sedgewick that accompanies the course. https://algs4.cs.princeton.edu/home/

There is very little math in there - it may take some elbow grease and mentorship to help to convey some of the ideas - but I believe that you could implement and solve most everything in there. That was my path - I had a teacher at the age of 14 who would explain to me how different algorithms worked and I would go and implement them. Drawing a circle (in memory - it was in C!) or sorting a list (we did bubblesort first IIRC!)

I think you could do it! I believe in you! The course material is approachable - much more so than basically every other algorithms/data-structures material I've found. it may take you some time but you'll be soooo far ahead with your thinking about code.

If you ever start working with Object oriented languages like Java, another book that may help you when you've gone down the road a bit is the Head First Design Patterns book. http://shop.oreilly.com/product/9780596007126.do It's very easy to read, mostly pictures. It is made to be very easy to read (all of the books in that series are so look around at them.)

It's helpful to do both - code and also take in some material, but at 12 I imagine some of the material may be a bit daunting. You're doing really well - keep it up.

> If you come up with a fast sorting algorithm how would you go about making a case it's faster than currently used ones on real world data?For analysing sorting algorithms - and related things which that leads into - there are established ways to determine their best, average, and worst case runtimes for input of a given size.

If you're interested in learning this stuff, the video's here are useful and not math heavy:

https://www.coursera.org/learn/algorithms-part1

Technically it's explained using java. But it's mostly done using primitive data types (eg int, float, byte, ...).

So it's very easy to follow along and copy the implementation, but translated to a different language (Go in my case, as I don't do java at all).

Interviewing is its own skill!! To get into eg Google you have to go through the rites of passage of learning to interview. That's not true of all positions. I give take-away assignments now. I want to see you can turn in good code. That's all I really care about. How you get there doesn't matter, your decisions do.The Golden Rule: When in doubt, use a hashmap. Almost all code challenges are about finding an algorithm or datastructure to fit the problem/solution. Many of them are solvable efficiently via a hashmap.

Preparation

- Practice on a whiteboard

- Do mock interviews with the most skilled people you can find and get feedback! This is critical to glean any information about how you're actually doing! I could volunteer to do that for you remotely if you like. Send me your contact info. I'm a distributed systems guy but could walk you through some problems and tell you how you're doing with whatever you're using for tech very likely still. Drop a note on how to connect if you're comfortable.

- Take an algorithms course before you interview. (The princeton sedgewick one is great and easy to grokk. see coursera: https://www.coursera.org/learn/algorithms-part1)

During:

- Write tests for your code during the interview to demonstrate production quality code.

Especially if interviewing for eg Google. They don't give super tricky problems in every interviews (eg during phone screen) - focus on writing good code that is tested and will compile and run after the interview, not writing mediocre code fast.

- It's okay to incrementally improve your solution. Talk through your thinking. Start at the naive solution and then work toward optimal. Eg give two lists, find any number from list a sums to any number from list b. To start, you could write a couple quick tests on the board to make sure you understand the problem. Then you could reason about solutions - say you could use nested for loops. That's O(n squared) which isn't suitable as a solution. So you ask if the data is sorted. If they say no, you can sort lists, iterate through one and binary search on the larger list to get to an asymptotically linearithmic solution. That's suitable so you write that fairly swiftly. To improve you discover you only need to sort one list so you change the solution to only sort the larger one and iterate through the smaller. If there is extra time you might start to reason about how you can move toward a linear solution. Remember I said the golden rule is use a hashmap? Why don't you make a hashmap out of one of the lists and iterate through the other one to find values in the map? Don't just sit there and take it away to the corner and try to solve it.

God Mode: - WAYYYY before you take the interview: Stop using an IDE at work if you're working in a statically typed language. Use emacs, or vscode or whatever you fancy. Moving to emacs made my brain learn the qualities of the language at an intimate level faster than anything else. You check the docs if you forget the api until you stop forgetting the API. It slows you down a bit at first so it's an investment but whatever - tack 25% on your estimates for a few weeks. You can revert to the IDE for larger refactoring work.

https://www.coursera.org/learn/algorithms-part1

The princeton one on coursera is really great and easy to read. Buy the book and take the course. Sedgewick is my hero. It doesn't require a lot of math in contrast to the Stanford coursera one. It's much easier for the general person to follow IMO. https://www.coursera.org/learn/algorithms-part1

Focusing on a limited set of resources in a way that exercises your problem-solving skills would be the key. Here is one plan:1) Select a category such as "stacks and queues" from the Cracking coding interview (CCI) book and read all the questions. This will give you a sense of the type of questions being asked.

2) Sign up for the algorithms 1 and 2 courses (https://www.coursera.org/learn/algorithms-part1, https://www.coursera.org/learn/algorithms-part2) in the audit mode(free). Pick the correct modules such as "stacks" and "queues" and watch all the videos.

3) Come back to the questions in the book CCI and try to solve the problems yourself. If you get stuck, look at the solutions for hints but still try to do them yourself.

4) Do the same for all major topics such as strings, linked lists, recursion etc.

Unfortunately, you are not going to remember all of you've learned. You need spaced-repetition so repeat the above method 2-3 times for each topic.

Once you have the foundation, you will be able to tackle the harder questions that you may find somewhere else or in the interview.

I've used sites like these when I am stuck with a problem and I would like a hint. But learning the theory is important. The resources I've used recently to train myself are:- Competitive programmer's handbook: https://cses.fi/book.html

- InterviewBit: https://www.interviewbit.com/

- Sedgewick's DS&A course/book https://www.coursera.org/learn/algorithms-part1 http://algs4.cs.princeton.edu/home/

A similar site, with C++ using [some] STL can be found here: http://www.techiedelight.com/data-structures-and-algorithms-...

⬐ JareTechiedelight is a cesspool site which tries to send notifications to your browser, disables selection, copy & paste, and even tries to hide the context menu. God I hate these sites.On the other hand, the Competitive Handbook is pretty entertaining.

⬐ jared123why do u want to copy anything?? u can directly run the code or download the code if you want.. and every website try to push notifications nowdays.. even google. what's wrong in that?? You can simply refuse it if you're not interested. And disabling these functions helps in preventing plagiarism.

Good advice! I have an older version, in which the implementations are explained in Pascal. I understand that newer issues cover java. I'd believe the book goes well with his coursera course:

Robert Sedgewick's course [1] and associated book/booksite [2] have a good overview of Union-Find problem and various algorithms to solve it.

⬐ ApocryphonIndeed, Union-Find is the first subject the course covers, because it uses it as an example of an elementary algorithm.

The Coursera Stanford [0] and Princeton [1] courses start again soon, February 20 to be exact. Not sure which one is better, but to refresh my atrophied CS skills of 10 years I've joined the Stanford course. Not sure how it compares to the Khan Algorithms course. Anyone have any feedback?[0] https://www.coursera.org/learn/algorithm-design-analysis/

⬐ bootloadEdX as well,- 6-00-1x https://www.edx.org/course/introduction-computer-science-mit... (started)

- 6.00.2x https://www.edx.org/course/introduction-computational-thinki... (March)

All are good and are pitched at various levels of complexity. The Princeton course uses Java. Okay if you're into that sort of language/thinking. MIT is using Python. Found one using lisp, "Systematic Program Design" ~ https://www.edx.org/xseries/how-code-systematic-program-desi...

⬐ imakecommentsThis is just my opinion and I'm sure it differs from others...Roughgarden's class is advance and expects mathematical maturity. You may find his course quite fast and rough if you are a beginner.

Sedgwick's class is much easier. He is a bit boring and tries to use "real life" examples (in some instances) from the physical sciences to make the material relatable. This in my opinion detracts from the material. Also, he doesn't always fully explain where he got some of the big ohs here and there.

My advice? Follow MIT's OCW course (it uses CLRS). Supplement it with Algorithms Unlocked, the Khan Academy link in OP and CLRS. If you use those 4 resources and put in the work you'll understand the material.

All 4 sources have Thomas C's DNA touch to it (he is the C in CLRS). So you'll find it consistent when you read from one source to the other. After reading/hearing the same thing about 4 different times in 4 different ways it'll begin to click.

Order of easiness is probably Khan Academy > Algorithms Unlocked > MIT Algorithms Course > CLRS.

Algorithms Unlocked is like "pre-CLRS" and Khan Academy's version is the TL;DR version of Algorithms Unlocked.

Hope this helps.

Below are the links,

https://www.amazon.com/Algorithms-Unlocked-Press-Thomas-Corm...

https://www.amazon.com/Introduction-Algorithms-3rd-MIT-Press...

https://www.khanacademy.org/computing/computer-science/algor...

https://ocw.mit.edu/courses/electrical-engineering-and-compu...

⬐ b3b0pGreat feedback and insight. Appreciated. I'll checkout the MIT OCW and Khan Academy first. I'm hardly a beginner, but my skills feel a bit rusty and want to refresh them.⬐ imakecomments⬐ dwdzNo problem.Any particular reason that you linked MIT course from 2005 instead newer version from 2015?⬐ augusto2112I'm going through Sedgewick's class right now. Is the MIT OCW's course math heavy? It lists "Mathematics for Computer Scientists" as a prerequisite, I am somewhat familiar with the material, but not in a very deep level. Should I take that one before?⬐ Cursuviam⬐ 40acresThe main aspects from Mathematics for Computer Scientists that it assumes is knowledge of asymptotic complexity (O(n)) and basic proof writing skills.Great post, thanks for the resources.I find there are a lot of online resources for those looking to learn algorithms and data structures but I've had trouble finding the same breadth and depth of resources surrounding the math behind CS (discrete math, probability, etc.). Any suggestions?

⬐ imakecomments⬐ zumuRead "Discrete Mathematics" by Epp. Probably the easiest Discrete Math intro I came across.> Order of easiness is probably Khan Academy > Algorithms Unlocked > MIT Algorithms Course > CLRS.Where does Roughgarden's course fit in to this?

⬐ sua_3000I've taken both Stanford's and Princetons Coursera courses, and powered through the MIT OCW, and I would say this evaluation is spot on.If you have to pick only one go with the MIT OCW, and snag a copy of CLRS. I got mine from my local lib. and it gave me more than enough time to work through the problem sets from the mooc.

Here is Princeton's Algorithm text I've found useful (The code is in JAVA though): http://algs4.cs.princeton.edu/home/Pair this up with this excellent lecture by the authors Sedgewick and Wayne: https://www.coursera.org/learn/algorithms-part1/home/welcome

I recommend learning discrete mathematics, then data structures and algorithms.I cannot stress enough how important mathematical foundations is. It'll make everything else much easier to learn. I haven't read the book but heard good things about: https://www.amazon.com/Discrete-Mathematics-Applications-Sus... as a beginner text.

Coursera has multiple offerings on Data Structures / Algorithms -- find one that works best for you.

For instance:

https://www.coursera.org/learn/introduction-to-algorithms

https://www.coursera.org/specializations/algorithms

https://www.coursera.org/learn/algorithmic-thinking-1

https://www.coursera.org/learn/algorithmic-toolbox

By doing all of those you'll get a good introductory exposure to the topics.

You should also look at a rigorous course offering of Algorithms. MIT has a few online to view.

Some readings for a beginner are:

https://www.khanacademy.org/computing/computer-science/algor...

https://www.amazon.com/Algorithms-Unlocked-Press-Thomas-Corm...

https://www.amazon.com/Introduction-Algorithms-3rd-MIT-Press... (not beginner level but classic)

After all of this you should be fine with diving into interview books. You'll want to whiteboard solutions and be able to do all the difficult problems. Look into sites like leetcode, glassdoor and be able to do the difficult problems posted there.

⬐ 40acresThanks, there are some good resources here. I rushed through CLRS to help prepare for these interviews but I failed at the phonescreen, which was mostly comprised of Leetcode / Hackerrank type questions. I'll definitely take a look at the coursera course specialization but it seems as though these interviews comprise of a 'programming challenge' type question for the phone screen and more with a focus on data structures, algorithms and system design for the onsite.

Skiena's book is excellent and is definitely one to get.Another would be Sedgewick's

Algorithms. He has a pair of courses on Coursera [0] that follow his 4th edition which uses Java.You're in for such a treat! Learning data structures and algorithms is so fun and really changes the way you think about programming.

[0] https://www.coursera.org/learn/introduction-to-algorithms

⬐ 0x54MUR41Thank you for your recommendation and advice. I will go for Skiena's book since a lot of people recommend it.

I viewed classes from all three mentioned above and found Prof Sedwick's classes to be very structured and to my style/liking. Prof. Roughgarden is "free flowing" and may require fast thinking to follow him. Prof Demaine's classes gets very mathematical and I found myself sometimes lost in Greek symbols. But Prof. Demaine is very thorough in building the theory.[1] Prof Sedwick: https://www.coursera.org/course/algs4partI

As @carise said, the content may be gone after June 30th and if you want to download, you can do so using coursera-dl tool

https://github.com/coursera-dl/coursera-dl

[2] Prof Roughgarden: https://www.coursera.org/learn/algorithm-design-analysis

[3] Prof Erik Demaine (MIT OpenCourseware): https://www.youtube.com/playlist?list=PLUl4u3cNGP61Oq3tWYp6V...

There are videos of MIT's Prof Erik Demaine's Intro to Algo's from various semesters. I think any one should do.

I use a combination of Coursera and Udacity to learn the algorithms, and Hacker Rank to find places to implement them.I actually just cruised through this course and found it super useful. Edit: By cruised I don't mean did it easily but instead just watched the videos, because I was cramming whenever I could fit time in.

https://www.coursera.org/course/algs4partI

It covers Binary Search Trees pretty well and some other things on the list. I also really like this teacher.

https://www.hackerrank.com/domains/algorithms/warmup/difficu...

Also, Algorithms, Part I and II (https://www.coursera.org/course/algs4partI and https://www.coursera.org/course/algs4partII) by Kevin Wayne and Robert Sedgewick of Princeton University. They approach algorithms from a slightly different angle than Stanford course does and in my opinion they complement each other very well. I was very impressed by the lectures, practical problems, the autograder, and the 'Algorythms 4th edition' book.p.s. don't expect any certificate of acomplishment for those courses though. I did them both close to 100% and they did not even show up in completed courses on Coursera. I guess it's the Princenton thing, and I came just for the knowledge so that was fine with me.

The Sedgewick/Wayne algorithm classes: https://www.coursera.org/course/algs4partI and https://www.coursera.org/course/algs4partII

https://www.coursera.org/course/algs4partI https://www.coursera.org/course/algs4partIII took these to prepare for first-job interviews coming out of grad school. Got an offer from a company frequently mentioned on this site, so I guess they helped.

There are a lot of MOOCs (Massive Open Online Courses) nowadays that offer CS theory. For example, Coursea has an algorithm class available (https://www.coursera.org/course/algs4partI).MIT also offers classes as well (http://ocw.mit.edu/index.htm).

⬐ brudgersCoursera, etc. offer great resources for learning CS. I think Roughgarden's sequence https://www.coursera.org/course/algo is better than Sedgewick's, because it's targeted at upper division rather than lower division students and is language neutral.On the other hand, Coursera etc. fall into a bit of a grey area regarding "outside of college". Though I tend to think that limiting the options to outside of college doesn't get the OP much.

There's an ongoing Algorithms course on Coursera right now!https://www.coursera.org/course/algs4partI

edit: found another one, also happening now (can't believe I missed it): https://www.coursera.org/course/algo

Coursera has a couple courses coming up:Algorithms: Design and Analysis, Part 1: https://www.coursera.org/course/algo

Algorithms, Part I: https://www.coursera.org/course/algs4partI

Sedgewick's course on Algorithms, through Coursera, is pretty good, for anyone who wants to learn more about basic algorithms, or (like me) needs a refresher.

You could check out the following resources:1. Coursera Algorithms I for formal university-style learning. See https://www.coursera.org/course/algs4partI

2. Algomation.com for visualising algorithms. See http://www.algomation.com/

3. http://bigocheatsheet.com/ for time/space complexities for the most common data structures & algorithms.

4. The book - Cracking the Coding Interview which goes through the questions that top companies like Google, Amazon, Microsoft ask during interviews. For their solutions, see https://github.com/gaylemcd/ctci

Hope that helps in some ways.

⬐ GFischer+1, I just enrolled on the Coursera algorithms course, I was going to recommend that one.My only complaint is that they removed the videos from past sessions (I did find them elsewhere on the web).

There are plenty of very good MOOCs on algorithms -1. https://www.coursera.org/course/aofa

2. https://www.coursera.org/course/algs4partI

3. https://www.coursera.org/course/algo

⬐ bigb9320Which of these would you recommend for someone who has been programming since 2 years but wants to improve their fundamentals ?⬐ prometheuspkI'd go for aofa

If you're familiar with online courses, then you probably know Coursera, but there are two decent algorithm courses that cover a lot of good stuff about data structures and algorithms starting again in the new year. You can check them out on these pages:https://www.coursera.org/course/algs4partI https://www.coursera.org/course/algo

Coursera has both Sedgwick's lower division sequence in Java and Roughgarden's two class upper division sequence using whatever language the student chooses.https://www.coursera.org/course/algs4partI

https://www.coursera.org/course/algo?from_restricted_preview...

There are also upper division courses by Sedgewick as well.

Just don't apply to those companies, you probably wouldn't like it there anyway.In fact that interviewing style is being abandoned, see here the case of Google: http://www.dailymail.co.uk/news/article-2346126/Google-aband...

So why invest so much time and effort in preparation for an interviewing style that is only practiced by a small minority of employers. Its a big world out there.

One alternative: become a freelance, as those interviews are usually only for employees, and you tend to take a lot less bulshit being interviewed as a freelance, things are kept much more to the point.

Alternativelly, take this course at Coursera, lots of food for thought there -> https://www.coursera.org/course/algs4partI

Still for those interviews you indeed need to prepare: buy books on how to do those interviews, practice at home, etc. remember it has nothing to do with on the job day to day work, its just an absurd silly game.

https://www.coursera.org/course/algs4partI https://www.coursera.org/course/aofaThe two books that helped me the most were:

Algorithms, 4th Edition by Robert Sedgewick. Material: http://algs4.cs.princeton.edu/home/

and Data Structures and Algorithms in Java, 2nd Edition by Robert Lafore

Both are in java.

For points 1 and 2 coursera.org has a great set of courses on algorithms[1], Taught by a Princeton professor. I started the first one a couple of months ago, but had to drop out because of time constraints. I've re-enrolled for the upcoming section. It has a companion book, Algorithms[2], that I bought which was a great help. I don't have a copy of CLRS[3] But I've heard it is also a great reference and is on my amazon wishlist. Other than that, MIT's OpenCourseWare[4] also has the entire CS degree online for free. It's funny, reading your post I thought I hide sleep posted or something. You seem to be experiencing exactly what I'm going through. I'm also 27 and don't have a CS degree. I am highly motivated though, and have no problem hacking at this stuff on my own. I've talked to a bunch of CS majors who actually still feel inferior after they graduate so other than helping the impostor syndrome[5] that I suffer from, I'm not sure that a degree would do me a lot of good. (With the exception of padding my resume and getting me in the door for an interview). [1] https://www.coursera.org/course/algs4partI [2] http://amzn.com/032157351X [3] http://amzn.com/0262033844 [4] http://ocw.mit.edu/index.htm [5] http://en.wikipedia.org/wiki/Impostor_syndrome

https://www.coursera.org/course/algs4partI The Cousera couse above is a really good. Its centered mostly around Java, but the basic principles, of course, can be used in any programming language.

My high school math teacher used to say math is like handcraft. I'm a lousy student but if you have the discipline and will to learn something I'd look at where you tap out in the chapter and try to learn that. Math is based on a lot of concepts. You have to solve the problem sets in order to grasp a lot of concepts. A lot of books are very dense and theoretical. Start small. Read the college textbooks for the algorithm courses and try to solve the problem sets on your own. If you are stuck join some communities. There are subreddits and forums dedicated to math. If you ask there kindly with a concrete problem and your efforts you'll get an helpful answer. That's the only thing that works for me: Solve the problem sets on your own. Everything will be easier. And don't take shortcuts. That's at least my experience.There is: http://en.wikipedia.org/wiki/Introduction_to_Algorithms which is pretty readable.

And there are a lot of MOOCs:

https://www.coursera.org/course/algs4partI

https://www.coursera.org/course/algs4partII

https://www.coursera.org/course/algo

https://www.coursera.org/course/algo2

If you work yourself up from there and solve one problem after another you'll be quite good at these things in a few months time.

There is an Intro to Programming in Java on Udacity[1] and an Algorithms in Java class on Coursera[1][1]https://www.udacity.com/course/cs046 [2]https://www.coursera.org/course/algs4partI

I've been taking an algorithms course on Coursera and I'm really enjoying it. It's taught by two professors from Princeton, Kevin Wayne and Robert Sedgewick. Heres the link:https://www.coursera.org/course/algs4partI

I'm sure there are plenty of other online algorithms courses online too.

If you have enough time, the Robert Sedgewick's course[1] could be the answer you're looking for. It's much more engaging to watch video lectures and discuss the material with other students than it is to read articles on Wikipedia or some boring textbook.

I started taking Bob Sedgewick's class and like it so far. https://www.coursera.org/course/algs4partI

⬐ WizzleKakeSeeing some comments about Java...I'm taking this course right now (just finished the first "percolator" assignment this afternoon!). I've never used Java before this, but getting Eclipse up and running with "Hello World" was easy. Eclipse took a little exploring to get used to, but the C-like syntax of Java makes the language very easy to pick up.

If interested in this material, but turned off because you can't use your favorite language: take this as an opportunity to step outside of your comfort zone. That's what I'm doing. It's character building.

⬐ tokipinSedgewick's tone/approach is very natural. He says things in terms of "this is what we know," sometimes implying that the subject is not as settled as it appears. This in contrast to professors that just go through the motions of "this is X, this is Y, quiz on Friday."⬐ xjtianI found the video lectures for this course extraordinarily boring compared to the Stanford algorithms courses taught by Roughgarden. Sedgewick is a brilliant computer scientist, but those videos really put me to sleep.Both classes are still solid offerings from Coursera, but having gone through both levels of both, I'd recommend the Stanford ones first.

Also, I don't know if this has changed, but the programming assignments required a custom Java installation provided by Princeton with a bunch of extra packages specifically for the course. I found that a little weird compared to the Stanford class's approach of just giving you an input file and verifying the output provide (ala a coding competition).

⬐ packetslave⬐ kenster07There is no "custom Java installation" required, although they do offer one (called "DrJava") to get people up and running quickly and presumably to make support easier. I used IDEA and it worked just fine.They do require one JAR file, stdlib.jar, to handle things like file I/O that are boring and take away from the algorithms themselves.

There is a second JAR, algs4.jar that contains all of the completed classes, which is useful if you want to implement one particular algorithm yourself, without going back and implementing the others that it relies on.

⬐ justin66> I found the video lectures for this course extraordinarily boring compared to the Stanford algorithms courses taught by Roughgarden. Sedgewick is a brilliant computer scientist, but those videos really put me to sleep.At the risk of sounding overly negative when it's not intended: they're both very boring lecturers. I actually wonder if that might change a bit when they're interacting with a real audience.

⬐ sirclueless⬐ jimgardenerHaving actually been in Sedgewick's lectures, I can confirm that his soothing slow monotone is more effective than Nyquil for lulling students to sleep. That said, his course is damn excellent, and I know of no other teachers that have done better at making a course that actually teaches comp sci fundamentals in an approachable way. He's very understandable and clear even when played at 1.5x speed, which I recommend to anyone who isn't having trouble thinking through the concepts faster than he can lecture through them.for me it was the other way around :) I felt Roughgarden was skimming through the lessons..Sedgewick ,in my opnion is the better teacher⬐ caycepit's the grandfatherly tone...⬐ anoopeliasOn the contrary, I found Sedgewick's lectures very interesting. The animations of algorithms using cards, trees, nodes etc. is an excellent way to get a good grasp. It is a solid representation of what you would imagine in your mind while learning algorithms.Another particularly interesting thing about his lectures is when he shares some stories from his vast experience over the years. For eg. When they named a red-black BST after the best contrasting colours you could get on the first ever color printer built in Xerox PARC. Or his excitement to build an animation for Prim's MST on a personal computer.

⬐ wavesoundsCame here to say the same thing, I thought he explained things well and in different ways then I had learned them in the past.I believe Java is chosen for its popularity and its static typing, which helps the learner gain a better understanding of the algorithm at play than a duck-typed language would. It is even better to learn algorithms in C, where one has to work directly with the memory trade-offs. But learning these algorithms in Java is certainly more effective than learning them in Python, Ruby, etc.⬐ uniclaudeI know some (most?) of you reading HN saw this last week, but remember that you can use Coursera-dl[1] to download the material for offline reference.⬐ carlosgg⬐ temuzeI just tried it, did not work :(. Says failed to authenticate as username. I tried it on Saturday and it worked ok. Maybe they are blocking it?⬐ mlashcorpIt's working for me ... this was a godsend! Thanks a lot!⬐ carlosggWhen was the last time you tried it?⬐ manojldsNot working for me too with the same error.Noticed the issue raised ( probably by you? ) - https://github.com/dgorissen/coursera-dl/issues/81

Edit: Tried this one ( https://github.com/jplehmann/coursera ) and it too failed for login.

⬐ carlosggYes that was me. I hope Coursera has not blocked it somehow...I think the dgorissen implementation is based on the other one, so not surprising the other one doesn't work either.⬐ carlosggAre you running Firefox at the same time as the script? :)I took this class in Princeton - COS226 http://www.cs.princeton.edu/courses/archive/spring13/cos226/...It was easily one of my favorite classes. It's very straightforward and the lecture slides are great. I highly recommend flipping through them.

⬐ gavinpcSigned up. I've been developing online education software for a few years now, and never actually used any. And like many self-taught, working programmers, I'm very weak on algorithms. So I'm excited.Side note, am I the only person on earth who whitelists cookies? With cookies blocked, every page on coursera.org, including the home page shows nothing but the word "loading" and a spinning gif. Blogger was like that for a while, except they had gears. Sure, you need cookies to log in, and sure, they're used for analytics, and sure, you can do some progressive enhancements if I come back. I guess I'm old fashioned, but I'm at a loss to understand how the failure to get cookies back from a first-time visitor can stop all content from "loading," including the template. Must be a framework thing.

⬐ alfiejohn_Great, but I hope it doesn't follow the book..."Algorithms in C" by Sedgewick is a great book, which uses C to implement the algorithms talked about in the book. "Algorithms" also by Sedgewick, which looks like this course is based on, spends a hell of a lot of time teaching you Java!

⬐ s_q_b⬐ gnuvinceIt look substantially similar to COS 226 at Princeton, also taught by Kevin Wayne, which uses this textbook: http://algs4.cs.princeton.edu/home/⬐ carlosgg⬐ inglespYes, that's the textbook for this course.⬐ s_q_bIf that's the case, there's an unhealthy amount of basic Java in the text, but it's still a very good course.I've just done the first week's lectures and exercises. They assume you know Java, but if you don't you're pointed in the right direction for suitable resources.⬐ tomkuI took one of the previous offerings of the course, and they assume that you know Java. The programming assignments start on week 1 with "real algorithm" work, there's no time wasted introducing you to Java or anything like that.I watched the video (but didn't take part in the class assignments) last spring, and I want to paraphrase an important remark by prof Sedgewick that really struck a chord in my mind:> Though we have faster computers, algorithms remain absolutely essential in our field, because the amount of data that we process is greater than ever before.

It was nice to hear someone in a position of authority clearly explain why this field of research is important. It also helps understand why he prefers tilde notation to big-theta notation; the former takes into account the constant factor of the fastest growing term, thus allowing us to compare different implementations that are all O(n^2) in theory.

⬐ asa400This looks great, but I'm not so keen on getting into Java at this point. Has anyone taken this, and if so would it be feasible for someone from a Ruby/Python background to grok what they're getting at?⬐ npalli⬐ dnauticsI took this last time (for the first few weeks). It is a very applied course. The autograder for the exercises is terrific, it will pinpoint the space time complexity of individual parts of your program so you can fine tune your data structures and algorithms. The whole setup is java based. IMHO, the course is far less valuable if you don't do the exercises. If you want theory oriented courses the Stanford ones (Tim Roughgarden) are more to your liking. The exercises for that course are in any language of your choice.⬐ asa400Excellent reply, exactly what I was looking for. Thanks very much!"If I have not programmed before, can I still take the course?""Probably not."

much appreciated (I can code, but I was hunting around for some coding courseras for a friend who has expressed interest in learning)

⬐ mayankk4I took this course the last time it was offered and 3 months later I was at Google :D Ofcourse there were other factors too.⬐ ghcI'm glad to see more classes like this come online. I think its a bit of a shame that the material (of the book) focuses so much on Java, however. The algorithms classes I took in college focused a lot on math, logic and proofs. It took me a long time to understand exactly why; I thought we'd be learning L1 cache hacks and register tricks in Assembly or C. But the technology used to implement the algorithms changes a lot faster than the algorithms themselves, and the details of the best optimizations are different for just about every language. I now think it's far more important to have a solid grounding in problem decomposition and theory than it is to understand the intricacies of efficient algorithm designs for a specific language.If you feel like I do, there are two books in particular that come to mind in that their content transcends the normal teaching curriculum and they both force you to think long and hard about how the authors came up with these fantastic little optimizations. I personally learned a lot from trying to reconstruct the thought process that must have led up to some of the algorithms implemented therein.

The first book is called

Pearls of Functional Algorithm Design, and while it focuses on implementation in Haskell, you don't need to be a functional programming expert to get a lot out of the book.The second book is called

Foundations of Multidimensional and Metric Data Structures, and while the name might scare some away, it has a lot of interesting algorithms and accompanying research paper references so you can go off and explore. It took me several years to make my way through it completely, but I have gained a much better understanding of algorithms (and data structures!) that deal with more complex topics (such as computer vision).There's one book I'd like to call out, as well.

Introduction to Algorithmscould be so much better than it is. It has all the right ingredients for a fantastic introduction to algorithms, but the way its written had most people in my algorithms class, myself included, bored beyond belief.Just my 2 cents.

⬐ plinkplonk"the material (of the book) focuses so much on Java,"This isn't really true. There is one section of the book (section 2 in Chapter 1 iirc) that details the

minimalisticsubset of java used, and there are a total of four interfaces used in the book (Comparable, Comparator, Iterable, Iterator) and each is explained very clearly. The code uses no inheritance, no fancy types, no design patterns. Input and Output are abstracted away by author provided classes with the minimal methods required to read in and write out strings, ints etc (vs struggling with BufferedOutputStreams or whatever in mainstream java).In other words, Java is used as a very minimalistic pseudocode. (e.g http://algs4.cs.princeton.edu/11model/Shuffle.java.html). It is almost python like.

A simple imperative language

isbest to learn the basics of algorithms in. You can't appreciate functional datastructures before you thoroughly understand imperative ones..Something like SML

mayhave been better, but the minimal 'loops + classes-as-structs-and-no-java-heavy-machinery' approach in the book works fine. There are certainly valid criticisms of the book to be made, but an 'excessive focus on Java' is not one of them imo (and I don't even like Java fwiw).PS: Thank You for your book reccommendations. The "Metric Data Structures" book looks really interesting. Ordered.

No lecture videos as of yet, but perhaps eventually. Princeton began a partnership with Coursera last year and the CS department has been relatively active, e.g., our algorithms course is now on the site [1], and I believe that they actually 'flipped' the course over the past semesters, i.e., students were expected to watch the lectures online and typical lecture hours were replaced with professors fielding questions / working through examples.

Try this link: https://www.coursera.org/course/algs4partI, if that doesn't work, just log in to coursera, then find Courses, then look for Sedgwick.

I believe companies are paying them for access to the best students of specific courses (for recruiting).For example, the Princeton Algorithms course says:

.. Coursera will maintain limited data regarding student progress and performance in this course and, with your permission, provide authorized third parties with access to such data.https://www.coursera.org/course/algs4partI

Given what recruiting fees are, I'd imagine this could work quite well. It is unclear how well it will scale, but if they can keep their costs low enough it may not need to.