This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Program for missing number in sequence Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Program for missing number in sequence" Watch "Program for missing number in sequence" New topic

Program for missing number in sequence

priyanaka jaiswal
Ranch Hand

Joined: Jun 03, 2011
Posts: 79

A number is missing in a sequence of 1 to 100. So, find the missing number. So the series may look like this:
{8,3,2,4,1,100,67,99,73.....}.program for finding missing number in sequence?
Matthew Brown

Joined: Apr 06, 2010
Posts: 4541

As with most of these sort of problems, the first thing to do is to forget writing a program to solve it completely. How would you solve it by hand? How would you explain to someone else how to solve it by hand? You should work that out - and write it down - before you write a single line of code.

Once you understand how to solve it yourself you can write pseudo-code - the sequence of instructions that the computer will have to perform to solve it. And once you've got that you should find it much easier to convert that into code.

So, how would you solve it yourself?
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Program for missing number in sequence
It's not a secret anymore!