We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1
Array Operations
We have studied many of the array operations in the class, like:
• isEmpty() • isFull() • capacity() • size() • printAll() • linearSearch(key) • binarySearch(key) • insertFirst(value) • insertLast(value) • insertAt(value, index) • insertAfter(value, key) • deleteFirst() • deleteLast() • deleteAt(index) • delete(value) • deleteAll() • rotateRight() • rotateLeft() • bubbleSort() • selectionSort() • insertionSort() • shellSort() There may be a thousand more operations thought to be performed on arrays. Prototypes of some of these are given below so that you may practice yourself and devise their algorithm. You can think many more operations of your own for your practice. • isSorted() • printFirstN(n) • printLastN(n) • print(index1, index2) • print(index, n) • reverseArray() • rotateRight(shiftvalue) • rotateLeft(shiftvalue) • rotateFirstHalf() //including the middle element in left half if “n” is odd • rotateSecondHalf() //including the middle element in left half if “n” is odd • rotateFirstHalf() //not including the middle element in any half if “n” is odd • rotateSecondHalf() //not including the middle element in any half if “n” is odd • insertSorted(value) //always inserts a value in its proper sorted location in the array Always implement these operations as methods of “listADT” class. Don’t forget to analyze their time complexity. You can also do the same for “dynamicListADT” class.