Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 2 out of 6 pages
Class notes

CSCE 146 Practice Exam Review: Loops, Data Structures, Recursion & Big-O

Document preview thumbnail
Preview 2 out of 6 pages

Gear up for your computer science exams with this highly practical review workbook tailored specifically for intermediate Java data structures and algorithm analysis courses. Core Chapters Covered:Loops and Arrays: Code-tracing strategies for nested loops and managing array index boundaries. Linked Lists: Visualizing nodes, head updates, pointer traversal, and avoiding termination bugs. Queues & Stacks: Master FIFO vs. LIFO behaviors, enqueue/dequeue, and push/pop operations. Recursion: Step-by-step tracing of recursive calls and defining concrete base cases. Big-O Notation: Growth rate hierarchies from O(1) to $O(n!) with direct simplification techniques. Binary Search Trees (BST) & Heaps: Insertion, structural deletion cases, traversals (preorder, inorder, postorder), and max/min heap bubbling behaviors. Includes an Answer Key containing complete loop traces, tree diagrams, memory behaviors, and sorted array logic.

Content preview

PRE MI UM ACT I VE- LE A RN IN G WO RK BOO K




Loops, Data Structures, Recursion & Big-O
CSCE 146 Practice Exam Review


Computer Science • Active-Learning Edition




How to use this workbook
1. Read the concept explanation. 2. Study the worked example. 3. Try the practice problems yourself.
4. Check your work against the Answer Key. 5. Revisit anything you missed.

, 1. Loops and Arrays
● The outer loop controls the number of iterations (rows/rounds); the inner loop controls how many
items print per iteration.
● Loop variables can increment in different ways (e.g. i += 2), which changes the output and iteration
count.
● Array indexing (e.g. i * 2) can lead to skipped values or out-of-bounds errors — track indices carefully.
● Beginner rule: write out each iteration in a table (loop variable | array index | output) rather than
solving in your head.



WORKED EXAMPLE — Tracing a Nested Loop
for (int i = 0; i < 3; i++) { for (int j = 0; j < 2; j++) { System.out.print(i + "," + j + " "); } }
i=0: j=0 → print 0,0 | j=1 → print 0,1
i=1: j=0 → print 1,0 | j=1 → print 1,1
i=2: j=0 → print 2,0 | j=1 → print 2,1
Final output: 0,0 0,1 1,0 1,1 2,0 2,1

✏ TRY IT YOURSELF
1. Trace: for (int i = 0; i < 4; i += 2) { System.out.println(i); } — what prints?
2. Given int[] a = {5,10,15,20,25}; what does a[i*2] give when i=1? When does this go out of bounds?




2. Linked Lists
● A linked list is made of nodes; each node holds data and a reference to the next node, starting from the
head.
● Add to the front: head = new Node(x, head); — this updates the head reference.
● Setting a link to null removes all nodes after that point.
● To traverse: start at head, follow .next until you hit null.



WORKED EXAMPLE — Adding Nodes and Printing
Node head = new Node(1, null); head = new Node(2, head); → list is now 2 → 1
To print: Node current = head; while (current != null) { print(current.data); current = current.next; }

✏ TRY IT YOURSELF
1. Draw the list after: head = new Node(5, null); head = new Node(3, head); head = new Node(9, head);
2. What happens if you call current.next on a node whose next is null?

Document information

Uploaded on
July 11, 2026
Number of pages
6
Written in
2025/2026
Type
Class notes
Professor(s)
Jeremiah shepherd
Contains
All classes
$10.99

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

Sold
0
Followers
0
Items
9
Last sold
-


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