# Lec 1 | MIT 6.046J / 18.410J Introduction to Algorithms (SMA 5503), Fall 2005

31 October, 2010
25 Comments

Comments

@hassamu Yes i’ve mistaken. Hieght of tree will be zero. But total levels of tree should be log(n)+1 because at n=1 there exist atlest one level.

@ThePakistaniMuslim

If there’s only one element in the array to be sorted, then it returns n because the element is already sorted. Besides that, the height of a node (in this situation the root) it’s the longest downward path to a leaf from that node, therefore if you have a tree with only one node, which is the root and at the same time it is a leaf, then the height of the tree is 0, which is log(1).

eric = hippy

I’m not pretty much into maths and informatics but this was quite understandable and interesting. thank you.

The teacher calculated the height of tree as log(n) but if there is only one element in array to be sorted that is n=1 then log(n) =log(1)=0 which means that the height of tree is zero which is not true as n=1 so it should be log(n)+1 for calculating height of tree.

I like this theacher a lot so much fun to his lesson!I am not in MIT so one the students there please confirm. The metaphor of Performance ~ Money so to have other features was brilliant!

He is one of the authors of the book that suggested.A classic one

awsumm i want for admission in MIT. . .

[email protected] ~36:00

“Lets take a look at running time”

*looks at watch*

@cchampio … it’s clear you maybe don’t know what the term recursive means but, iterative algorithms can be written as recursive algorithms… All you do is change the iterator into recursive branching that has a growth related to the count of iterations. The growth is polynomial (for this case) but, the problem can be written in more than one way.

@bone009

have mercy on U

@AMDNiels? Yeah, the answer to T(n) = T(n-1) + 1 is c+n-1 or n, and secondly, while you can look at a loop as recursive (just as a Sum is recursive), it’s easier not to do so. If you wanted to do it that way, you’d have to account for the second inner loop as well. However, this would be much more complicated, so recursive is only used when a function is calling itself, not a loop iteration.

wish I found these before I finished my masters or during my bachelors.

Damn!, should’ve went to MIT when I had the chance!, Freaking Harvard, worst choice ever!!, Fuckking professors self-study excuses…

@cchampio I’m talking about the relation of how many times it has to

call up a value, thats 0 times for 0 items, its 0 times for 1 item, its 1 time

for 2 items, its 1 + 2 times for 3 items, its 1+2+3 times for 4 items, etc..

Seems like recurrence to me.

@AMDNiels your recurence is wrong too. it’s theta(n). I tried to post the solution but youtube keeps giving me error and won’t let me post it. something it dont’ like about the text.

@AMDNiels Insertion sort is not recursive, so it has no recurence relation.

its very help full and worth while…

@miketwo345 Lester C. Thorow, Dean, Sloan School of Mgmt., MIT — is a member of the Trilateral Commission and knows 33rd degree secret is the 1899 Alaska Earthquake – British Association record No. 333, at Shide. Isle of Wight on September 3 at three o’ three.

In Sweden itÂ´s free to studie .. no I was wrong .. you get like 2800 monthly.. to just studie… sooo.. hahaha love and hate this country. That teatcher is nerves like a mother fu*ker.

This was awesome. I study Computer Science in Italy and this was very helpful, I really appreciate you putting this on the web, this embodies the idea of free culture that I hope everyone will one day agree about.

@samgee2007

Singapore = third world country, I guess not, ever heard of the HDI of Singapore?

Can someone tell me if this is correct:

Another solution for the worst case analysis of insertion sort: Recursive equation for T(n) = T(n-1) + 1. This gives the closed form of n * (n+1)/2 + 1, so this means 1/2*n^2 + 1/2*n +1, so in Theta notation: Theta(n^2).

i’d like to know the rationale why in asymptotic notation we can drop the lower terms (that’s harsh!) and ignore leading constants (rude!)

otherwise i claim this lecture is bogus….i mean… this guy calling the student who gets the best grade in his lecture cheating!

a third world country Singapore (a tiny island) is teaching America about maths?

It is very nice that MIT runs the OpenCourseWare Programm

Other Universities should look forward to copy that type of enabling free education for everyone ! I’m definitely supporting this..