Professional Documents
Culture Documents
Resource sharing
*
Mon-Sat: Lecture 5:00 PM to p8:00 PM
pon & pur
Classroom coding will be in Java (use
IDE of your choice).
Will share C++/Python codes at the end
https://github.com/nilesh-g/dsa-06 *
of session.
Recorded videos will be available for 7 days. Language pre-requisites?
http://students.sunbeamapps.org
un
Data Structure
3 efficiently
Organizing data in memory
Processing the data mon
Linked List V
Stack #
Queue V
Hash Table V
Graph ↓
↓
n
gac
sapprose few params.
Common data structures uneasure w.r.t.
⑲,
x86
ava -
2
Linked List Unit space to store the data (Input space) and
Stack additional space to process the data (Auxiliary space).
O(1), O(n), O(n2) O(n)
115/7/s, S
O T
Queue ↑ 1 I
it an
arr
2
inputt
HashTable
2
S
spaces (1) ↑i - s k =
nauxa
Advanced data structures san
+ log s n
O(n3), O(n2), O(n log n), O(n), O(log n), O(1) Tan >
Tan
->
for (i 1;i =
x;i +)
+
↓
=
0(1)
xes =
as a ij O(n)
mu
5 k-=
Pointgoes);
-j
Print 2-D matrix of n x n.
3
for (i = 0,i u ;i +
+
3 ↓
O(n)
Print given number into binary. -
> ites
↑&
n
=
-> S k =
-
print(n%.2);
2
10
1
n n/2;
=
log
zitz log m = >agen
log z log log
↑ a
o I 3 its
2 = 2
2)
Print table of given number.(r) its =
su
o (log
mu
i
far (i 1;i c
= =
10;i +)
+
T k =
↓
-> Δ
pint(mai); o(1) S k+=
0(1)
Time complexity
Worst case
Best case
Average case
-
X o 7 234567 &
Find a number in a list of given
numbers (random order). arr
88 33 66 99 11 77 22 55 11
↑
linsearch
int (awr, key)
Time complexity 1)5
far(i 0, (n;i i
+
=
Worst case
if (aw [i]
key)9 =
=
return
-
1;
3
↑ the firstoccurrence
if
element is
repeated,
index will return.
linsearch
int (awr, key)
Time complexity
key 70 nitus
far(i (n;i
i 1)5 +
0,
=
-
Worst case < =
G
- xn =
manifes
key)9
if (aw [i]
%Egg-single
=
=
re
m
↳ o(D
-
Average case nn
return 1;
+azz
-
3
T2u
o(n)
ma
possible if is
~
only array already -
0 1 2 3 4 5 6 7 ->
8
sarted.
int bin search (arr, key) [ 11 22 33 44 55 66 77 88 99
e 0j=
e 2
v n =
-
1j
w)E
while(1
zit=b.n
= 20
w (l
=
+
los w
single it
return los z
=
on; its ↓
1 k50(1)
avr(u))
=
if (key >
e m
=
1;
+
it
=
else -wast
case
found
3
v m
= -
1; -
a
return
-
j -> I las
m
-> ① (log 2)
3