Question
Assignment#6 Linear Data Structure Due Date: Midnight of April 21 (Saturday) Purpose: The purpose of this assignment is to help you: Understand search and sort
Assignment#6 Linear Data Structure
Due Date: Midnight of April 21 (Saturday)
Purpose: The purpose of this assignment is to help you:
Understand search and sort Understand Generic method, Generic interface, Generic class and Hash table
Instructions: Be sure to read the following general instructions carefully:
This assignment should be completed individually by all the students. You are encouraged to demonstrate your solution during lab session, and submit your solution through the dropbox. You must name your submission according to the following rule: studentID(yourlastname)_ASSnumber.zip. e.g., 300123456(smith)_ASS#7.zip
Question 1[10 marks]
Use a concrete example to explain how generic methods can be overloaded [3 marks] Explain following terms [1 mark per term]
ICollection Array IList Load factor Hash-table collision Space/time trade-off in hashing dictionary
Question 2[10 marks]
Linear search algorithm searches each element in an array sequentially. If the search key does not match an element in the array, the algorithm tests each element and, when the end of the array is reached, informs the user that the search key is not present. If the search key is in the array, the algorithm tests each element until it finds one that matches the search key and returns the index of that element.
Write a generic method, Search, that searches an array using linear search algorithm. Method Search should compare the search key with each element in its array parameter until the search key is found or until the end of the array is reached. If the search key is found, return its location in the array; otherwise return -1.
Write a test app that inputs and searches an int array and a double array. Provide buttons that the user can click to randomly generate int and double values. Display the generated values in a TextBox, so the user knows what values they can search for. [Hint: use (T: IComparable
c# programming
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started