COMP103 Lecture Notes: Data Structures, Java API, and Algorithms

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

1/59

flashcard set

Earn XP

Description and Tags

A set of vocabulary flashcards covering key concepts from the lecture notes on abstraction, interfaces, Java API, collections, generics, trees, recursion, and algorithm analysis.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

60 Terms

1
New cards

Abstraction

A design principle that allows reasoning at a conceptual level by hiding implementation details.

2
New cards

Separation of concerns

Dividing a software system into distinct features or modules with minimal overlap.

3
New cards

Interface

A contract that defines method signatures without implementations; enables abstraction and polymorphism.

4
New cards

Abstract method

A method declaration without a body in an interface or abstract class; must be implemented by subclasses.

5
New cards

Java API

The standard library of packages and classes provided by the Java platform.

6
New cards

Java Package

A namespace that organizes related classes, e.g., java.util, java.lang.

7
New cards

Object class

Root class of all Java classes; every class implicitly extends it if no other superclass is specified.

8
New cards

toString

A method that returns a string representation of an object; commonly overridden.

9
New cards

equals

A method to compare logical equality between objects; differs from the == operator.

10
New cards

hashCode

An integer used by hash-based collections; must be consistent with equals.

11
New cards

Inheritance

IS-A relationship where a subclass inherits fields and methods from a superclass.

12
New cards

Single inheritance

Java supports only one class inheritance; multiple class inheritance is not allowed.

13
New cards

HAS-A relationship

Composition; a class contains objects as fields to build complex types.

14
New cards

Override

Redefining a superclass method in a subclass to provide specialized behavior.

15
New cards

super

A reference to the superclass, used to access its members or methods.

16
New cards

Java Collections Framework

A set of interfaces and classes for handling groups of objects such as List, Set, Map, Queue.

17
New cards

List

Ordered collection that allows duplicates; implementations include ArrayList and LinkedList.

18
New cards

ArrayList

Resizable-array implementation of List; supports dynamic resizing.

19
New cards

LinkedList

List implemented as a linked list; efficient insertions/removals.

20
New cards

Set

Collection that cannot contain duplicate elements; HashSet, TreeSet, LinkedHashSet.

21
New cards

HashSet

Set implementation based on a hash table; fast contains/add but unordered.

22
New cards

TreeSet

Sorted set backed by a tree structure; ordered by natural order or comparator.

23
New cards

Map

Collection of key-value pairs; keys are unique; implementations include HashMap, TreeMap, LinkedHashMap.

24
New cards

HashMap

Hash-based map; fast access; may allow null keys/values; not a subtype of Collection.

25
New cards

TreeMap

Sorted map; keys ordered by natural order or comparator; may not allow null keys.

26
New cards

LinkedHashMap

Map that preserves insertion order of entries.

27
New cards

ConcurrentHashMap

Thread-safe map implementation for concurrent environments.

28
New cards

Map views

Methods keySet(), values(), and entrySet() provide views of map contents.

29
New cards

Map.Entry

Interface representing a key-value pair in a map.

30
New cards

Generics

Type parameters enabling compile-time type safety, e.g., List, Map

31
New cards

Diamond operator

<> syntax to let the compiler infer generic types; reduces typing.
32
New cards

Raw type

Using a generic type without type parameters; discouraged due to safety risks.

33
New cards

Comparable

Interface defining a natural ordering via compareTo; used by sorted collections.

34
New cards

Comparator

External ordering mechanism; defines how objects should be ordered without modifying the class.

35
New cards

Lambda

Inline function expression in Java 8+ used to implement functional interfaces concisely.

36
New cards

Collections.sort

Static method to sort a list using natural order or a Comparator.

37
New cards

hashCode and equals contract

If equals is overridden, hashCode must be overridden as well to maintain hash-based collection integrity.

38
New cards

Hash collisions

When different keys produce the same hash code; resolved with buckets or probing.

39
New cards

Hash table

Array-based storage where items are located by a hash function; collisions require handling.

40
New cards

Big-O notation

Describes the upper bound of an algorithm’s time/space growth as input size increases.

41
New cards

Asymptotic complexity

Growth rate of an algorithm for large input sizes, dominated by the leading term.

42
New cards

O(1)

Constant time; cost does not grow with input size.

43
New cards

O(log n)

Logarithmic growth; doubling input size increases cost only slightly.

44
New cards

O(n)

Linear growth; cost proportional to input size.

45
New cards

O(n log n)

Growth rate between linear and quadratic; typical of efficient sorts.

46
New cards

O(n^2)

Quadratic growth; often from nested loops.

47
New cards

O(2^n)

Exponential growth; very costly for larger n.

48
New cards

O(n!)

Factorial growth; extremely expensive for larger n.

49
New cards

Tree traversal

Process of visiting all nodes in a tree; includes pre-order, in-order, post-order, level-order.

50
New cards

Binary tree

Tree where each node has at most two children: left and right.

51
New cards

Root/leaf/internal node

Root is the top node; leaves have no children; internal nodes have children.

52
New cards

Depth-first search (DFS)

Tree traversal that explores as far as possible along a branch before backtracking.

53
New cards

Breadth-first search (level-order)

Traversal that visits nodes level by level from the root outward.

54
New cards

Recursion

A method calling itself to solve a problem by solving smaller subproblems.

55
New cards

Base case

Condition under which a recursive function stops calling itself.

56
New cards

Factorial

n! is the product of all integers from n down to 1; 0! = 1 by convention.

57
New cards

Strings are immutable

In Java, String objects cannot be modified after creation; operations create new strings.

58
New cards

Heap memory

Region of memory for dynamic allocation of objects; accessed via references.

59
New cards

NullPointerException

Error raised when dereferencing a null reference.

60
New cards

String tokenization

Splitting a string into tokens, often with String.split.