Skip to main content
Java Active Learning WorkBook:
Scaffolded Programming Activities Beyond The Basics.
Celine Latulipe, Devon Blewett, Lara De Leon
Contents
Search Book
close
Search Results:
No results.
Prev
Up
Next
Profile
Course Home
Assignments
Practice
Peer Instruction (Instructor)
Peer Instruction (Student)
Change Course
Instructor's Page
Progress Page
Edit Profile
Change Password
Log Out
Front Matter
chevron_left
Preface
Colophon
1
Java Basics
chevron_left
1.1
Basic Program Structure
1.1.1
Exercise 1
1.1.2
Exercise 2
1.2
Data Types & Operators
1.2.1
Brief Review of Data Types
1.2.2
Built-in Mathematical Operators
1.2.3
Type Conversion
1.2.4
Exercise 1
1.2.5
Exercise 2
1.2.6
Exercise 3
1.2.7
Exercise 3
1.3
Enumerators
1.4
Methods
1.5
Formatting Console Output
1.6
Console Output via Scanner
1.7
Conditionals
1.8
Switch Statements
1.9
Loops
1.10
Math & String Methods
1.11
Arrays
2
Objects Basics
3
Objects Intermediate
4
Strings
5
File I/O
chevron_left
5.1
Starter Level
5.1
Exercises
5.2
Growth Level
5.3
Stretch Level
6
Exception Handling
chevron_left
6.1
exception one
6.2
exception two
7
ArrayLists
chevron_left
7.1
Check Your Understanding
7.1
Exercises
7.2
Starter Level
7.2.1
Instructions
7.3
Growth Level
7.3.1
Overview
7.3.2
Instructions
7.4
Stretch Level
7.4.1
Overview
7.4.2
Instructions
8
Wrapper Classes
chevron_left
8.1
Check Your Understanding
8.1
Exercises
8.2
Starter Level
8.2.1
Overview
8.2.2
Instructions
8.3
Growth Level
8.3.1
Overview
8.3.2
Instructions
8.4
Stretch Level
8.4.1
Overview
8.4.2
Instructions
9
Searching
10
Sorting
chevron_left
10.1
starter
10.1.1
10.2
second
10.3
third
11
Recursion Intro
chevron_left
11.1
recursion one
12
Recursion Advanced
chevron_left
12.1
advancedrec one
13
Multidimensional Arrays
chevron_left
13.1
Starter Level
13.1.1
Overview
13.1.2
2D Array
13.1.3
Instructions
13.2
Growth Level
13.2.1
Overview
13.2.2
2D Array
13.2.3
Instructions
13.3
Stretch Level
13.3.1
Overview
13.3.2
Instructions
14
Linked Lists
15
Interfaces
16
Abstract Data Types
Backmatter
🔗
Section
11.1
recursion one
🔗
Objectives
Implement a bubblesort recursively
import java.util.Arrays; public class Main{ public static void main(String[] args) { int arr[] = {9,4,1,5,2,8}; System.out.print("Before sorting: "); printArray(arr); bubbleSort(arr, arr.length); System.out.print("After sorting: "); printArray(arr); } static void printArray(int arr[]){ for(int i = 0; i < arr.length; i++){ System.out.print(arr[i] + " "); } System.out.println(); } static void bubbleSort(int arr[], int size){ // base case - the recursive calls has reached the last element to be checked // recursive step - a single pass of the bubblesort algorithm // call the next step } }
You have attempted
1
of
2
activities on this page.