Changes

Jump to: navigation, search

ParaCode

356 bytes added, 10:30, 6 April 2018
Assignment 2
We are going to work on 'Grep' project.<br>
Through the profile, we can see that the most cost of the runtime is 'grep()' and 'convert_char_to_string()' functions. <br>
Let's go and see the basic variables in code:<br>
[[File:BasicVar.JPG|650px]]
First, I look at function 'convert_char_to_string()'. I think it's no necessary to use this function, so I remove it.<br>
[[File:StringremoveJPG.JPG|650px]]
 Then, we start working in grep function. As file size growing up, which means more characters in file, the runtime of 'grep()' grows much more faster than the other functions. So we are going to work on 'grep()' function.<br>
Let's going through grep() function:<br>
[[File:Screen Shot 2018-04-03 at 10.42.41 PM.png|650px]]
We can see, there're two for loop in grep() function. In loop is inside another. Which mean it's kind of O(n^m) runtime function. That's why it cost a lot of time to run.<br> The idea of grep is very simple. The inside loop make a temporary string from input string with the length of keyword length. Then it compare the temp string to keyword. If they equal, means this temp string is the same as keyword string. It increases the counter by 1. [[File:GrepIdea.JPG|650px]]
=== Assignment 3 ===
167
edits

Navigation menu