Please use Python and don't make the code overly complicated and lengthy. Thanks. Create a KeyIndex class with the following properties : Fields: int [ ] k; Description An array of integers. Note: You can maintain another instance variable if needed (but you can’t use more than one). Constructor: KeyIndex(int [ ]a) Description: This constructor takes an array of integers a and populates array k with the element in a as indices into k. Note: make sure the build-up of your array k supports negative and non-distinct integers. Methods: search (int val) Description: This method searches for the value val within the array and returns true if found or false otherwise. sort () Description: This method will return the sorted form of the array that had been passed into the constructor. NOTE: Create a tester class or write tester statements to check whether the methods in your KeyIndex
Please use Python and don't make the code overly complicated and lengthy. Thanks.
Create a KeyIndex class with the following properties :
Fields:
int [ ] k;
Description
An array of integers.
Note: You can maintain another instance variable if needed (but you can’t use more than one).
Constructor:
KeyIndex(int [ ]a)
Description:
This constructor takes an array of integers a and populates array k with the element in a as indices into k.
Note: make sure the build-up of your array k supports negative and non-distinct integers.
Methods:
search (int val)
Description:
This method searches for the value val within the array and returns true if found or false otherwise.
sort ()
Description:
This method will return the sorted form of the array that had been passed into the constructor.
NOTE: Create a tester class or write tester statements to check whether the methods in your KeyIndex class work properly
Step by step
Solved in 4 steps with 2 images