





































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An introduction to fundamental concepts in data structures and algorithms, including a review of relevant mathematical topics such as exponents, logarithms, and series. It covers key programming techniques like recursion and the use of generic objects in java. Important data structure concepts like arrays, collections, and comparators. Overall, this material lays the groundwork for a comprehensive study of data structures and algorithms, which are essential for computer science and software engineering students. The depth and breadth of the topics covered make this document a valuable resource for university-level coursework and self-study.
Typology: Summaries
1 / 45
This page cannot be seen from the preview
Don't miss anything!






































© 2022 by Greg Ozbirn, UT-Dallas, for use with Data Structures book by Mark Allen Weiss 1
Fall 2022
N
N
N
2
2
2
X
3 = 8 so log 2
C
C
log 2 16 = log 10 16 / log 10
B
X
log 10
4 = 4 log 10
N ∑ i = N(N+1)/2 ≈ N 2 / i=
Proof by Contradiction
Steps:
1. Basis step : Prove for the minimal case. 2. Inductive step: a. Inductive hypothesis: Assume the theorem holds for all cases up to some limit k. b. Prove the next case: for example, k+
Prove: for Fibonacci numbers, F i
i , i>= Basis step: F 1
1 , F 2
2 Inductive step: assume true for i=1, 2, …, k Show F k+
k+ F k+
k +
k- F k+
k
public static int power(int x, int n) { if (n = = 0) return 1; else return x * power(x, n-1); } power(5,3) = 5*power(5,2) = 5 * (5 * power(5,1)) = 5 * (5 * (5 * power(5,0))) = 5 * (5 * (5 * 1)) = 5 * (5 * 5) = 5 * 25 = 125
Consider this recursive function: public static void print(int n) { if (n >= 10) print( n / 10); printDigit( n % 10); } print(6371); print(637) print(63) print(6) printDigit(6%10); printDigit(63%10); printDigit(637%10); printDigit(6371%10);