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
0
votes
2 answers

Trouble connecting to Postgresql database in Vagrant guest box with Induction from host machine?

I'm trying to connect to my PostgreSQL database which is inside of a guest machine (using Vagrant and VirtualBox). I'm trying to connect to it with Induction, but I am getting an error saying: Connection Error Could not connect to server:…
Hung Luu
  • 1,113
  • 19
  • 35
0
votes
1 answer

Is it possible to view a remote database in heroku on my computer (using Induction)?

In my rails 4 application directory, I typed "heroku pg:credentials DATABASE" into terminal to get all the information about the database for my application which is deployed on heroku. Since I'd like to view the data inside my postgresql database,…
sw2500
  • 53
  • 2
  • 6
0
votes
1 answer

Compilers Exam Explanation

I am preparing for a Compilers exam and I found the following two questions in past papers that I don't know how to answer: 1. Array bounds checking requires code to check each array subscript to ensure it falls within the array's declared range.…
Sorin Cioban
  • 2,237
  • 6
  • 30
  • 36
0
votes
3 answers

How can I prove by induction that the second of these two algorithms is faster?

I have two algorithms. A. Solves problem in 2^n seconds. B. Solves problem in n^2 + 1,000,000 seconds. How can I inductively prove that B is faster than A. I'm told that 2^n > 2n+1 for n>2 might be useful for this problem. I've been cracking my…
amorimluc
  • 1,661
  • 5
  • 22
  • 32
0
votes
1 answer

Prove binary tree properties using induction

I am having trouble proving binary tree properties using induction: Property 1 - A tree with N internal nodes has a maximum height of N+1 base case - 0 internal nodes has a height of 0 assume - a tree with k internal nodes has a maximum…
Zach Caudle
  • 145
  • 2
  • 13
-1
votes
1 answer

What algorithm can I use to compute 2022^n (given n \in N)? How can I prove the correctness (maybe induction?) and what's the upper bound used?

I have to use n-1 multiplications but I am confused about proving the correctness of the algorithm and finding the upper bound. How do I do/show that?? I know 2022 = 20*(100+1)+2 2022 = 2000+20+2 ...... 2022 = 2000+2+2+..+2 etc.
-1
votes
1 answer

How to get more complex theory in Aleph with SWI-Prolog?

I tired to use Aleph to get a theory, but my out only one head with one body, actually I want more bodies. My input file is: :- use_module(library(aleph)). :- if(current_predicate(use_rendering/1)). :- use_rendering(prolog). :- endif. :- aleph. :-…
Vic
  • 27
  • 1
  • 4
-1
votes
2 answers

Prove something is less or equal to other thing using induction in COQ

I need to prove that the height of a formula's tree is always less than the number of nodes of the same tree, but I got stuck after the assumption and don't know how to proceed. Can somebody help me fill the "admit." spaces? Require Import…
Rafael Santos
  • 39
  • 1
  • 6
-1
votes
1 answer

Binary Tree Induction Example

I have been given this induction problem as practice, and I haven't worked with induction in a few months so I'm lost on how to approach the problem. Here's the example: "Prove by induction: In a non-empty binary tree, the number of nodes is equal…
Evan
  • 33
  • 1
  • 4
-1
votes
1 answer

Proof by induction of a recursive pseudo code | skiena algorithm book

In the book Algorithm design manual (page 16), proof by induction for correctness of below increment algorithm is discussed. Increment(y) if (y == 0) return 1; else if (y % 2 == 1) return 2 * Increment(floor(y/2)); else return y +…
jitendra
  • 195
  • 1
  • 2
  • 10
-1
votes
1 answer

Structural induction in haskell. Lists and sum

Hi I'm quite new to haskell and just got into structural induction and was wondering if someone could explain the steps I should take it would be very helpful. Question: -- computes the sum of all numbers in the list sum :: [Integer] -> Integer sum…
Huskey
  • 15
  • 3
-1
votes
1 answer

When does the hypothesis space contain the target concept

What does it mean when it is written that- Hypothesis space contains the target concept? If possible with an example.
-1
votes
3 answers

Haskell induction - I fail to see why this solution proves anything

The following is from a homework that I already did, and did wrong. I fail to see why the solution is sufficient. (After one week of reading and googling I turn to asking.) The example is similar to an example used in the Hutton book on Haskell.…
enahel
  • 355
  • 3
  • 15
-1
votes
1 answer

Number of binary tree shapes of N nodes are there with height N-1?

How many binary tree shapes of N nodes are there with height N-1? Also, how would you go about proofing by induction? So binary tree of height n-1 with node n means all node will have only 1 child, sort of chain like structure? So number of binary…
Asia x3
  • 606
  • 2
  • 16
  • 37
-1
votes
1 answer

Correctness of an algorithm

the algorithm is intended to compute m^n for any positive integer m, n. How do i show the correctness of this algorithm through induction on n. long exp(long m, int n) { if(n == 0) return 1; if(n == 1) return m; if(n % 2 == 0) return exp(m*m,…
user1505521
  • 231
  • 1
  • 2
  • 12
1 2 3
17
18