{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

13-BruteForce

13-BruteForce - Algorithm Design Techniques CSC 3102 0.1...

Info icon This preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
B.B. Karki, LSU 0.1 CSC 3102 Algorithm Design Techniques
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
B.B. Karki, LSU 0.2 CSC 3102 Algorithm Basics (Chapters: 1 and 2) Notion of algorithm: Section 1.1 Fundamentals of algorithmic problem solving: Section 1.2 Important problem types: Section 1.3 Analysis of algorithmic efficiency: Sections 2.1 and 2.2 Non-recursive algorithms: Section 2.3 Recursive algorithms: Section 2.4
Image of page 2
B.B. Karki, LSU 0.3 CSC 3102 Fundamental Data Structures ( Chapter 1 - sec 4, and other parts of the textbook) (Reference books in C and Java) Linear Lists: Linked lists, Queues, Stacks Section 1.4 Trees: Binary search tree, AVL tree, 2-3 tree, B-tree Sections 1.4, 4.4, 6.3 and 7.4 Graphs: Graph traversals, Topological sorting Sections 1.4, 5.2 and 5.3
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
B.B. Karki, LSU 0.4 CSC 3102 Algorithm Design Techniques Various design techniques exist: Classifying algorithms based on design ideas or commonality. General-problem solving strategies. Brute force Divide-and-conquer Decrease-and-conquer Transform-and-conquer Space-and-time tradeoffs Dynamic programming Greedy techniques
Image of page 4
B.B. Karki, LSU 0.5 CSC 3102 Brute Force
Image of page 5

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
B.B. Karki, LSU 0.6 CSC 3102 The Simplest Approach Brute force - the simplest of the design strategies Is a straightforward approach to solving a problem, usually directly based on the problem’s statement and definitions of the concepts involved. Just do it - the brute-force strategy is easiest to apply. Results in an algorithm that can be improved with a modest amount of time. Brute force is important due to its wide applicability and simplicity. Weakness is subpar efficiency of most brute-force algorithms. Important examples: Selection sort, String matching, Convex-hull problem, and Exhaustive search.
Image of page 6
B.B. Karki, LSU 0.7 CSC 3102 Selection Sort Algorithm SelectionSort ( A [0.. n- 1] ) //Sorts a given array //Input: An array A [0 ..n- 1] of orderable elements //Output: Array A [0 ..n- 1] sorted in ascending order for i 0 to n - 2 do min i for j i + 1 to n - 1 do if A [ j ] < A [ min ] min j swap A [ i ] and A [ min ] C ( n ) = 1 j = i + 1 n 1 = [( n 1) ( i + 1) + 1] = ( n 1 i ) i = 0 n 2 i = 0 n 2 i = 0 n 2 = ( n 1) n 2 ∈ Θ ( n 2 ) Scan the list repeatedly to find the elements, one at a time, in an non- decreasing order.
Image of page 7

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern