0% found this document useful (0 votes)
4 views8 pages

Esdap Unit 2 Activity 2

This document provides an overview of sorting and searching methods in Python, specifically focusing on two methods for each category. It discusses the built-in list.sort() and sorted() functions for sorting, as well as linear and binary search algorithms for searching within lists. The conclusion emphasizes the simplicity of understanding these methods and their importance in programming.

Uploaded by

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

Esdap Unit 2 Activity 2

This document provides an overview of sorting and searching methods in Python, specifically focusing on two methods for each category. It discusses the built-in list.sort() and sorted() functions for sorting, as well as linear and binary search algorithms for searching within lists. The conclusion emphasizes the simplicity of understanding these methods and their importance in programming.

Uploaded by

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

U2A2:

“Application of the sort and search methods”

TECNICO SUPERIOR UNIVERSITARIO EN


TECNOLOGÍAS DE LA INFORMACIÓN
ÁREA DESARROLLO DE SOFTWARE Y
MULTIPLATAFORMA

PRESENTA:

ANGEL GUSTAVO ORTEGA GARCIA

CD. REYNOSA, TAMAULIPAS JANUARY 2025.


Table of Content.
TOPIC PAGE

Table of Content. ................................................................................... I


Table of Figure ...................................................................................... II

Introduction ........................................................................................... 1

Sorting methods.................................................................................... 2

Search methods..................................................................................... 3
Linear Search ............................................................................................. 3

Binary Search ............................................................................................ 4

Conclusion ............................................................................................... 5

I
Table of Figure

FIGURE PAGE
Figure 1 Sorted ............................................................................................. 2
Figure 2 list.sort ............................................................................................ 2
Figure 3 Linear Search ................................................................................... 3
Figure 4 Binary search. .................................................................................. 4

II
Introduction

This document covers the sorting method and the methods of searching arrays.in
lists in python by knowing two methods of each.

1
Sorting methods

Python lists have a built-in list.sort()method that modifies the list in place. There
is also a built-in sorted()function that creates a new sorted list from an iterable.

A simple ascending sort is very easy: just call the sorted()function. It returns a
new sorted list.

Figure 1 Sorted

You can also use the list.sort method. It sorts the list in place (and returns Noneto
avoid confusion). This is generally less convenient than sorted(), but if you don't
need the original list, it's a bit more efficient.

Figure 2 list.sort

Another difference is that the list.sort method is only defined for lists, while the
sorted()function accepts any iterable.

2
Search methods

Are fundamental techniques used to find an element or value within a collection


of data.

Linear Search

Linear search is the simplest searching algorithm. It sequentially checks each


element of the list until it finds the target value.

Figure 3 Linear Search

3
Binary Search

Binary search is a more efficient searching algorithm suitable for sorted lists. It
repeatedly divides the search interval in half until the target value is found.

Figure 4 Binary search.

4
Conclusion

In conclusion we saw an easy way to learn or understand what are sorting and
searching methods, as well as giving two methods of each and improve the
knowledge that has been obtained.

You might also like