Recursion in Data Structures

0.0(0)
Studied by 0 people
call kaiCall Kai
Locked
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/16

flashcard set

Earn XP

Description and Tags

This set of vocabulary flashcards covers the fundamental concepts of recursion, including verification methods, implementation details, and specific recursive algorithms for data structures like binary search and linked lists.

Last updated 11:52 AM on 6/28/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

17 Terms

1
New cards

Recursion

A technique that solves a problem by solving a smaller problem of the same type.

2
New cards

Recursive functions

Functions that call themselves within their own definition.

3
New cards

Factorial (recursive solution)

n!n! is defined as 11 if n=0n = 0, and (n1)!×n(n-1)! \times n if n>0n > 0.

4
New cards

Combinations (recursive solution)

(nk)=(n1k)+(n1k1)\binom{n}{k} = \binom{n-1}{k} + \binom{n-1}{k-1} for 1<k<n1 < k < n, with base cases (n1)=n\binom{n}{1} = n and (nn)=1\binom{n}{n} = 1.

5
New cards

Iteration vs. Recursion constructs

An iterative algorithm uses a looping construct, while a recursive algorithm uses a branching structure.

6
New cards

Recursion efficiency

Recursive solutions are often less efficient in terms of both time and space than iterative solutions, though they can result in shorter and simpler source code.

7
New cards

Base case

The instance within a recursive function for which the answer is known and no further recursion is required to provide a result.

8
New cards

General case

The instance where the problem is expressed as a smaller version of itself through a recursive call.

9
New cards

Size factor

The parameter or condition used to measure the problem size, such as the number of elements remaining in a list during a recursive search.

10
New cards

The Base-Case Question

A step in the Three-Question Verification Method asking if there is a nonrecursive way out of the function and if the routine works correctly for this base case.

11
New cards

The Smaller-Caller Question

A step in the Three-Question Verification Method asking if each recursive call involve a smaller case of the original problem, leading inescapably to the base case.

12
New cards

The General-Case Question

A step in the Three-Question Verification Method asking if the whole function works correctly assuming that the recursive call(s) work correctly.

13
New cards

Recursive binary search base cases

(1) If first>lastfirst > last, return false; (2) If item==info[midPoint]item == info[midPoint], return true.

14
New cards

Activation record

A data structure stored into a run-time stack whenever a function is called, containing the return address and local variables.

15
New cards

Run-time stack

The stack used by the computer to store activation records and manage function calls and returns.

16
New cards

Recursive InsertItem base cases

(1) If the list is empty, insert the item; (2) if item<locationinfoitem < location \rightarrow info, insert the item as the first node in the current list.

17
New cards

Recursive DeleteItem base case

If item==locationinfoitem == location \rightarrow info, delete the node pointed to by the location.