The Artima Developer Community
Sponsored Link

Java Buzz Forum
How to Find Top Two Maximum Number from Integer array in Java

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Javin Paul

Posts: 1090
Nickname: javinpaul
Registered: Jan, 2012

Javin Paul is Java Programmer working on Finance domain.
How to Find Top Two Maximum Number from Integer array in Java Posted: Mar 28, 2014 8:52 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Javin Paul.
Original Post: How to Find Top Two Maximum Number from Integer array in Java
Feed Title: Java67
Feed URL: http://www.java67.com/feeds/posts/default?alt=rss
Feed Description: Java and technology tutorials, tips, questions for all programmers.
Latest Java Buzz Posts
Latest Java Buzz Posts by Javin Paul
Latest Posts From Java67

Advertisement
In this post, I have come with another simple programming problems for Java beginners. I love to share short programming problems because they help in developing programming sense. Many people will argue against simple problems like prime numbers, palindrome and factorial, but I really find them useful, especially for beginners. A beginner is far away to solve a complex data structure problem or even more complex problems like those appear in TopCoder or other programming sites. Programmers learn gradually and they need joy of doing something and seeing result much quickly then any other. Small success motivates them. Anyway, here is our problem statement, you need to write a Java program to find top two maximum numbers in the given array. You can not use any sorting functions and you should iterate the array only once. Use of any kind of collection class e.g. TreeSet or LinkedHashSet are also not allowed. For example, if given integer array is [20, 34, 21, 87, 92, 2147483647] then first maximum is 2147483647 and second maximum is 92. Bonus points are for those, who can also write JUnit test cases, more test scenarios, more points. Few more bonus points for those who can write code to deal with really large array, something which may not entirely fit on memory.
Read more ยป

Read: How to Find Top Two Maximum Number from Integer array in Java

Topic: Half full or half empty? HTML5's mixed outlook Previous Topic   Next Topic Topic: Fatal abstraction: A bottom-up view of high-level languages

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use