Team 7 Finding The KTH Smallest Element D11
Team 7 Finding The KTH Smallest Element D11
smallest element
Presented by Team 7
Team members:
1. DEEPAK KUMAR (20BCE10660)
2. DEVANSH ASHOKKUMAR JAIN
(20BCE10663)
...
3. DIPTANU SAHA (20BCE10664)
4. ABHIMAN GAUTAM (20BCE10668)
5. AYUSH (20BCE10671)
Brief Description on ARRAYS
Array is a container which can hold a fix number of items and these items should be of the same type. Most of the data structures make
use of arrays to implement their algorithms. Following are the important terms to understand the concept of Array.
❏ Element − Each item stored in an array is called an element.
❏ Index − Each location of an element in an array has a numerical index, which is used to identify the element.
ARRAY Representation
To create an array of numeric values in Python, we need to import the array module. For example:
INPUT: import array as arr
a = arr.array('i', [1, 3, 5])
print(a)
Here, we created an array of int type. The letter ‘i’ is a type code. This determines the type of the array during creation.
Basic Operations
Following are the basic operations supported by an array:
❏ Traverse − Prints all the array elements one by one.
❏ Insertion − Adds an element at the given index.
❏ Deletion − Deletes an element at the given index.
❏ Search − Searches an element using the given index or by the value.
❏ Update − Updates an element at the given index.
if __name__ == '__main__':
A = [7, 4, 6, 3, 9, 1]
k = 3
print("K'th smallest element is", kth_smallest(A, k))
Output:
‘K’th smallest element is 4
Conclusion
At last, this presentation gives all the information about how can we find the kth smallest element from an
array. Arrays allow random access to elements. This makes accessing elements by position faster. It has
better cache locality that can make a pretty big difference in performance. Arrays represent multiple data
items of the same type using a single name while on the other hand we can’t change the size i.e. once we
have declared the array we can’t change its size because of static memory allocated to it. Here Insertion and
deletion are difficult as the elements are stored in consecutive memory locations and the shifting operation is
costly too.
Knowing the number of steps how long an operation step is one of the fundamental levels of understanding
how array data structures work. Picking the right data structure of array with an understanding of operations
allows you to craft code that takes fewer steps, which means greater efficiency.
Individual Contributions
1. Deepak Kumar (20BCE10660) - Research & Content Provider
2. Devansh Ashokkumar (20BCE10663) - Content Provider & Slides Making
3. Diptanu Saha (20BCE10664) - Slides Making & Slides Filtering
4. Abhiman Gautam (20BCE10668) - Content Provider & Slides Filtering
5. Ayush (20BCE10671) - Research & Content Provider
THANK