csc346 test 2

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/7

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 9:00 AM on 4/22/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

8 Terms

1
New cards

Using pseudocode, describe either Prim’s or Kruskal’s algorithm for finding the

minimal spanning tree of a graph.

  • start with a graph with just the vertices

  • repeat n-1 times

  • add the lowest weight edge that doesn’t result in a cycle when added.

2
New cards

Which is faster, Bellman-Ford or Dijkstra’s Algorithm? If one is faster, why does

one need to know both?

Dijkstra’s Algorithm is faster as time to compute is O(V+E) log V). Although this algorithm is quicker, it fails when edges are negative. Bellman-Ford’s algorithm does not fail.

3
New cards

How does Floyd-Warshall differ in what it does from what Dijkstra’s and

Bellman-Ford do?

it finds and computes the shortest path between all pairs of vertices. Both Dijkstra and Bell-man Ford algorithm do not handle every pair of given vertices.

4
New cards

What properties should a good hash function have?

good hash functions should have rare collisions, minimum time taken to compute function, and distributes uni-formally.

5
New cards

In a Hash table, is it always bad to have collisions? Why or why not?

it’s not bad to have collisions, but in an efficient hash table, they should be rare. collisions are bad if they start to degrade performance.

6
New cards

In the Chain Matrix Multiplication Dynamic Programming problem, two things

were memorized. What were they? Also, what was the goal of this algorithm

minimum scalar multiplications and the optimal split point were memorized. the goal was to minimize the scalar multiplications when multiplying sequences of matrices.

7
New cards

in a hash table, how does chaining deal with collisions?

by creating a linked list (or similar data structure) for each slot (bucket) in the hash table array

8
New cards

in a hash table, how does linear probing deal with collisions?

by searching for the next available slot in a sequential, stepwise manner