Hi,
It has to be some stupid high school home task , that can be solved in
rather straightforward manner.
The pain in the @ss is the requirement not to touch the original list,
that is: no swap between the elements is permitted.
O(n^2) is a bunch of time: the list can be even bubble sorted, but I
really fail to figure out how the hell I'm supposed to handle the
sorting without building any additional structures and the requirement
not to modify the original list in any way.
Any help/tip/advice will be appreciated,
Thanks. 2 1588
On 8 Jan 2007 22:33:41 -0800, "Billy" <st******@gmail .comwrote:
>Hi,
It has to be some stupid high school home task , that can be solved in rather straightforward manner. The pain in the @ss is the requirement not to touch the original list, that is: no swap between the elements is permitted. O(n^2) is a bunch of time: the list can be even bubble sorted, but I really fail to figure out how the hell I'm supposed to handle the sorting without building any additional structures and the requirement not to modify the original list in any way.
Any help/tip/advice will be appreciated,
Wrong news group. That said, make n passes through the list. In each
pass find the smallest one that is larger than the last one printed.
Try comp.programmin g next time.
"Richard Harter" <cr*@tiac.netwr ote in message
news:45******** *******@news.sb tc.net...
On 8 Jan 2007 22:33:41 -0800, "Billy" <st******@gmail .comwrote:
>>Hi,
It has to be some stupid high school home task , that can be solved in rather straightforward manner. The pain in the @ss is the requirement not to touch the original list, that is: no swap between the elements is permitted. O(n^2) is a bunch of time: the list can be even bubble sorted, but I really fail to figure out how the hell I'm supposed to handle the sorting without building any additional structures and the requirement not to modify the original list in any way.
Any help/tip/advice will be appreciated,
Wrong news group. That said, make n passes through the list. In each
pass find the smallest one that is larger than the last one printed.
Try comp.programmin g next time.
Also, Billy, although I'm sure you noticed ... making N complete passes
through a list with N elements might be O(N**2). This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Brent W. Hughes |
last post by:
I kind of hate to have to convert a string into a list, manipulate it, and
then convert it back into a string. Why not make strings mutable?
|
by: Steve Lambert |
last post by:
Hi,
I've knocked up a number of small routines to create and manipulate a linked
list of any structure. If anyone could take a look at this code and give me
their opinion and details of any potential pitfalls I'd be extremely
grateful.
Cheers
Steve
|
by: Eugen J. Sobchenko |
last post by:
Hi!
I'm writing function which swaps two arbitrary elements
of double-linked list. References to the next element of list
must be unique or NULL (even during swap procedure), the same condition
should be kept for references to previous element of list.
Here is my solution below:
struct node {
|
by: Clunixchit |
last post by:
How can i read lines of a file and place each line read in an array?
for exemple;
array=line1
array=line2
...
|
by: Julia |
last post by:
I am trying to sort a linked list using insertion sort. I have seen a
lot of ways to get around this problem but no time-efficient and
space-efficient solution. This is what I have so far:
struct node
{
int x;
struct node *next;
};
| |
by: temp34k45k |
last post by:
I need to evaluate two strings for their order.
The strings contain Letters (A thru Z upper case only) and Numbers
(0-9) and the decimal point (.).
I need an order like the list that follows: ( it's just an example
of the order )
0
1
|
by: Jeff Bown |
last post by:
Consider implementing a (doubly) linked list.
The simplest strategy is to provide functions
item_t add_item(item_t predecessor);
void delete_item(item_t item);
where add_item allocates memory for a new list item and returns it (or
NULL), and delete_item frees that memory.
However, if at startup the program immediately adds a large number of
items to a list, then all those calls to malloc() become expensive.
|
by: Aditya |
last post by:
Hi All,
I would like to know how it is possible to insert a node in a linked
list without using a temp_pointer. If the element is the first element
then there is no problem but if it is in between then what is the best
solution.
|
by: sirsnorklingtayo |
last post by:
hi guys please help about Linked List,
I'm having trouble freeing the allocated memory of a single linked list node with a dynamic char* fields, it doesn't freed up if I use the FREE() function in C.. But if I try to use a single linked list with a static char array fields I can free the memory allocated with out any problems using the FREE(). So, why freeing a single linked list with dynamic char* is hard and why the FREE() function is...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| | |