Data structures & Algorithm Analysis…………………………NextSlide……………………………………………………….
Data structures & Algorithm Analysis…………………………NextSlide……………………………………………………….
---- finish the first traversal ----
---- start again ----
---- finish the second traversal ----
---- start again ----
………………….
Data structures & Algorithm Analysis…………………………NextSlide……………………………………………………….
void bubbleSort (Array S, length n) {
boolean isSorted = false;
while(!isSorted) {
isSorted = true;
for(i = 0; i<n; i++) {
if(S[i] > S[i+1]) {
int aux = S[i];
S[i] = S[i+1]; S[i+1] = aux; isSorted = false;
}
}
}
Data structures & Algorithm Analysis…………………………NextSlide……………………………………………………….
(n – 1) + (n – 2) + … + 1 = (n – 1) n / 2 = O(n 2)
Data structures & Algorithm Analysis…………………………NextSlide……………………………………………………….
Data structures & Algorithm Analysis…………………………NextSlide……………………………………………………….
Data structures & Algorithm Analysis…………………………NextSlide……………………………………………………….
Data structures & Algorithm Analysis…………………………NextSlide……………………………………………………….
Data structures & Algorithm Analysis…………………………NextSlide……………………………………………………….
Data structures & Algorithm Analysis…………………………NextSlide……………………………………………………….
Data structures & Algorithm Analysis…………………………NextSlide……………………………………………………….
Data structures & Algorithm Analysis…………………………NextSlide……………………………………………………….
Data structures & Algorithm Analysis…………………………NextSlide……………………………………………………….
Data structures & Algorithm Analysis…………………………NextSlide……………………………………………………….
Data structures & Algorithm Analysis…………………………NextSlide……………………………………………………….
Divide and Conquer is a method of algorithm design that has created such efficient algorithms as Merge Sort.
Data structures & Algorithm Analysis…………………………NextSlide……………………………………………………….
Data structures & Algorithm Analysis…………………………NextSlide……………………………………………………….
Data structures & Algorithm Analysis…………………………NextSlide……………………………………………………….
Data structures & Algorithm Analysis…………………………NextSlide……………………………………………………….
Data structures & Algorithm Analysis…………………………NextSlide……………………………………………………….
Data structures & Algorithm Analysis…………………………NextSlide……………………………………………………….
1) Divide : If the sequence S has 2 or more elements, select an element x from S to be your pivot. Any arbitrary element, like the last, will do. Remove all the elements of S and divide them into 3 sequences:
L, holds S’s elements less than x
E, holds S’s elements equal to x
G, holds S’s elements greater than x
2) Recurse: Recursively sort L and G
3) Conquer: Finally, to put elements back into S in order, first inserts the elements of L, then those of E, and those of G.
Here are some diagrams....
Data structures & Algorithm Analysis…………………………NextSlide……………………………………………………….
Data structures & Algorithm Analysis…………………………NextSlide……………………………………………………….
Data structures & Algorithm Analysis…………………………NextSlide……………………………………………………….
Data structures & Algorithm Analysis…………………………NextSlide……………………………………………………….
Data structures & Algorithm Analysis…………………………NextSlide……………………………………………………….
1. What is the importance of data structures and algorithm analysis in computer science engineering? | ![]() |
2. Can you explain the difference between data structures and algorithms? | ![]() |
3. How do data structures and algorithm analysis impact software development? | ![]() |
4. What are some commonly used data structures in computer science engineering? | ![]() |
5. How can algorithm analysis be performed in computer science engineering? | ![]() |