KEMBAR78
Unit 1 - Problem Solving - 3 | PDF | Algorithms And Data Structures | Algorithms
0% found this document useful (0 votes)
11 views14 pages

Unit 1 - Problem Solving - 3

Unit 1 of the IGCSE Computer Science course focuses on problem-solving through understanding and creating algorithms, specifically sorting and searching algorithms. Key algorithms discussed include Bubble Sort and Merge Sort for sorting, and Linear Search and Binary Search for searching. The document highlights the efficiency differences between these algorithms, noting that Bubble Sort is slower for larger datasets compared to Merge Sort.

Uploaded by

sama2.3awad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views14 pages

Unit 1 - Problem Solving - 3

Unit 1 of the IGCSE Computer Science course focuses on problem-solving through understanding and creating algorithms, specifically sorting and searching algorithms. Key algorithms discussed include Bubble Sort and Merge Sort for sorting, and Linear Search and Binary Search for searching. The document highlights the efficiency differences between these algorithms, noting that Bubble Sort is slower for larger datasets compared to Merge Sort.

Uploaded by

sama2.3awad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 14

Unit 1 –

Problem
Solving
ENG. SAMAA AWAD

IGCSE
Computer
Science
Unit 1 Topics

1. Understanding algorithms

2. Creating algorithms

3. Sorting & searching algorithms

4. Decomposition & abstraction


Sorting & Searching
Algorithms
Sorting & Searching
Algorithms
• Two common tasks in computer programs are sorting data in a particular
order, and searching for a particular item.

• Some common sorting algorithms are:

• Bubble Sort

• Merge Sort

• Some common searching algorithms are:

• Linear Search

• Binary Search
Sorting Algorithms
Bubble Sort
• Data can be sorted in ascending order or in descending order.

• In bubble sort, pairs of data items are compared.

• If they are in the wrong order, they are swapped.

• The pairs comparison continues till the end of the list.

• This process is repeated until there are no swaps made.

• This means that all the items in the list are in the correct order.
Bubble Sort
• Here’s an example:

Note that each round is called a pass


Bubble Sort Note that when coding,
in order to swap items,
you will need to create
• Here’s the bubble sort
a temp variable to hold
algorithm as a flowchart:
one of the values that
need to be swapped.

e.g. if x & y need to


be swapped:

temp = x

x=y

y = temp
Merge Sort
• Data can be sorted in ascending order or in descending order.

• In merge sort, the list is divided into two smaller lists.

• The smaller lists are then divided into smaller lists, until each list has one
element.

• This is called recursion, which means repeatedly applying a process.

• The small lists are then merged through recursion, placing the items in the
correct order.
Merge Sort
Merge Sort
Efficiency of Sorting
Algorithms
Efficiency of Sorting
Algorithms
• The bubble sort uses brute force method. It starts at the beginning, and

repeats the same task over and over until it reaches a solution.

• The merge sort uses divide and conquer method. It breaks down the

problem into smaller sub-problems, solves those, and them combines the

solution.

• The previous graph shows that bubble sort is far slower at sorting lists of

more than 1000 items, but for smaller lists the time difference is small.
THANK
YOU

You might also like