Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

CSE 310 Exam 1 questions with answers, Exams of Data Structures and Algorithms

CSE 310 Exam 1 questions with answers

Typology: Exams

2024/2025

Available from 07/03/2025

Achieverr
Achieverr 🇺🇸

4.3

(7)

9K documents

1 / 9

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CSE |\310 |\Exam |\1 |\questions |\with |\answers
Big |\O |\notation |\- |\CORRECT |\ANSWERS |\✔✔O(g(n) |\= |\f(n) |\if |\f(n) |\<= |\
a*g(n) |\while |\n |\>= |\b
Big |\Ω |\notation |\- |\CORRECT |\ANSWERS |\✔✔Ω(g(n)) |\= |\f(n) |\if |\f(n) |\>= |\
a*g(n) |\while |\n |\>= |\b
Big |\Θ |\notation |\- |\CORRECT |\ANSWERS |\✔✔Θ(g(n)) |\= |\f(n) |\if |\f(n) |\<= |\
a*g(n) |\and |\f(n) |\>= |\b*g(n) |\for |\all |\n |\>= |\c
To |\prove |\correctness |\of |\algorithm, |\show |\______, |\_____ |\and |\_____ |\hold
|\- |\CORRECT |\ANSWERS |\✔✔initialization, |\maintenance, |\and |\
termination
Index |\of |\left |\child |\of |\node |\- |\CORRECT |\ANSWERS |\✔✔i |\= |\index |\of |\
node
2*i |\= |\index |\of |\node's |\left |\child
parent |\index |\in |\heap |\- |\CORRECT |\ANSWERS |\✔✔i |\= |\index |\of |\node
floor(i/2) |\= |\index |\of |\node's |\parent
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download CSE 310 Exam 1 questions with answers and more Exams Data Structures and Algorithms in PDF only on Docsity!

CSE |\ 310 |\Exam |\ 1 |\questions |\with |\answers

Big |\O |\notation |- |\CORRECT |\ANSWERS |\✔✔O(g(n) |= |\f(n) |\if |\f(n) |<= |
ag(n) |\while |\n |>= |\b Big |\Ω |\notation |- |\CORRECT |\ANSWERS |\✔✔Ω(g(n)) |= |\f(n) |\if |\f(n) |>= |
a
g(n) |\while |\n |>= |\b Big |\Θ |\notation |- |\CORRECT |\ANSWERS |\✔✔Θ(g(n)) |= |\f(n) |\if |\f(n) |<= |
ag(n) |\and |\f(n) |>= |\bg(n) |\for |\all |\n |>= |\c To |\prove |\correctness |\of |\algorithm, |\show |______, |_____ |\and |_____ |\hold |- |\CORRECT |\ANSWERS |\✔✔initialization, |\maintenance, |\and |
termination Index |\of |\left |\child |\of |\node |- |\CORRECT |\ANSWERS |\✔✔i |= |\index |\of |
node 2*i |= |\index |\of |\node's |\left |\child parent |\index |\in |\heap |- |\CORRECT |\ANSWERS |\✔✔i |= |\index |\of |\node floor(i/2) |= |\index |\of |\node's |\parent

What |\does |\heap-extract |\max |\do? |- |\CORRECT |\ANSWERS |\✔✔1) |\takes |
out |\the |\head |\of |\heap |\and |\replaces |\it |\with |\last |\node

  1. |\performs |\max-heapify |\on |\head Find |\the |\expression |\associated |\with |\the |\runtime |\of |\this |\pseudocode |(i.e. |\C1 |\x |\n |+ |\C2 |\x |\n |... |\etc) |\and |\find |\the |\big |\O |\approximation k=1 |// |\C do |// |\C { |\j |= |\ 1 |// |\C |\do |// |\C |{ |\j |= |\j*2 |// |\C |}while(j |< |\n) |// |\C |\k++ |// |\C }while |(k |< |\n) |// |\C8 |- |\CORRECT |\ANSWERS |\✔✔C1 |\x |\ 1 |+ |\C2 |\x |\n |+ |\C3 |\x |\n |+ |\C4 |\x |\n(log_2(n)) |+ |\C5 |\x |\n(log_2(n)) |+ |\C6 |\x |\n(log_2(n)) |+ |\C7 |\x |\n |+ |\C8 |\x |\n |= |\O(nlogn) Time |\of |\max-heapify |- |\CORRECT |\ANSWERS |\✔✔O(logn)

Min |\heap |- |\CORRECT |\ANSWERS |\✔✔The |\parent |\of |\any |\node |\is |\less |
than |\or |\equal |\to |\the |\node |\itself Which |\tree |\is |\wrong |(there |\are |\two)


|\ 30 |\ 2 |\ 8 10


|\ 20 |\ 10 |\ 11 2 |\ 3 |\ 6


|\ 10 |\ 2 |\ 3 |\ 1 |\ 2 ----------------------------------------------------------------------------- |- |\CORRECT |
ANSWERS |\✔✔ 1 |\and |\ 3

Explicit |\formula |\for |\height |\of |\heap |\and |\O |\approximation |- |\CORRECT |\ANSWERS |\✔✔ceil(log_2(n+1)-1) O(logn) What |\does |\heap-increase-key |\do? |- |\CORRECT |\ANSWERS |\✔✔1) |\makes |\specific |\node's |\value |\large

  1. |\moves |\it |\up |\until |\it's |\smaller |\than |\its |\parent |\and |\larger |\than |\its |
    children O |\notation |\of |\f(n) |= |\100,000(nlog_100(n+30)) |- |\CORRECT |\ANSWERS |
    ✔✔O(nlogn) O |\notation |\of |\f(n) |= |\x^10 |+ |\1,000,000,000
    log_2(x) |- |\CORRECT |
    ANSWERS |\✔✔O(x^10) index |\of |\right |\child |\of |\node |- |\CORRECT |\ANSWERS |\✔✔i |= |\index |\of |
    node 2*i+1 |= |\index |\of |\node's |\right |\child Merge |\sort |\best |\case/worst |\case |- |\CORRECT |\ANSWERS |\✔✔O(nlogn) |
    for |\both

does |\indexing |\of |\arrays |\start |\at |\ 1 |\or |\0? |(in |\this |\class) |- |\CORRECT |
ANSWERS |\✔✔ 1 does |\indexing |\of |\hashtables |\start |\at |\ 1 |\or |\0? |(in |\this |\class) |- |
CORRECT |\ANSWERS |\✔✔ 0 What |\does |\heap-insert |\do? |- |\CORRECT |\ANSWERS |\✔✔adds |\node |\to |
bottom, |\then |\rearranges |\heap |\to |\make |\sure |\properties |\are |\not |
broken Runtime |\of |\heap-insert |- |\CORRECT |\ANSWERS |\✔✔O(logn) What |\is |\a |\decision |\tree |- |\CORRECT |\ANSWERS |\✔✔Diagram |\of |\all |
possible |\decisions T/F: |\you |\need |\to |\specify |\a |\number |\of |\elements |\when |\creating |\a |
decision |\tree |(i.e. |\for |\a |\sorting |\algorithm) |- |\CORRECT |\ANSWERS |
✔✔True Worst |\case |\number |\of |\comparisons |\in |\decision |\tree |\is |= |\to |\the |_____ |\of |\the |\decision |\tree |- |\CORRECT |\ANSWERS |\✔✔height Worst |\case |\lower |\bound |\for |\runtime |\of |\sort |\algorithms |- |\CORRECT |
ANSWERS |\✔✔Ω(nlogn)

Number |\of |\comparisons |\to |\find |\min |\and |\max |\in |\any |\array |- |
CORRECT |\ANSWERS |\✔✔3*floor(n/2) |\where |\n |\is |\the |\number |\of |
elements |\in |\the |\array T/F: |\quicksort |\w/out |\randomized |\partition |\is |\equally |\efficient |\in |
worst |\case |\than |\quicksort |\w/ |\randomized |\partition |- |\CORRECT |
ANSWERS |\✔✔True, |\but |\the |\worst |\case |\is |\less |\likely |\with |\randomized |\partition Runtime |\to |\find |\ith |\smallest |\element |\in |\an |\array |- |\CORRECT |
ANSWERS |\✔✔O(n) Direct |\address |\table |\runtime |\of |\search, |\insert, |\and |\delete |\functions |- |\CORRECT |\ANSWERS |\✔✔O(1) What |\does |\chaining |\mean |\in |\the |\context |\of |\hash |\tables? |- |\CORRECT |\ANSWERS |\✔✔When |\collisions |\occur, |\create/add |\to |\linked |\list Runtime |\of |\hash |\table |\search |\and |\delete? |- |\CORRECT |\ANSWERS |
✔✔O(n) simple |\uniform |\hashing |- |\CORRECT |\ANSWERS |\✔✔any |\element |\is |
equally |\likely |\to |\hash |\to |\any |\slot