C949v4 Study Guide | Determines Data Structure Impact

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

1/37

flashcard set

Earn XP

Description and Tags

Implementation of Data Structures Array (Chapter 1.1, 1.4, 1.5) Linked list (doubly & singly linked) (Chapter 2) Stack operations (Chapter 3) Queue operations (push, pop, peek, enqueue, dequeue) (Chapter 3) Deque operations (Chapter 3) Hash table (Chapter 4) Trees (leaf nodes, root, height) (Chapter 4) Heaps (Chapter 7) Sets (including intersection) (Chapter 8) Graph (vertices, adjacency) (Chapter 9)

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

38 Terms

1
New cards

Array

Description: A data structure that stores a fixed-size sequence of elements of the same type in contiguous memory locations.

Comparison: Elements are compared by their index.

Insertion: Elements can be inserted at the end in O(1) time. Inserting at the beginning or middle takes O(n) time.

Deletion: Elements can be deleted in O(1) time from the end of the array. Deleting from the beginning or middle takes O(n) time.

Indexing: Elements are accessed using their index.

Hierarchy: have a flat structure.

2
New cards

Linked List

Description: A data structure that consists of a sequence of nodes, each containing an element and a reference to the next node.

Comparison: Elements are compared by their value.

Insertion: Elements can be inserted at the beginning or end of the linked list in O(1) time. Inserting in the middle takes O(n) time.

Deletion: Elements can be deleted in O(1) time if the node to be deleted is known. Deleting a node requires traversing in O(n) time to find the node to be deleted.

Indexing: Elements are accessed by traversing from the beginning or end.

Hierarchy: have a flat structure.

3
New cards

Stack

Description: A data structure that follows the Last-In-First-Out (LIFO) principle.

Comparison: Elements are compared by their value.

Insertion: Elements are inserted at the top in O(1) time.

Deletion: Elements are deleted from the top in O(1) time.

Indexing: Elements are not accessed by index

Hierarchy: have a flat structure.

4
New cards

pop()

operation removes and returns the item at the top of the stack

5
New cards

push()

inserts an item on the top of the stack

6
New cards

peek()

returns but does not remove item at top of stack

7
New cards

enqueue()

Adds an element to the back of the queue.

8
New cards

dequeue()

Removes the front element from the queue and returns it.

9
New cards

Queue

Description: A data structure that follows the First-In-First-Out (FIFO) principle.

Comparison: Elements are compared by their value.

Insertion: Elements are inserted at the back in O(1) time.

Deletion: Elements are deleted from the front in O(1) time.

Indexing: Elements are not accessed by index

Hierarchy: have a flat structure.

10
New cards

Hash Table

a data structure that stores unordered items by mapping each item to a location in an array or vector

11
New cards

Hash function

computes a bucket index from the item’s key

12
New cards

Chaining

handles hash table collisions by using a list for each bucket, where each list may store multiple items that map to the same bucket

13
New cards

key

the value used to map to an index in a hash table

14
New cards

Modulo Operator

computes the integer remainder when dividing two numbers and is a common hash function

15
New cards

Binary Tree

a data structure in which each node stores data and has up to two children, known as a left and right child

16
New cards

Heap sort

sorting algorithm that takes advantage of a max-heap’s properties by repeatedly removing the max and building a sorted array in reverse order

17
New cards

Set

an ADT for a collection of distinct items

18
New cards

Graph

Description: A collection of nodes (vertices) connected by edges.

Comparison: Nodes are compared by their value.

Insertion: Nodes and edges are inserted by adding them to the graph as new vertices or edges, respectively.

Deletion: Nodes and edges are deleted by removing them from the graph along with any connections to other vertices or edges.

Indexing: Nodes are not accessed by index in a graph.

Hierarchy: Graphs have a hierarchical structure.

19
New cards

Dictionary

Description: A collection of key-value pairs where each key maps to a value.

Get: Returns the value associated with a specified key.

Set: Sets the value associated with a specified key.

Delete: Removes a key-value pair from the dictionary.

20
New cards

List

an ADT for holding ordered data

21
New cards

heaplist

A binary heap can be represented as a list, where the root node is at index 1 and the children of a node at index i are at indices 2i and 2i+1.

22
New cards

child and parent

Each node has at most two children and one parent. The parent of a node can be found by taking the floor of the node index divided by 2.

23
New cards

min-heap

A binary heap where the value of each parent node is less than or equal to its children.

24
New cards

max-heap

A binary heap where the value of each parent node is greater than or equal to its children.

25
New cards

weight and direction

Edges can have weights to represent the strength or cost of the connection between two vertices. Edges can also be directed, meaning they have a specific start and end point, or undirected, meaning they have no specific start or end point.

26
New cards

vertices/nodes/edges

The nodes in a graph are also called vertices, and the edges are the connections between them. Edges are often represented as pairs of nodes, such as (u, v) to indicate an edge between vertices u and v.

27
New cards

directed graph

Edges have a direction and can only be traversed in one direction.

28
New cards

undirected grap

Edges have no direction and can be traversed in either direction.

29
New cards

tree traversal

The process of visiting each node in a tree in a specific order.

30
New cards

inorder traversal

Visits the left subtree, then the current node, and finally the right subtree.

31
New cards

preorder traversal

Visits the current node, then the left subtree, and finally the right subtree.

32
New cards

postorder traversal

Visits the left subtree, then the right subtree, and finally the current node.

33
New cards

Doubly Linked List

Description: A data structure that consists of a sequence of nodes, each containing an element and references to the previous and next nodes.

Comparison: Elements are compared by their value.

Insertion: Elements can be inserted at the beginning or end of the doubly linked list in O(1) time. Inserting in the middle of the list takes O(n) time.

Deletion: Elements can be deleted in O(1) time if the node to be deleted is known. Deleting a node requires traversing the list in O(n) time to find the node to be deleted.

Indexing: Elements are accessed by traversing the list from the beginning or end.

Hierarchy: have a flat structure.

34
New cards

collision

when an item being inserted into a hash table maps to the same bucket as an existing item in a hash table

35
New cards

full

if every node on a binary tree contains 0 or 2 children

36
New cards

complete

complete on all levels of the binary tree except possible the last level, contain all possible nodes and all nodes in the last level are a as far left as possible

37
New cards

perfect

if all internal nodes on the binary tree have 2 children and all leaf nodes are at the same level

38
New cards

bag

an ADT for storing items in which the order does not matter and duplicate items are allowed