Lecture Notes and homework for the third week of class 1111-1114 of the family planning subject (deadline:, January 1, March 27, 2014-the evening of Thursday, students notified by the Apsara stack Committee)

Source: Internet
Author: User

In week 3, we mainly discussed hash algorithms and divide and conquer methods. Divide and conquer is a general algorithm framework. Many algorithms we come into contact with in our daily life can be classified into divide and conquer algorithms.

Key points of this week

1. Hash Algorithm and Its Application-MD5. You should understand the three main functions of the hash algorithm: Data Integrity Verification, data confidentiality, and quick search. When you encounter problems, you can use the hash algorithm to solve them.

2. Steps and key points of the divide and conquer law-major problems are divided into small problems, small problems are solved, and small problems are merged to obtain the solution of the original problems, namely, divide, conquer, and merge. It can also use the merge algorithm, big integer multiplication, and big matrix multiplication to understand the main points of the divide and conquer method.

3. Compile the program for the following three problems: Binary Search, Merge Sorting, and quick sorting.

Job Requirements

1. Ask the students from the school committees to complete their homework.

2. Homework is counted into the average score. The score is based on the degree of completion-attitude (done/not done ). Teachers will select a number of students to make comments based on the quality of their assignments and provide the basis for personalized teaching. Please provide as high a level of homework as possible based on your own capabilities, and do your best to improve your own capabilities. 3. The instructor will check the assignment Students whose student ID is in the last 5Please tell each other. Starting from week 4, the "peer assignment peer evaluation" mechanism will be introduced. Please be prepared. That is, each student reads the assignments of the other five students in this class and provides and summarizes the comments to achieve mutual learning. Please complete at least one of the assignments and encourage them to complete two. Send the program source code and running result to the CSDN blog. 1. sort. Program and Implement Bubble Sorting (method name: bubbleSort) and parallel sorting (mergesort(() for the data in the file largecmdtxt (download link), and save the final result of the sequence to largew_bubble.txt and largeW_merge.txt, output the running time of the two sorting results to the screen (submit the running time as the running result when sending a blog ). Blog title: Assignments for week 3-Bubble sorting and Merge Sorting2. Search. In his book Writing Correct Programs, Bentley wrote that 90% of computer experts cannot write completely Correct binary search algorithms within two hours. Binary Search Method prototype: int BSearch (int array [], int low, int high, int target), array -- an array containing several integers, low and high -- start and end subscript of the search, and target -- elements to be searched. Sequential search: int SSearch (int array [], int low, int high, int target), where S -- Sequence (Sequence) downloads (download link ). Output The largew_bubble.txt data on the console. Blog title: Assignments for week 3-sequential search and Binary Search
The test data is from the algorithm website. Thank you. 1. How to spend two years interviewing a person has some reference value for positioning yourself. 2. How can I spend two months applying for an Internet company and looking for a job? Now, I want to prepare for what I can do. 3. What are the job requirements for search for "algorithms" and "algorithm engineers" on the carefree Web site? Command line parameters, Text File Read and Write sample code (Java)
Import java. io. file; import java. io. fileNotFoundException; import java. io. printWriter; import java. util. optional; public class ReadData {public static void main (String [] args) throws FileNotFoundException {// read two input parameters from the command line, which are the text files to be processed, and the text file if (args. length <2) {System. out. println ("no input data! "); System. out. println ("program usage (example): ReadData tinyW.txt tinyW_bubble.txt"); return ;}// read from the text file and process the data (× 2 ), string fileInput = args [0]; optional SC = new partition (new File (fileInput); String fileOutput = args [1]; printWriter pw = new PrintWriter (new File (fileOutput); int data = 0; int num = 0; while (SC. hasNextInt () {data = SC. nextInt (); num = num + 1; // System. out. println (data); pw. printf ("% d: % d \ n ", Num, 2 * data);} pw. close (); SC. close (); System. out. println ("the end of the operation, a total of" + num + "data. ");}}




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.