473,406 Members | 2,849 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

searching and sorting

I have to create a program that creates 5 or 6 vertical bars of different heights using an array. And the bars need to be lined up across the page which is what I'm having trouble with. The rest of the program I believe I can do, which is then creating a timer and action listener so that it compares the first bar to the second bar and then if teh second is shorter the bars switch and it does this till all teh bars are sorted from shortest to tallest. But i've already created a sorting algorithm for another program I did which should work fine. But all i can get are random height and width bars in random places. Any help will be greatly appreciated thanks.
Mar 13 '07 #1
5 1715
RedSon
5,000 Expert 4TB
There should be a layout manager that you can use to make those bars line up. Like FlowLayout (which should be set as default). That works if you are using java gui code, if not then you will have to figure out how it works with whatever gui you are using.
Mar 13 '07 #2
r035198x
13,262 8TB
I have to create a program that creates 5 or 6 vertical bars of different heights using an array. And the bars need to be lined up across the page which is what I'm having trouble with. The rest of the program I believe I can do, which is then creating a timer and action listener so that it compares the first bar to the second bar and then if teh second is shorter the bars switch and it does this till all teh bars are sorted from shortest to tallest. But i've already created a sorting algorithm for another program I did which should work fine. But all i can get are random height and width bars in random places. Any help will be greatly appreciated thanks.
You are going to be moving the bars around so using a layout might not be the best option since you'd have to change it everytime you move a bar. What you need to use is a basic animation program. You can use an applet/canvas and draw the bars on the canvas at co-ordinates which you can change whenever you need to move the bars.
Mar 14 '07 #3
RedSon
5,000 Expert 4TB
Oh I didn't consider the moving around of the bars. I forgot you were trying to animate a sort. You can see similar things to this on wikipedia if you search for bubble sort. However I think those are animated gifs which probably wont do you much good.
Mar 14 '07 #4
roopal
2
hi i want a sorting algorithm for find a time complexity.ex.when we will enter some element in any mennar, that time which sorting method is working fast?how much its time complexity?
Aug 30 '07 #5
Nepomuk
3,112 Expert 2GB
hi i want a sorting algorithm for find a time complexity.ex.when we will enter some element in any mennar, that time which sorting method is working fast?how much its time complexity?
Do you mean, you're looking for an algorithm which sorts a new Element into a List/Array/etc. as fast as possible and information about how fast that is? (e.g. linear, logarithmic etc.)

If so, that depends on your Collection type. There is a difference between a sorted (Linked) List and a sorted Array. You access them in different ways, and therefor find the correct place in a different way.

Please give us more information about what you are looking for.
Aug 30 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Kakarot | last post by:
I'm gona be very honest here, I suck at programming, *especially* at C++. It's funny because I actually like the idea of programming ... normally what I like I'm atleast decent at. But C++ is a...
2
by: yee young han | last post by:
I need a fast data structure and algorithm like below condition. (1) this data structure contain only 10,000 data entry. (2) data structure's one entry is like below typedef struct _DataEntry_...
1
by: anu | last post by:
helloo iam working on a parser wherein i search for a few strings in thousands of lines... ie i have an open fifo from which i keep receiving lines and lines of data and iam supposed to search...
5
by: jatin.libra | last post by:
helloo iam working on a parser wherein i search for a few strings in thousands of lines... ie i have an open fifo from which i keep receiving lines and lines of data and iam supposed to search...
6
by: David Garamond | last post by:
in oracle 10g, you can issue: ALTER SESSION SET NLS_COMP = ansi; ALTER SESSION SET NLS_SORT = binary_ci; do you think this is an elegant solution for case insensitive sorting & searching? is...
1
by: nubleo | last post by:
I need a help using a sorting and searching function ,Bimary search or selection sort.. ASAP.. Your help greatly appreciate. :) This is my first time posting ..
4
by: Kuku | last post by:
Hi, Can anyone please tell me good books/sites for sorting and searching. Finding it a little hard to understand
8
by: sandeep | last post by:
Our team is developing proxy server(in VC++)which can handle 5000 clients. I have to implement cache part so when ever a new request com from client I have to check the request URL content is in...
2
by: =?Utf-8?B?VGVycnk=?= | last post by:
I am implementing an 'incremental search', where as the user types into a textbox, a datagridview's current position is updated to match the first record that contains what the user has typed so...
5
by: lemlimlee | last post by:
hello, this is the task i need to do: For this task, you are to develop a Java program that allows a user to search or sort an array of numbers using an algorithm that the user chooses. The...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.