Data Structures Midterm

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

1/48

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 10:15 PM on 3/3/25
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

49 Terms

1
New cards
UML Class Modifier: +
Public access modifier; accessed everywhere.
2
New cards
UML Class Modifier: -
Private access modifier; accessed only in the current class.
3
New cards
UML Class Modifier: #
Protected access modifier; accessed in the current class and subclasses.
4
New cards
UML Class Modifier: ~
Default access modifier; used when no access modifier is specified.
5
New cards
Array Variable Declaration Syntax
[] variable_name; or int[] prime; or int prime[]; both equivalent.
6
New cards
Declaring and Defining an Array
Declare and create an array: int[] primes = new int[10] or separate declaration and definition.
7
New cards
Default Initialization for Numeric Arrays
Numeric values initialized to 0 when array is created.
8
New cards
Default Initialization for Boolean Values
Boolean values initialized to false when array is created.
9
New cards
Default Initialization for Char Values
Char values initialized to '\u0000' when array is created.
10
New cards
Accessing Array Elements
Use a[i] to access entry i of array named a; indices start at 0.
11
New cards
Initializing an Array with Existing Values
Example: int[] value = even; where both refer to the same array.
12
New cards
Referencing Array Length
Use array_variable_name.length to get the array length.
13
New cards
Two-Dimensional Array Access
Access using a[i][j] where i is the row and j is the column.
14
New cards
Ragged Array
A non-rectangular two-dimensional array.
15
New cards
Abstract Data Type (ADT)
Composed of a collection of data and a set of operations on that data.
16
New cards
List Interface
Provides the functionality of an indexed data structure and more operations.
17
New cards
ArrayList Class
An implementation of the List interface that allows efficient addition of elements.
18
New cards
Adding Elements to ArrayList
Use myList.add(item) to add at the end of the ArrayList.
19
New cards
ArrayList Method: get()
Returns the item at a specified position in the list.
20
New cards
ArrayList Method: set()
Replaces an item at a specified position in the list.
21
New cards
ArrayList Method: size()
Returns the number of items in the list.
22
New cards
Generic Collections
Lists can specify types to restrict the types of objects stored.
23
New cards
Capacity vs Size
Capacity is total allocated memory; size is the number of elements stored.
24
New cards
Primitives in Java
Basic data types such as int, char, boolean; not objects.
25
New cards
Wrapper Classes in Java
Used to wrap primitive types as objects; e.g., Integer for int.
26
New cards
Big-O Notation
Expresses the performance or complexity of an algorithm in relation to input size.
27
New cards
Linear Growth Rate (O(n))
Processing time increases linearly with the number of inputs.
28
New cards
Quadratic Growth Rate (O(n^2))
Processing time increases proportional to the square of the number of inputs.
29
New cards
Logarithmic Time Complexity (O(log n))
Time complexity where operations cut the problem size in half each time.
30
New cards
Single-Linked List
A data structure allowing insertion and removal at arbitrary locations with O(1) time.
31
New cards
Stack Abstract Data Type
Last-In, First-Out data structure allowing access only to the top element.
32
New cards
Postfix Expression
Mathematical notation where operators follow operands, e.g., 'a b +' instead of 'a + b'.
33
New cards
Postfix to Infix Conversion
Transforming postfix expressions back to standard infix notation.
34
New cards
Pushing to Stack
Adding a new element on top of the stack.
35
New cards
Popping from Stack
Removing and retrieving the top element from the stack.
36
New cards
Peek Operation on Stack
Inspecting the top element of the stack without removing it.
37
New cards
Size of ArrayList
Indicates how many elements are initially stored in the list.
38
New cards
Element Insertion in ArrayList
Inserts at a specified position and shifts elements as necessary.
39
New cards
Generic Classes
Classes that can operate on a variety of data types using type parameters.
40
New cards
Wrapper.valueOf()
Converts a value to its corresponding wrapper object.
41
New cards
Wrapper.parseType()
Parses a string representation of the value back to its primitive type.
42
New cards
Reallocate Method
Creates a new array that is twice the size of the current array.
43
New cards
Complexity of T(n) = O(n^2 + 5n + 25)
Expressed simply as O(n^2) in big-O notation.
44
New cards
Algorithm with Exponential Growth
Algorithms that grow dramatically in complexity with increased inputs.
45
New cards
Removing Element from ArrayList
Removes an element at a specified position and shifts items to fill the gap.
46
New cards
Adding Element to End of ArrayList
Generally a constant time operation, O(1), but can be O(n) if reallocation occurs.
47
New cards
Accessing Elements in Indexed Data Structures
Elements can be accessed in any order using subscript values.
48
New cards
Accessing Array Elements in a Loop
Loop through indices using for(int k=0; k
49
New cards
Array Initialization with Specific Values
Declare and initialize: int[] primes={2,3,5,7,11,13,17};.