Questions tagged [induction]

Anything related to mathematical induction principle and techniques applied to computing. Please DO NOT USE this tag for math-only questions since they are off-topic on SO. This tag may be used for math-related questions only if it involves some programming activity or software tools (e.g. automatic theorem proving, etc.).

Anything related to mathematical induction principle and techniques applied to computing. Please DO NOT USE this tag for math-only questions since they are off-topic on SO. This tag may be used for math-related questions only if it involves some programming activity or software tools (e.g. automatic theorem proving, etc.).

262 questions
-1
votes
1 answer

Strong induction?

The question is "Show using strong induction, that any sum of 2 or more even integers is even". Now, I'm fine with regular induction, but I'm lost in the notation of strong induction. So far, I have: BASE: (we will use 2 as our even number) n=2 by…
user3472798
  • 103
  • 1
-1
votes
1 answer

Mathematical induction proofs

For my theory of computation class, we are supposed to do some review/practice problems to work off the rust and make sure we are ready for the course. Some of the problems are induction proofs. I did this at one time, but apparently it has…
Bryan
  • 2,951
  • 11
  • 59
  • 101
-2
votes
1 answer

Structural induction on binary trees

Consider the following function definitions : data Tree a = Leaf a | Node a (Tree a) (Tree a) sumLeaves :: Tree a -> Integer sumLeaves (Leaf x) = 1 sumLeaves (Node _ lt rt) = sumLeaves lt + sumLeaves rt sumNodes :: Tree a -> Integer sumNodes…
-2
votes
2 answers

How to set up an inductive proof in haskell?

I need to prove f (g xs) == g (f xs) whenver xs is a finite list of Ints. Assume both f and g are of type [Int]->[Int]
user3358850
  • 129
  • 9
-2
votes
1 answer

Find number of occurrences of digits from 1 to N without using loop

For example, n=11 means, then the map should have 0-1, 1-4, 2-1, 3-1, 4-1, 5-1, 6-1, 7-1, 8-1, 9-1 public void countDigits(int n, Map map) { while (n != 0) { int d = n%10; n /= 10; …
-2
votes
1 answer

An algorithm to determine a subset sequence in O(n)?

How can i aproach this problem by induction? Suppose that you are given an algorithm as a black box you cannot see how it is designed it has the following properties: if you input any sequence of real numbers and an integer k, the algorithm will…
john nash
  • 1
  • 1
-4
votes
1 answer

Which of following two C programs (iterative and inductive) is more efficient for finding the nth Fibonacci number?

As stated above attempting to work out which of the following two programs is most efficient for finding the nth Fibonacci number and why. The Fibonacci numbers are numbers in the sequence: 1, 1, 2, 3, 5, 8... where each number after the first two…
altituda
  • 1
  • 1
1 2 3
17
18