第 3 页
Introductions & About Me - Christine, 3rd year - Email: cazhou@berkeley.edu - Feel free to email me! - Always available to chat one-on-one - What is your name, year, major?
Introductions & About Me - Christine, 3rd year - Email: cazhou@berkeley.edu - Feel free to email me! - Always available to chat one-on-one - What is your name, year, major?
Announcements - Lab1 is due tonight at 11:59PM. - HW0 is due this Friday at 11:59PM. - Office hours and discussion/lab calendars on the course website. - Discussion survey: shoutkey.com/leak
Git - VCS (version-control system), can save your work and go back to previous versions very easily - You have a central repository living somewhere stored by git - You can use ‘git clone’ to get a copy of this central repository anywhere you want (ie. on your local computer and instructional account) - When you ‘git add X.java’, ‘git commit -m “...”’, and ‘git push’, you are sending your work to the central repository - Not to other copies of the repository!
Some Git Commands to Know - Camera analogy - git add: take a snapshot of your files (this is called staging your changes) - git commit: save the snapshot that you took with a message - git push: pushes snapshots from your repo to the central repo - git pull: pulls snapshots from the central repo to your repo - git status: shows the status of your repo - git log: shows all the snapshots/corresponding messages you’ve made on your repo - git tag: mark a specific snapshot with a tag
1. Javaian Rhapsody - Variable assignments, to different types (String, int, Singer) - String and int are provided in Java, Singer is a self-defined class!
1. Javaian Rhapsody (continued) - While loops will continue as long as the condition is true - Condition in this case is x>0 - Possible to loop infinitely if the condition is always true - Maybe we forget to decrement x?
1. Javaian Rhapsody (continued) - Create arrays in Java with the bracket notation, can access with indexing - For loops: for (instantiation; condition; incrementation) - Will do what is within the brackets until the condition is false - System.out.print or System.out.println: how we print in Java!
2. Fibonacci - Remember: fib(N) = fib(N-1) + fib(N-2) - The 0-th fibonacci number is 0, the 1st is 1, etc.
2. Fibonacci (continued) - Too many redundant calculations when done recursively… - What other way can we approach this?
2. Fibonacci (continued) - Look at how we did the problem iteratively - Do the arguments of fib3 sound familiar to what we did in fib2?
3. Mystery - Keep track of the variables when running through the example! - To determine what it’s doing, try to figure out what each of the variables stand for!
3. Mystery (continued) - Keep track of variables when running through an example? - What does targetIndex represent? (What does mystery do?)
显示前 14 页。下载资料查看完整内容。
暂无评论。快来抢沙发吧!
评论 (0)
暂无评论。快来抢沙发吧!