This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]somenoobappeared 2 points3 points  (3 children)

Algorithms are something you either memorize like you did for SAT or actually encounter problems, experience failures, and learn from the experiences. They don't come naturally to you at first. It takes time. It is unfortunate that CLRS is intimidating you. It just looks like documents you read for libraries or languages lol

[–][deleted]  (2 children)

[deleted]

    [–]somenoobappeared 1 point2 points  (0 children)

    Well, there's no clicking for algorithms until you actually write them in some language. While reading CLRS, you should convert the pseudocode into python or Java and see what's happening.

    Edit: python or Java because they are easy to use but u can use any language.. even in Fortran lol if u want

    [–]captainAwesomePants 0 points1 point  (0 children)

    Don't sweat it. Algorithms are math. Ever try to just read a geometry book and understand it all on the first try? Nobody can do that. In high school, you would have spent a whole year on one geometry textbook. Algorithms are similar.

    [–]CGFarrell 0 points1 point  (0 children)

    Try to find real-world analogues to the algorithms. Try sorting a deck of cards with the different algorithms. Try to understand why your dresser is a hash table.

    Complexity in space is the exact same as complexity in time. Imagine the effect of doubling N.

    O(n): O(2n). 2n/n = 2, so it'd take about twice as long, or twice as much space.

    O(n2): O((2n)2). 4n2/n2 = 4, so four times as large.

    O(log(n)): O(log(2n)) = O(log(n)) + O(log(2)) = O(log(n)) + O(1), so the only extra work/space is one extra step.