So, I'm working on the final assignment of the semester. And like always, its challenging but not to the point of flipping tables. Right now, I'm stuck on the 4th question of the assignment (I haven't completed the others, its just that I'm working on this problem for now).
The question asks me to design an algorithm for binary search with the pre-condition being that the list has elements comparable with type of 'x', and the list at least has 1 element. The algorithm is supposed to return the index of 'x' in the list or -1 if 'x' is not in the list. I'm brainstorming ideas on how to do it. The hint suggests that I follow the approach from lecture notes and develop the code using pictures or something similar.
I don't really follow that approach and I guess, I need to go over the slides more than a few times to get what's going on. Hopefully, I'll be able to crack this problem soon.
And I think, this would problem would be my mathematical proof post (the following posts would contain the mathematical/proof part).
The question asks me to design an algorithm for binary search with the pre-condition being that the list has elements comparable with type of 'x', and the list at least has 1 element. The algorithm is supposed to return the index of 'x' in the list or -1 if 'x' is not in the list. I'm brainstorming ideas on how to do it. The hint suggests that I follow the approach from lecture notes and develop the code using pictures or something similar.
I don't really follow that approach and I guess, I need to go over the slides more than a few times to get what's going on. Hopefully, I'll be able to crack this problem soon.
And I think, this would problem would be my mathematical proof post (the following posts would contain the mathematical/proof part).
No comments:
Post a Comment