ArrayLists and Sorting Algorithms

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

1/12

flashcard set

Earn XP

Description and Tags

These flashcards cover key concepts about ArrayLists, their methods and sorting algorithms relevant to the lecture notes.

Last updated 2:14 AM on 3/11/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

13 Terms

1
New cards

What are ArrayLists in Java?

ArrayLists are a collection object that uses arrays internally and can change size unlike traditional arrays.

2
New cards

How do you create an ArrayList in Java?

To create an ArrayList, you use: ArrayList arraylistname = new ArrayList();.

3
New cards

What is the role of wrapper classes in ArrayLists?

Wrapper classes allow ArrayLists to store primitive data types by using objects that behave like primitives.

4
New cards

What does it mean for an ArrayList to be pass by reference?

Changing an element of an ArrayList within a method modifies the original ArrayList due to pass by reference.

5
New cards

What method returns the size of an ArrayList?

The method size() returns the size of an ArrayList.

6
New cards

How does the add(index, element) method function in ArrayLists?

It adds an element at the specified index in the ArrayList or appends it at the end if index is omitted.

7
New cards

What does the get(index) method do?

The get(index) method returns the element located at the specified index in the ArrayList.

8
New cards

What is the purpose of the set(index, element) method?

The set(index, element) method replaces the element at the specified index with the given element and returns the replaced element.

9
New cards

What does the remove(index) method do?

The remove(index) method removes and returns the element at the specified index in the ArrayList.

10
New cards

How does selection sort work?

Selection sort finds the smallest element in the list and swaps it with the current element, progressively building a sorted list.

11
New cards

What are the key points of selection sort?

For a list of length n, it performs (n-1) comparisons and the number of swaps varies depending on the data.

12
New cards

What is insertion sort?

Insertion sort inserts each element into its correct position in a pre-sorted subsection of the list.

13
New cards

What are the key points of insertion sort?

For a list of length n, it performs n-1 insertions and its comparisons can range from 0 to (n-1)th triangular number.

Explore top notes

Explore top flashcards

flashcards
BIS Final Acronyms
40
Updated 836d ago
0.0(0)
flashcards
Filmgeschiedenis 2 (2022-2023)
134
Updated 1014d ago
0.0(0)
flashcards
Tema 2B: ¿Quién Soy Yo?
65
Updated 68d ago
0.0(0)
flashcards
civil war
25
Updated 1223d ago
0.0(0)
flashcards
Elbow and Forearm
54
Updated 734d ago
0.0(0)
flashcards
BIS Final Acronyms
40
Updated 836d ago
0.0(0)
flashcards
Filmgeschiedenis 2 (2022-2023)
134
Updated 1014d ago
0.0(0)
flashcards
Tema 2B: ¿Quién Soy Yo?
65
Updated 68d ago
0.0(0)
flashcards
civil war
25
Updated 1223d ago
0.0(0)
flashcards
Elbow and Forearm
54
Updated 734d ago
0.0(0)