Carey Brown wrote:Could you please describe, in English, the algorithm you are trying to implement. Part of it looks like a binary search algorithm but that won't work in your case because the array is not sorted.
Yes you are right , here the condition is that the user inputs elements into ascending order (I forgot to mention this prerequisite) and yes this indeed is almost a binary search algo
I understand that it is as same as binary search only difference here is that even after finding the key/target element we still continue our search to the left of the array, (because it is sorted in ascending order and the very first occurrence will obviously be to the leftmost side of an array) I just want to know how do we do this..
I am Finding 1st occurrence of an Element in an Array
But I want to follow this specific approach :
SideNote : Most of the people have done it via parameterized method, and I have understood that solution and have no problem with that nor do I claim that this approach is better, it's just that I want to do it in this way, please let me know if it's possible, if yes, please help showing how.
Also, I don't see this @Entity annotation from org.hibernate.annotations, does that mean I have not included hibernate dependency in my xml file??, despite adding this code snippet :
I have added dependencies of H2 database and Hibernate in my file
to add Hibernate dependency I went to hibernate's homepage hibernate.org and from there followed this getting started guide
of how to Obtain Hibernate using Maven Dependency which showed me the code snippet, I added this snippet inside my dependency tag in my xml file
And to add H2 database dependency I took help of mvnrepository.com
Whenever I am trying to get suggestions of @Entity annotation in Spring Tool Suit, I am just not finding it , be it suggestion from javax.persistence, or from org.hibernate.annotations,