9.3: Problems
- Page ID
- 76138
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)
- Comment on the following: “If a program produces a correct result, it is obviously correct”. What does it mean to have a correct program?
- Present you understanding of the term erroneous. Do you think it should be applied to programs?
- Implement a multiply function using only addition and recursion.
- Implement a program to reverse the digits in an integer number. For example, for the number 5271, change the integer value to 1725.
- Implement a recursive program that takes in a number and finds the square of that number through addition. For example if the number \(3\) is entered, you would add \(3+3+3=9\). If \(4\) is entered you would add \(4+4+4+4=16\). This program must be implemented using recursion to add the numbers together.
- Write a recursive program to calculate Fibonacci numbers. Use the definition of a Fibonacci number where \(F(n) = F(n-1) + F(n-2), F(0) = F(1) = 0\).
- Write a recursive program to calculate factorial numbers. Use the definition of factorial as \(F(n) = n * F(n-1)\).
- Combinations, Permutations
In this chapter you will learn (Chapter 10):
- The definition of an array, and how to implement and access array elements using index.
- What is heap memory, how to allocate it, and how to use it.
- Null terminated arrays, and array processing using element pointers
- How to allocate an array in stack memory, on the program stack, or in heap memory, and why arrays are most commonly allocated on heap memory.
- How to use array addresses to access and print elements in an array.
- Call by Value, Call by Reference, and Call by Reference Value (or Reference Type)
- An algorithm to reverse an array, and how to it in ARM assembly.