Shortcut for chapter specific information

Showing posts with label stack. Show all posts
Showing posts with label stack. Show all posts

Saturday, October 22, 2011

How to use a stack to test a palindrome?

Come to think of it, it's actually very simple.  You just need to push the first half of the string into the stack and for the second half, if the element is the same as the top of the stack, you can pop it out from the stack.   If the stack is empty, this means you have a palindrome.   If there is any one element which you can't pop, then we are not looking at a palindrome. 

Thursday, April 28, 2011

Status at 20110428(b)

Just got out of my sorting routine a bit.  It turns out is not that difficult to solve some of the problems such as 10-1.6 and 10-1.7.   Of course, there are tons of this kind of trick question about elementary structure.

Finished the reading on median.  The algorithm is very smart!  In fact, I should spend more time on thinking using similar technique to solve problems.

Also started the basic data structure chapter.  This is also where all the classical data structures are presented in the style of CLRS pseudocode.  It certainly makes much more sense to me now.

Browse Read: 236/1144
Exercises up to Section 2.3-2
Exercises which are finished but not on paper: 2.3-7, 6.1-7, 6.2-3, 6.2-4, 10.1-6 and 10.1-7.