Unformatted text preview: • f.readline reads one line of the file • if you do f.readline it reads first line and if u do f.read after it just reads rest of lines. • f.readlines reads every line and returns it as a list. • enter is represented by \n • Open and close files Lists, aliasing vs. cloning • b=a points b to the same copy of the data in a • b=a[:] clones the file. Creates a new copy for b that is the same as a. Two-dimensional arrays (list within a list) • indexing • splicing Sorts: merge, bubble, selection, quick, insertion • know how a sort will operate on a list Searches: binary and sequential big O – measures the amount of work a function does in relation to the number of elements (n) there are in a list • bubble – O(n 2 ) • insertion – O(n 2 ) • merge – O(n log n) • selection – O(n 2 ) • quick – O(nlogn) • binary – O(logn) • sequential – O(n)...
View Full Document
- Fall '08
- ASCII, Unicode, white spaces, upper makes letter