13-BruteForce

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

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

B.B. Karki, LSU 0.1 CSC 3102 Algorithm Design Techniques

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

View Full Document
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
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

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

View Full Document
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
B.B. Karki, LSU 0.5 CSC 3102 Brute Force

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

View Full Document
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.
B.B. Karki, LSU 0.7 CSC 3102 Selection Sort Algorithm SelectionSort ( A[0. .n-1] ) //Sorts a given array //Input: An array .n-1] of orderable elements //Output: Array 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-

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/06/2009 for the course CSC 3102 taught by Professor Kraft,d during the Fall '08 term at LSU.

Page1 / 15

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

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online