hi everyone!!pls help me..
here's the problem
-Create a program that will input a list or array of number and arrange them in ascending order.Then search a target..

please help me to program this in java!!

Recommended Answers

All 5 Replies

Like it says at the top of the main page...,

to keep DaniWeb a student-friendly place to learn, don't expect quick solutions to your homework. We'll help you get started and exchange algorithm ideas, but only if you show that you're willing to put in effort as well.

And posting it 3 times will reduce your chances of help to 1/3.

please help me to program this in java!!

public class Test{

public static void main(String[] args){


et voilá, 'this' has been programmed in java!!

now ... be a nice boy, and stop spamming this forum.
considering the date, I assume the year is comming to and end, and you would want to do some last minute cramming before going to take your exam, but hey ... if you can't write the code to do this on your own by now, I wouldn't bother. you might want to put some extra time and effort in the exams you do have a chance on passing.

Where is the code you are having problems with?
Do you have a design for how the program is to work?

int sort()
		if(length == 0)
			System.out.print("List is empty,Please insert items first");
			return FAILURE;
		Node curr = head;
		Node nextCurr = curr.next;
		for(int i=1;i<=length-1;i++)
			for(int j=0;j<length-i;j++)
				if(curr.data > nextCurr.data)
					int temp = curr.data;
					curr.data = nextCurr.data;
					nextCurr.data = temp;	
						curr = curr.next;
				if(nextCurr.next != null)
					nextCurr = nextCurr.next;
			curr = head;
			nextCurr = curr.next;
		return SUCCESS;

Do the rest by yourself

commented: don't just hand out code -2


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.