100% de satisfacción garantizada Inmediatamente disponible después del pago Tanto en línea como en PDF No estas atado a nada 4.2 TrustPilot
logo-home
Caso

Computational Thinking Assignment 4

Puntuación
-
Vendido
-
Páginas
7
Grado
9-10
Subido en
14-06-2022
Escrito en
2019/2020

Computational Thinking Assignment 4

Institución
Grado









Ups! No podemos cargar tu documento ahora. Inténtalo de nuevo o contacta con soporte.

Escuela, estudio y materia

Institución
Estudio
Grado

Información del documento

Subido en
14 de junio de 2022
Número de páginas
7
Escrito en
2019/2020
Tipo
Caso
Profesor(es)
Bhulai
Grado
9-10

Temas

Vista previa del contenido

Computational Thinking – Assignment 4 (Artificial Intelligence Year 1)


1. How to use merge sort?

Keys E X A M P L E
Index 0 1 2 3 4 5 6


The “Tree” below shows the merge sort for the list { E X A M P L E }. We can see that this list
is recursively divided into two halves, until the size of a particular part of the list is 1. Once this
happened for every single letter in this list, the merge sort will start. This algorithm starts
merging elements back, until the whole list is merged, in this case in alphabetic order. The last
step is merging the last two sorted halves.




2. Sort by Python

A. We need to sort the coordinates in ascending order by comparing the first part of the
coordinates. The coordinates are (f, 9), (z, 2), (t, 4), (x, 8), (b, 1), (m, 7).

Input =

, Computational Thinking – Assignment 4 (Artificial Intelligence Year 1)


Output =




As you can see, the first part of the coordinates, the letters, are now in ascending (=
alphabetic) order.

B. We need to sort the coordinates in ascending order by comparing the second part of the
coordinates. The coordinates are (f, 9), (z, 2), (t, 4), (x, 8), (b, 1), (m, 7).

Input =




Output =




As you can see, the second part of the coordinates, the numbers, are now in ascending order.

3. Sort and search

I.
Keys T F W C Q G P R O
Index 0 1 2 3 4 5 6 7 8
Unsorted list

A. First, we have to select one element from the list (this can be any element): the pivot. Let’s say we
select P from the list. Now we rearrange this list in such a way that all the elements lesser than or
equal to the P are towards the left of this pivot and all the elements greater than or greater than or
equal to the P are towards the right of this pivot. The list will look like this:

II. Keys F C G O P T W Q R
Index 0 1 2 3 4 5 6 7 8
Partitioned list

We call this whole process the “partitioning” of the list. The pivot is now in its final position in the sorted
array. Once we have partitioned the array like this (II. Partitioned list) all the elements smaller than the
pivot are to the left and all the elements greater than the pivot are to the right. We can break this
problem into two sub-problems: subproblem 1 and subproblem 2.
$6.66
Accede al documento completo:

100% de satisfacción garantizada
Inmediatamente disponible después del pago
Tanto en línea como en PDF
No estas atado a nada

Conoce al vendedor
Seller avatar
TR19

Conoce al vendedor

Seller avatar
TR19 Vrije Universiteit Amsterdam
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
0
Miembro desde
9 año
Número de seguidores
0
Documentos
7
Última venta
-

0.0

0 reseñas

5
0
4
0
3
0
2
0
1
0

Recientemente visto por ti

Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes