• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 1 out of 2 pages
Exam (elaborations)

Data Structures and Algorithms Final Exam Study Guide Qs & As

Document preview thumbnail
Preview 1 out of 2 pages

Data Structures and Algorithms Final Exam Study Guide Depth First Search - Answer- "think sink" Root node first Visit Root - visit left child - repeat until no more left children - visit sibling - if children visit those - climb back up Post-Order Traversal - Answer- Visit node after all children are visited Root node last Breadth First Search - Answer- Visit nodes top to Bottom, left to right like reading a book In-Order Traversal - Answer- Visit node after left child but before right Must be BST Complexity of traversing tree - Answer- Linear Complexity of inserting into a tree - Answer- Logarithmic to Linear Removing a Node from a BST - Answer- Replace node with smallest value from right subtree Splay Tree - Answer- a self-balancing binary tree that places recently accessed elements near the top of the tree for fast access. Zig Rotation - Answer- Parent is moved to become child of node (single rotation) zig-zag rotation - Answer- If the node is left child of the parent which is right child of grandparent, move grandchild up two levels and grandparent right child (double rotation) zig-zig rotation - Answer- If the node is the left child of the parent which is also the left child of the grandparent, move up grandchild two levels by making parent right child and grandparent right child of the parent (double rotation) Time Complexity - Answer- the amount of time taken by an algorithm to run as a function of the input size Auxiliary Complexity - Answer- The amount of memory used by algorithm Space Complexity - Answer- The total space taken by an algorithm with respect to the input size time complexity for stacks and queues - Answer- search: linear insert/push: constant remove/pop: constant

Content preview

Data Structures and Algorithms Final
Exam Study Guide
Depth First Search - Answer- "think sink" Root node first
Visit Root -> visit left child -> repeat until no more left children -> visit sibling -> if
children visit those -> climb back up

Post-Order Traversal - Answer- Visit node after all children are visited
Root node last

Breadth First Search - Answer- Visit nodes top to Bottom, left to right like reading a
book

In-Order Traversal - Answer- Visit node after left child but before right
Must be BST

Complexity of traversing tree - Answer- Linear

Complexity of inserting into a tree - Answer- Logarithmic to Linear

Removing a Node from a BST - Answer- Replace node with smallest value from right
subtree

Splay Tree - Answer- a self-balancing binary tree that places recently accessed
elements near the top of the tree for fast access.

Zig Rotation - Answer- Parent is moved to become child of node (single rotation)

zig-zag rotation - Answer- If the node is left child of the parent which is right child of
grandparent, move grandchild up two levels and grandparent right child (double
rotation)

zig-zig rotation - Answer- If the node is the left child of the parent which is also the
left child of the grandparent, move up grandchild two levels by making parent right
child and grandparent right child of the parent (double rotation)

Time Complexity - Answer- the amount of time taken by an algorithm to run as a
function of the input size

Auxiliary Complexity - Answer- The amount of memory used by algorithm

Space Complexity - Answer- The total space taken by an algorithm with respect to
the input size

time complexity for stacks and queues - Answer- search: linear
insert/push: constant
remove/pop: constant

Document information

Uploaded on
August 18, 2024
Number of pages
2
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
$8.49

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Freshy
3.6
(11)
Sold
64
Followers
4
Items
6965
Last sold
1 week ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions