PA Weak Areas Flashcards

(32 cards)

1
Q

Linear search

A

Linear search is a search algorithm that starts from the beginning of a list, and checks each element until the search key is found or the end of the list is reached.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Binary search

A

Binary search is a faster algorithm for searching a list if the list’s elements are sorted and directly accessible. Binary search first checks the middle element of the list. If the search key is found, the algorithm returns the matching location. If the search key is not found, the algorithm repeats the search on the remaining left sublist (if the search key was less than the middle element) or the remaining right sublist (if the search key was greater than the middle element).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Merge sort

A

Merge sort is a sorting algorithm that divides a list into two halves, recursively sorts each half, and then merges the sorted halves to produce a sorted list. The recursive partitioning continues until a list of one element is reached, as a list of one element is already sorted.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

recursive function

A

A function may call other functions, including calling itself. A function that calls itself is known as a recursive function.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a list?

A

A list is an ADT for holding ordered data.

Examples include array and linked list.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Define a dynamic array.

A

A dynamic array is an ADT for holding ordered data and allowing indexed access.

Example includes array.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a stack?

A

A stack is an ADT in which items are only inserted on or removed from the top of a stack.

Example implementation includes linked list.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Define a queue.

A

A queue is an ADT in which items are inserted at the end of the queue and removed from the front of the queue.

Example implementation includes linked list.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a deque?

A

A deque is an ADT in which items can be inserted and removed at both the front and back.

Pronounced ‘deck’. Example implementation includes linked list.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Define a bag.

A

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

Example implementations include array and linked list.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is a set?

A

A set is an ADT for a collection of distinct items.

Example implementations include binary search tree and hash table.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Define a priority queue.

A

A priority queue is a queue where each item has a priority, and items with higher priority are closer to the front of the queue than items with lower priority.

Example implementation includes heap.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is a dictionary (map)?

A

A dictionary is an ADT that associates (or maps) keys with values.

Example implementations include hash table and binary search tree.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

abstract data type (ADT)

A

An abstract data type (ADT) is a data type described by predefined user operations, such as “insert data at rear,” without indicating how each operation is implemented. An ADT can be implemented using different underlying data structures. However, a programmer need not have knowledge of the underlying implementation to use an ADT.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

queue

A

A queue is an ADT in which items are inserted at the end of the queue and removed from the front of the queue.

A queue is referred to as a first-in first-out ADT. A queue can be implemented using a linked list or an array.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

enqueue

A

The queue enqueue operation inserts an item at the end of the queue.

17
Q

dequeue

A

The queue dequeue operation removes and returns the item at the front of the queue. Ex: After the operations “Enqueue 7”, “Enqueue 14”, and “Enqueue 9”, “Dequeue” returns 7. A second “Dequeue” returns 14.

18
Q

Record

A

A record is the data structure that stores subitems, often called fields, with a name associated with each subitem.

A list node’s data can store a record with multiple subitems.

19
Q

Linked List

A

A linked list is a data structure that stores an ordered list of items in nodes, where each node stores data and has a pointer to the next node.

If a program requires fast insertion of new data, a linked list may be a better choice than an array.

20
Q

doubly-linked list

A

A doubly-linked list is a data structure for implementing a list ADT, where each node has data, a pointer to the next node, and a pointer to the previous node. The list structure typically points to the first node and the last node. The doubly-linked list’s first node is called the head, and the last node the tail.

A doubly-linked list is similar to a singly-linked list, but instead of using a single pointer to the next node in the list, each node has a pointer to the next and previous nodes. Such a list is called “doubly-linked” because each node has two pointers, or “links”.

21
Q

What is a Leaf in the context of a tree?

A

A tree node with no children

Leaves are the endpoints of a tree structure.

22
Q

What defines an Internal node?

A

A node with at least one child

Internal nodes are essential for maintaining the structure of the tree.

23
Q

Who is considered a Parent in a tree structure?

A

A node with a child is said to be that child’s parent

The parent-child relationship is crucial for navigating the tree.

24
Q

What does a node’s ancestors include?

A

The node’s parent, the parent’s parent, etc., up to the tree’s root

Ancestors trace the lineage from a node back to the root.

25
What is the Root of a tree?
The one tree node with no parent (the 'top' node) ## Footnote The root is the starting point for all traversals in the tree.
26
What is the term for the link from a node to a child?
Edge ## Footnote An edge represents the connection between nodes in a tree structure.
27
How is a node's depth defined?
The number of edges on the path from the root to the node ## Footnote The root node has a depth of 0.
28
What do all nodes with the same depth form?
A tree level ## Footnote Tree levels categorize nodes based on their depth.
29
What is the height of a tree?
The largest depth of any node ## Footnote A tree with just one node has a height of 0.
30
Fill in the blank: A tree with just one node has a height of _______.
0 ## Footnote This indicates that the height is determined by the depth of the deepest node.
31
Quicksort
Quicksort is a sorting algorithm that repeatedly partitions the input into low and high parts (each unsorted), and then recursively sorts each of those parts. To partition the input, quicksort chooses a pivot to divide the data into low and high parts.
32
What does a dequeue operation do?
The queue dequeue operation removes and returns the item at the front of the queue.