Capítulo 2: Pseudocódigo y Diagramas de Flujo
2.4 Problemas de Práctica
Para comprender verdaderamente cómo escribir pseudocódigo y entender los diagramas de flujo, es esencial participar en ejercicios prácticos. Aquí tienes algunos problemas de práctica para ayudarte a solidificar tu comprensión:
Problema 1
Se te asigna diseñar un algoritmo que imprima todos los números del 1 al 100 que son divisibles por 7.
Solución en pseudocódigo:
Algorithm: Print Numbers Divisible by 7
Input: None
Output: Numbers from 1 to 100 that are divisible by 7
1. For each number N from 1 to 100, do
2. If N is divisible by 7 then
3. Print N
4. End If
5. End For
Problema 2
Diseña un algoritmo que verifique si una palabra dada es un palíndromo o no. Un palíndromo es una palabra que se lee igual hacia adelante que hacia atrás, por ejemplo, "level".
Solución en pseudocódigo:
Algorithm: Check Palindrome
Input: A word - Word
Output: Whether the word is a palindrome
1. Initialize Start to 0
2. Initialize End to the length of Word - 1
3. While Start is less than End, do
4. If the character at position Start in Word is not equal to the character at position End in Word then
5. Return "Not a palindrome"
6. End If
7. Increment Start by 1
8. Decrement End by 1
9. End While
10. Return "Palindrome"
Problema 3
Diseña un algoritmo que, dado un conjunto de números, encuentre el número más alto en el conjunto.
Solución en pseudocódigo:
Algorithm: Find Highest Number
Input: A list of numbers - Numbers
Output: The highest number in the list
1. Initialize Highest to the first number in Numbers
2. For each Number in Numbers, do
3. If Number is greater than Highest then
4. Set Highest to Number
5. End If
6. End For
7. Return Highest
También recomendamos intentar dibujar diagramas de flujo para estos algoritmos. Esta práctica solidificará tu comprensión de cómo se representan gráficamente los algoritmos y te hará sentir más cómodo con ambas formas de representación de algoritmos.
Recuerda, la práctica es la clave para aprender. Trabajando en estos problemas y creando los tuyos propios, mejorarás tu habilidad para traducir problemas del mundo real en algoritmos.
2.4 Problemas de Práctica
Para comprender verdaderamente cómo escribir pseudocódigo y entender los diagramas de flujo, es esencial participar en ejercicios prácticos. Aquí tienes algunos problemas de práctica para ayudarte a solidificar tu comprensión:
Problema 1
Se te asigna diseñar un algoritmo que imprima todos los números del 1 al 100 que son divisibles por 7.
Solución en pseudocódigo:
Algorithm: Print Numbers Divisible by 7
Input: None
Output: Numbers from 1 to 100 that are divisible by 7
1. For each number N from 1 to 100, do
2. If N is divisible by 7 then
3. Print N
4. End If
5. End For
Problema 2
Diseña un algoritmo que verifique si una palabra dada es un palíndromo o no. Un palíndromo es una palabra que se lee igual hacia adelante que hacia atrás, por ejemplo, "level".
Solución en pseudocódigo:
Algorithm: Check Palindrome
Input: A word - Word
Output: Whether the word is a palindrome
1. Initialize Start to 0
2. Initialize End to the length of Word - 1
3. While Start is less than End, do
4. If the character at position Start in Word is not equal to the character at position End in Word then
5. Return "Not a palindrome"
6. End If
7. Increment Start by 1
8. Decrement End by 1
9. End While
10. Return "Palindrome"
Problema 3
Diseña un algoritmo que, dado un conjunto de números, encuentre el número más alto en el conjunto.
Solución en pseudocódigo:
Algorithm: Find Highest Number
Input: A list of numbers - Numbers
Output: The highest number in the list
1. Initialize Highest to the first number in Numbers
2. For each Number in Numbers, do
3. If Number is greater than Highest then
4. Set Highest to Number
5. End If
6. End For
7. Return Highest
También recomendamos intentar dibujar diagramas de flujo para estos algoritmos. Esta práctica solidificará tu comprensión de cómo se representan gráficamente los algoritmos y te hará sentir más cómodo con ambas formas de representación de algoritmos.
Recuerda, la práctica es la clave para aprender. Trabajando en estos problemas y creando los tuyos propios, mejorarás tu habilidad para traducir problemas del mundo real en algoritmos.
2.4 Problemas de Práctica
Para comprender verdaderamente cómo escribir pseudocódigo y entender los diagramas de flujo, es esencial participar en ejercicios prácticos. Aquí tienes algunos problemas de práctica para ayudarte a solidificar tu comprensión:
Problema 1
Se te asigna diseñar un algoritmo que imprima todos los números del 1 al 100 que son divisibles por 7.
Solución en pseudocódigo:
Algorithm: Print Numbers Divisible by 7
Input: None
Output: Numbers from 1 to 100 that are divisible by 7
1. For each number N from 1 to 100, do
2. If N is divisible by 7 then
3. Print N
4. End If
5. End For
Problema 2
Diseña un algoritmo que verifique si una palabra dada es un palíndromo o no. Un palíndromo es una palabra que se lee igual hacia adelante que hacia atrás, por ejemplo, "level".
Solución en pseudocódigo:
Algorithm: Check Palindrome
Input: A word - Word
Output: Whether the word is a palindrome
1. Initialize Start to 0
2. Initialize End to the length of Word - 1
3. While Start is less than End, do
4. If the character at position Start in Word is not equal to the character at position End in Word then
5. Return "Not a palindrome"
6. End If
7. Increment Start by 1
8. Decrement End by 1
9. End While
10. Return "Palindrome"
Problema 3
Diseña un algoritmo que, dado un conjunto de números, encuentre el número más alto en el conjunto.
Solución en pseudocódigo:
Algorithm: Find Highest Number
Input: A list of numbers - Numbers
Output: The highest number in the list
1. Initialize Highest to the first number in Numbers
2. For each Number in Numbers, do
3. If Number is greater than Highest then
4. Set Highest to Number
5. End If
6. End For
7. Return Highest
También recomendamos intentar dibujar diagramas de flujo para estos algoritmos. Esta práctica solidificará tu comprensión de cómo se representan gráficamente los algoritmos y te hará sentir más cómodo con ambas formas de representación de algoritmos.
Recuerda, la práctica es la clave para aprender. Trabajando en estos problemas y creando los tuyos propios, mejorarás tu habilidad para traducir problemas del mundo real en algoritmos.
2.4 Problemas de Práctica
Para comprender verdaderamente cómo escribir pseudocódigo y entender los diagramas de flujo, es esencial participar en ejercicios prácticos. Aquí tienes algunos problemas de práctica para ayudarte a solidificar tu comprensión:
Problema 1
Se te asigna diseñar un algoritmo que imprima todos los números del 1 al 100 que son divisibles por 7.
Solución en pseudocódigo:
Algorithm: Print Numbers Divisible by 7
Input: None
Output: Numbers from 1 to 100 that are divisible by 7
1. For each number N from 1 to 100, do
2. If N is divisible by 7 then
3. Print N
4. End If
5. End For
Problema 2
Diseña un algoritmo que verifique si una palabra dada es un palíndromo o no. Un palíndromo es una palabra que se lee igual hacia adelante que hacia atrás, por ejemplo, "level".
Solución en pseudocódigo:
Algorithm: Check Palindrome
Input: A word - Word
Output: Whether the word is a palindrome
1. Initialize Start to 0
2. Initialize End to the length of Word - 1
3. While Start is less than End, do
4. If the character at position Start in Word is not equal to the character at position End in Word then
5. Return "Not a palindrome"
6. End If
7. Increment Start by 1
8. Decrement End by 1
9. End While
10. Return "Palindrome"
Problema 3
Diseña un algoritmo que, dado un conjunto de números, encuentre el número más alto en el conjunto.
Solución en pseudocódigo:
Algorithm: Find Highest Number
Input: A list of numbers - Numbers
Output: The highest number in the list
1. Initialize Highest to the first number in Numbers
2. For each Number in Numbers, do
3. If Number is greater than Highest then
4. Set Highest to Number
5. End If
6. End For
7. Return Highest
También recomendamos intentar dibujar diagramas de flujo para estos algoritmos. Esta práctica solidificará tu comprensión de cómo se representan gráficamente los algoritmos y te hará sentir más cómodo con ambas formas de representación de algoritmos.
Recuerda, la práctica es la clave para aprender. Trabajando en estos problemas y creando los tuyos propios, mejorarás tu habilidad para traducir problemas del mundo real en algoritmos.