Back to marketplace

Algorithms

No description yet. This curated deck is ready for daily study.

Total cards: 24•Content version: v4•Public deck•Updated: 8/1/2026

Card preview (24)

#1
Front (Question)

How does binary search work

Back (Answer)

Finds the middle element in a list of data before deciding which side of the data the desired element is to be found in. The unwanted half of the data is then discarded, and the process is repeated until the desired element is found or until it is known that the desired element doesn’t exist in the data.

#2
Front (Question)

What must be true about a list for binary search to be true

Back (Answer)

The list must have been sorted already

#3
Front (Question)

How does linear search work

Back (Answer)

You can think of it as going along a bookshelf one by one until you come across the book you’re looking for. Sometimes the algorithm gets lucky and finds the desired element almost immediately, while in other situations, the algorithm is incredibly inefficient.

#4
Front (Question)

What is the order for post order traversal

Back (Answer)

Left right root

#5
Front (Question)

What is the order for breadth first traversal

Back (Answer)

from top to bottom, left to right

#6
Front (Question)

How does bubble sort work

Back (Answer)

The bubble sort algorithm works by repeatedly going through a list of items, comparing consecutive pairs of items and swapping the items if they are in the wrong order. Each time the algorithm goes through the list, it is called a pass and on the final pass, it checks to see if any swaps are needed, if not the list must be sorted.

#7
Front (Question)

How does insertion sort work

Back (Answer)

The insertion sort algorithm works by building up a sorted sub list in the first part of the original list, while the remaining part of the list remains unsorted At the start of the algorithm, the sorted sub list contains just a single item (the first item in the list). All of the other items belong to the unsorted sub list. The algorithm goes through the unsorted sub list, item by item. As each item is examined, it is moved into the correct position (in ascending or descending order) in the sorted sub list. This progresses until the final item is correctly inserted and the list is sorted

#8
Front (Question)

Explain one situation where insertion sort would be better than bubble sort

Back (Answer)

On large lists, as it usually requires less comparisons per pass making it quicker and more efficient

#9
Front (Question)

Describe the stack data structure

Back (Answer)

A stack is a type of FILO data structure, using a pointer to point to the element currently at the top of the stack

#10
Front (Question)

Describe the queue data structure

Back (Answer)

A queue is a type of FIFO data structure, using two pointers. A front pointer to points to the first element in the queue and a back pointer which points to the next empty space at the back of the queue

#11
Front (Question)

Give 1 similarity and one difference between stacks and queues

Back (Answer)

Similarity: Both are often implemented as arrays Difference: stacks use 1 pointer, queues use 2

#12
Front (Question)

What operation are used to add and remove elements from a queue

Back (Answer)

Add: enqueue(elementName) remove: dequeue()

#13
Front (Question)

What operation are used to add and remove elements from a stack

Back (Answer)

Add: push(elementName) remove: pop()

#14
Front (Question)

What happens to the pointer in a stack when the stack is popped

Back (Answer)

The pointer decrements by 1, pointing to the element below

#15
Front (Question)

What happens to the pointers in a queue when the queue is dequeued

Back (Answer)

The front pointer incremented by 1, pointing to the next element in the list The back pointer remains unchanged

#16
Front (Question)

For both stacks and queues, what must be checked before trying to remove elements

Back (Answer)

The stack or queue has to be checked to see if its empty, if not then an element can be removed

#17
Front (Question)

What happens to the back pointer in a queue if an element is added

Back (Answer)

The back pointer increments by one

#18
Front (Question)

What is meant by time complexity

Back (Answer)

Time complexity is the amount of time it takes an algorithm to solve a particular problem

#19
Front (Question)

What is meant by constant time complexity

Back (Answer)

The amount of time taken to complete an algorithm is independent from the number of elements inputted O(1)

#20
Front (Question)

What is meant by linear time complexity

Back (Answer)

The amount of time taken to complete an algorithm is directly proportional to the number of elements inputted O(n)

#21
Front (Question)

What is meant by polynomial time complexity

Back (Answer)

The amount of time taken to complete an algorithm is directly proportional to the square of the elements inputted O(n^2)

#22
Front (Question)

What is meant by exponential time complexity

Back (Answer)

The amount of time taken to complete an algorithm will double with every additional item O(2^n)

#23
Front (Question)

What is meant by logarithmic time complexity

Back (Answer)

The time taken to complete an algorithm will increase at a smaller rate as the number of elements inputted

#24
Front (Question)

What is meant by space complexity

Back (Answer)

Space complexity is the amount of storage the algorithm takes up