Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Task Details Using the Vector class you implemented as part of Task 1 . 1 P work through the following steps to complete the task:

Task Details
Using the Vector class you implemented as part of Task 1.1P work through the following steps to complete
the task:
1. Explore the program code attached to this task. Create a new Microsoft Visual Studio project and
import the Vector.cs file, or alternatively, extend the project inherited from the previous tasks by
copying the missing code from the enclosed template for the Vector class. Import the Tester.cs
file to the project to access the prepared Main method important for the purpose of debugging and
testing the required algorithmic solution.
2. In the first part of this task, you must further extend the Vector class to enable searching an
element in a sequence of generic data elements using the recursive version of Binary Search. You
must add the following functionality to the class:
- int BinarySearch( T item )
Searches within the entire sorted Vector for an element using the default comparer and returns
the zero-based index of the element, if item is found; otherwise, a negative number (e.g.-1). This
method uses the default comparer Comparer.Default for type T to determine the order of the
elements in the Vector.
- int BinarySearch( T item, IComparer comparer )
Searches within the entire sorted Vector for an element using the specified comparer and returns
the zero-based index of the element, if item is found; otherwise, a negative number (e.g.-1).
Note that you are not allowed to delegate the binary search operation to the Array class or any other
collection classes. You must implement the Binary Search algorithm from scratch. To learn the
similarity with the standard List class of .NE

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transact SQL Cookbook Help For Database Programmers

Authors: Ales Spetic, Jonathan Gennick

1st Edition

1565927567, 978-1565927568

More Books

Students also viewed these Databases questions

Question

Language in Context?

Answered: 1 week ago