전체 글
-
[Introduction to Algorithms, CLRS] Exercise 1.1-5알고리즘 2017. 8. 15. 09:39
This is a solution for Introduction to Algorithms. I write this for my study purpose. 1.1-5 Come up with a real-world problem in which only the best solution will do. Then come up with one in which a solution that is “approximately” the best is good enough. Answer: Sorting a catalog is the problem, where only the best solution will do. An "approximately" sorted catalog won't be useful. Finding t..
-
[Introduction to Algorithms, CLRS] Exercise 1.1-4알고리즘 2017. 8. 14. 13:44
This is a solution for Introduction to Algorithms. I write this for my study purpose. 1.1-4 How are the shortest-path and traveling-salesman problems given above similar? How are they different? Similarity: They are similar in the sense that both traverses a graph and tries to find out the path with minimum sum of the weights. Difference: The TSP requires one to find the simple cycle covering ev..
-
[Introduction to Algorithms, CLRS] Exercise 1.1-3알고리즘 2017. 8. 14. 13:19
This is a solution for Introduction to Algorithms. I write this for my study purpose. 1.1-3 Select a data structure that you have seen previously, and discuss its strengths and limitations. Answer: I would like to introduce 2 data structures: singly linked list and array. Data structure Strengths Limitations Singly linked list - It does not need sequential space in memory. - We can insert a new ..
-
[Introduction to Algorithms, CLRS] Exercise 1.1-2알고리즘 2017. 8. 14. 12:40
This is a solution for Introduction to Algorithms. I write this for my study purpose. 1.1-2 Other than speed, what other measures of efficiency might one use in a real-world setting? - Memory (what if your application needs 2TB memory?) - Network Traffic - Database Access source: https://htrinity.wordpress.com/2015/07/10/clrs-chapter-1-solutions/ http://clrs.skanev.com/01/01/02.html
-
[Introduction to Algorithms, CLRS] Exercise 1.1-1알고리즘 2017. 8. 14. 12:14
This is a solution for Introduction to Algorithms. I write this for my study purpose. 1.1-1 Give a real-world example that requires sorting or a real-world example that re- quires computing a convex hull. Answer: 1) Sorting: - Contact list in my smart phone, alphabetically sorted. - Email list in Gmail app, sorted in time. 2) Convex Hull: (I think this is the most interesting answer that I found..
-
In PyCharm, how to load code from the editor to console카테고리 없음 2017. 7. 22. 20:05
While I was running the code form the Problem Solving with Algorithms and Data Structures, I've encountered some pages to encourage write class codes in code editor window but running it from Python console, for example in chapter 7.6. I did not know how I can load the class code from editor in console window. After searching from the web, I found this page. Loading Code from Editor into Console..
-
In Python, how to swap two numbers without using a temp variable카테고리 없음 2017. 6. 25. 09:02
This is a very interesting question: How to swap two number variables without using a temp variable? I have actually been asked this question while being interviewed for a job. Also this is a very well-known coding interview questions; therefore some books of interview preparation cover this question, for example, Cracking the Coding Interview. The answer is here. x = x + y; // x now becomes 15 ..
-
Review on PSAD 5.5카테고리 없음 2017. 6. 10. 18:08
While I was studying "Problem Solving with Algorithms and Data Structures using Python", I encountered two things that look very interesting. First of all, I became very interested in why Python allows a comma at the end of the list. I could find a interesting discussion on a stackoverflow page. To sum up, it is allowed to make it easier to edit multi-line lists.Second thing that I caught my att..