puzzles
文件大小: unknow
源码售价: 5 个金币 积分规则     积分充值
资源说明:puzzles I've come across
1. maxsum_subarray.py
   Finds the sub-array with the maximum sum (> 0) within a given array in O(n).

2. sequence.c
   A C implementation of the look-and-say sequence
   ref: http://en.wikipedia.org/wiki/Look-and-say_sequence

3. pretty_print.py
   Finds words in a string that are present in a given word list. Chars in
   string that don't contribute to any word are replaced by '-'.
   Note: This is a greedy implementation that I'm not proud of.
         Suggestions for improvement are welcome.

4. matrix_search.py
   Search for element in matrix in O(m+n), where m: #rows and n: #cols

5. merge_sort.py
   Classic merge sort in O(n)

6. zero_pair.py
   A Python program to find pairs of integers in a list that add up to zero
   in O(n). I also wrote some unit tests and a function that verifies the
   result by comparing it with a brute force algorithm.

7. reverse_words_in_setence.py
   If you were expecting for a long-winded solution here, you'll find a reason
   to love Python. A simple 1-line function works to reverse the words in a
   sentence. What it gains in simplicity, it loses in efficiency. But let's
   dwell in the magic of Python for a bit, shall we? =)


本源码包内暂不包含可直接显示的源代码文件,请下载源码包。