Data Structures and Algorithms in Java - List Data Structures

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/12

flashcard set

Earn XP

Description and Tags

Flashcards about List Data Structures, covering objectives, drawbacks of arrays, self-referential structures, linked lists, singly linked lists, circular lists, doubly linked lists, and lists in java.util.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

13 Terms

1
New cards

What is a List?

A sequential data structure that stores a sequence of items of a given base type, where items can be added, deleted, and retrieved from any position in the list.

2
New cards

What are the drawbacks of using arrays?

Arrays require size information for creation; inserting or deleting elements in the middle of an array leads to moving other elements around.

3
New cards

What is a self-referential structure?

An object where one of its elements is a reference to another object of its own type, allowing for the creation of 'chains' of data.

4
New cards

What is a linked list?

A collection of nodes storing data and links to other nodes, forming a linear data structure.

5
New cards

What are the common types of linked lists?

Singly-Linked List and Doubly-Linked List.

6
New cards

What is a singly linked list?

A list where each node includes two data fields: info (to store information) and next (to link to its successor).

7
New cards

What is a circular list?

A list where nodes form a ring, with each node having a successor, and the list is finite.

8
New cards

What does the rotate() operation do in the context of circular lists and round-robin scheduling?

Moves the first element to the end of the list.

9
New cards

What is a doubly linked list?

A list where each node has two reference fields: one to the successor and one to the predecessor.

10
New cards

What does the add(E o) method do in the java.util LinkedList class?

Appends the specified element to the end of the list.

11
New cards

What does the addFirst(E o) method do in the java.util LinkedList class?

Inserts the given element at the beginning of this list.

12
New cards

What does ensureCapacity(int minCapacity) do in the java.util ArrayList class?

Increases the capacity of this ArrayList instance, if necessary, to ensure that it can hold at least the number of elements specified by the minimum capacity argument.

13
New cards

What does trimToSize() do in the java.util ArrayList class?

Trims the capacity of this ArrayList instance to be the list's current size.