Data Structures and Algorithms Flashcards

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

1/22

flashcard set

Earn XP

Description and Tags

Flashcards based on Data Structures and Algorithms lecture notes.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

23 Terms

1
New cards

Time Complexity

The amount of time required by the algorithm to complete.

2
New cards

Recursive Method without Base Case

An infinite loop occurs.

3
New cards

Selection Sort Algorithm (Average Time Complexity)

O(n^2)

4
New cards

Constant Time Complexity (Big-O notation)

O(1)

5
New cards

Key Benefit of Generic Dynamic Data Structures

Allows code reusability, hence can be used to store all valid object types.

6
New cards

Doubly Linked List

Allows traversal in both forward and backward directions. (True)

7
New cards

Graph Representation

Adjacency List, Adjacency Matrix as well as Incidence Matrix

8
New cards

Dijkstra's Algorithm Use

Find the shortest path between two nodes in a graph

9
New cards

Functional Interface

Has a single abstract method. (True)

10
New cards

Primary Advantage of Linked List over Array

Dynamic size adjustment

11
New cards

Binary Search Tree (BST) InOrder Traversal

Left subtree, root, right subtree

12
New cards

Recursion

A function that calls itself to solve smaller subproblems of the same type.

13
New cards

Divide and Conquer

A problem-solving paradigm where a problem is divided into smaller subproblems, solved independently, and their solutions combined. Example: Merge Sort.

14
New cards

Cost Function O(log2n) vs O(n)

O(log2n) performs better because the time taken increases much slower with input size compared to O(n).

15
New cards

Linked List

A data structure where elements are stored in nodes, each containing data and a pointer to the next node.

16
New cards

Hash Tables and Hash Functions

Hash Tables use Hash Functions to map keys to indices in an array for efficient data storage and retrieval.

17
New cards

HashSet and Object Equality

To use HashSet, the equals() and hashCode() methods must be implemented in the class, and relevant attributes should be immutable.

18
New cards

Functional Interface (Java)

An interface with a single abstract method, useful for lambda expressions and functional programming.

19
New cards

Binary Tree vs Array for Sorted Names

Array is better due to constant-time access using indices provided the array is sorted.

20
New cards

Binary Search Tree vs. Binary Tree

A Binary Search Tree maintains an ordered structure, allowing efficient searching, insertion, and deletion, While a Binary Tree does not have any specific ordering.

21
New cards

Graph

A data structure consisting of nodes (vertices) and edges connecting them, differing from a tree by allowing cycles and multiple connections between nodes.

22
New cards

Dijkstra's Algorithm

An algorithm for finding the shortest paths between nodes in a graph, iteratively updating tentative distances until the shortest path to each node is found.

23
New cards

HashMap vs. TreeMap

HashMap offers faster average-case performance with O(1) lookup but does not guarantee any specific order of elements. TreeMap guarantees sorted order.