Data Structures and Algorithms: Assignment 1
Data Structures and Algorithms: Assignment 1
Data Structures and Algorithms: Assignment 1
Submitted by:
Muhammad Maaz Khan
19PWBCS0687
Section B
3rd semester
Submitted to:
Dr. Iftikhar Ahmad
Data Structures:
Data structures are the different techniques and data objects that are used to manage data
efficiently in memory.
As computer programs are getting more complex from time to time, we need more reliable and
efficient ways of managing the data that these programs utilize. With growing data, we need
faster processors, more storage and more time to access data properly, so we need to apply
such techniques that would allow us to manage data that would require less processing power,
less storage space and less time, so we need data structures for optimal retrieval, storage and
processing of data, to tackle with the concerns of time, storage and processing power.
Well as for applications of data structures in computer science almost all programs use some
form of data structures. But here are some few examples:
Augmented Reality
Operating Systems
Graphical Analysis
Booking Systems like of hotels, flights, restaurants etc.
Google Maps
Video Play Lists
2: sum = 0 ---1
3: for i = 0 to n − 1 do ---n-1
6: end for
7: end for
9: end procedure
Worst Case:
It’s worst case is also O(n2) because it is a sum algorithm and it will sum all the input
always.
2: sum = 0 ---1
3: I = 10. ---1
4: N = 100. ---1
6: sum = sum + I.
7: N = N/2.
8: end while
Output:
Worst Case: