Rohit Gaikwad

Ranch Hand
+ Follow
since May 26, 2015
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Rohit Gaikwad

the Logic your talking about like creating two helper methods like getMax(); and getMin(); i did that already in that case you need to keep track on current position and new position where we found the highest/lowest int.
But in that case we cant go with a single array.
Reason --
Thik about it your calling a Helper method every time (like when index is 0 or its 1,2,3..) what we can do is call getMax(); for even and call getMin(); for odd Index but how will you guide the helper methods to search like 1st you search or highest then 2nd time you look for second highest and so on same or the getMin() method too.

Trust me i Tried that already.
and this Was the easiest implementation i found
but i still have to try that
isLookingForMax = !isLookingForMax;
once i am done with that will let you know
5 years ago
i guess i should Explain the task
So the task is
1) we have an unsorted array example [7,4,2,1,5,6,3]
2) we need to rearrange this array in Max Min Max Min... format
3) so all even index will be Max like max of all at index 0 then second max at index 2 and so on
4) and all odd will be minimum like at index 1 we need the lowest number
then on index 3 we need second lowest and so on
example on index 1 we have 1 and on index 3 we have 2
so the output should be like [7,1,6,2,5,3,4]
but the conditions are
1) you can use only one array that's the input array (cant use any result or output array)
2)you cant sort array by any means (no-Arrays.sort();) or any other thing

i guess that will be clear now if no i will post a Picture describing this

5 years ago
One more thing he mentioned not to sort array
like you cant short array and then arrange the array
you need to do it by finding Max and Min logic only
i cant do [1,2,3,4,5,6,7] and then rearrange.

and i know that's really easy to do it that way
Thanks again

5 years ago
Hi all
Let me tell you why i am trying to do it with a Single array and why not using an Result array.
Yesterday i was in an Interview where the guy asked me to rearrange the Array in Max Min format
As you every one said using 2 arrays like an input array and result array will solve this issue. I did the same but the Examiner asked me to do it with a single array and he said it can be done.
So that's the reason i guess this will even help other on there Interview part
Can any one please tell me the Logic behind my code is correct or not so i can try it more harder

Thanks to all

5 years ago
Current Output is [6, 1, 5, 2, 7, 3, 4]
required is [7,1,6,2,5,3,4]
5 years ago

i do have some prblem on the line 1 if(input[i] < input[j]); which is always returning true
for i=0 input[i] =7 which is greater then input[j] which is 4
but still if loop is running and changing the value
Please help me

Thanks in Advance
5 years ago
Thanks Stefan Evans
Solution Worked !!!
But Can you please tell me why it was not working with Default package ?
And should i always built my tags in a package ??
5 years ago

I thought that myTag.tld file is not getting detected or the tag in not getting detected so Declared
taglib under web.xml file
But still getting the same error

So still waiting for reply from Experts
5 years ago
Simple tag handeler code

JSP Page

and the error i am getting is ---

I am New o Please HELP

Thanks In advance
5 years ago
Hi all,
it not related to any code but i need a solution .
So my problem is - I am new to Jsp and Servlets so i am on try and error so i know many times i go wrong and my eclipse stop responding (Not-Responding).
so i just do a End task and restart Eclipse
But the Problem is when i start Eclipse and Try to Start Tomcat Server its giving me an error

Error---Several ports (8005, 8080, 8009) required by Tomcat v7.0 Server at localhost are already in use
i know its because my Tomcat was running when Eclipse Stopped Responding

So what i mostly do is restart my System and Problem is solved

But any one know any Easy solution
I have already tried Bath or sh file its not working as tomcat was running in eclipse i guess

i really dont want to restart my system as when i am really in a flow and this thing happens,i never get the same feel
So Please Help me

Thanks and regards
Rohit Gaikwad
5 years ago
Got the Solution Finally Actually there was Bug in Building work space So followed simple steps
1) Exit Eclips
2) Delete .lock file in workspce\.metadata\.lock
and then tried it again
but really thanks for your help

5 years ago
I checked it and it was good before but still was getting class not found error
now i am trying this without using Package (default package)
and the web.xml is

error on Tomcat--

Html Index page

BeerSelector class--

And Finally the Console log Stating that class not found
5 years ago

Error once clicked Submit button

HTTP Status 404 - /BeerSelect1/

type Status report

message /BeerSelect1/

description The requested resource is not available.
5 years ago
Thank you all, and please be in touch as i know i will need your help again and again and again , and thanks for the site will make a comment

Rohit Gaikwad
5 years ago
Hi, i am trying to built and application from head first servlets and jsp 3rd chapter. right now i am no 3rd step where a BeerExpert is sending data to servlet (not yet using jsp).
but i dont know whats going wrong the web.xml is

and when i am deleting <servlet> and <servlet-mapping> tab and placind <welcome-file-list> form.html</> is working fine and displaying the html

i am using tomcat 7 tried the same on eclipse and also on notepad
its giving me error 404 file not found

Thanks in advance
5 years ago