1. Data Structures and Algorithms (Project 1)
INSTRUCTIONS:
Create a program using the following features:
* Array
* Class
* Specific Sorting Algorithm
* Specific Searching Algorithm
What is "Specific Sorting Algorithm" and "Specific Searching Algorithm"?
* sorting code that uses a specific sorting process, here is the list of sorting algorithms that you will use
Bubble
Selection
Insertion
Merge
Shell
* searching code that uses a specific searching process, here is the list of searching algorithms that you will use
Linear
Binary
Fibonacci
Jump
# Searching an element in a list/array in python
# can be simply done using \'in\' operator
# Example:
# if x in arr:
# print arr.index(x)
# If you want to implement Linear Search in python
# Linearly search x in arr[]
# If x is present then return its location
# else return -1
def search(arr, x):
for i in range(len(arr)):
if arr[i] == x:
return i
return -1
Comments
Leave a comment