473,803 Members | 4,458 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

a different linked list(like doubly)

82 New Member
Hello.
we have this struct and we must to make a linked list
Expand|Select|Wrap|Line Numbers
  1. struct node {
  2.     char name[NAMESIZE];
  3.     char phone[PHONESIZE];
  4.     struct node *prevName;     // previous node alphabetically
  5.     struct node *prevNumber;   // previous node sorted by numbers
  6.     struct node *nextName;     // next node alphabetically
  7.     struct node *nextNumber;   // next node sorted by numbers
  8. } ;
As i can see i must make a linked list(like doubly but with 4 pointers) or two doubly linked lists:
1)one with prevName and nextName
2) and one with prevNumber and nextNumber
From these lists i will print the elements alphabetically or sorted by numbers
I believe that i must make ONE list such as:
malloc for the newnode and then just change the pointesr to be sorted
My problem is that i can't do this in one list.I don't know what i need(maybe 2 while loops for the pointers?) and i am confused.Please give any idea?
(if you want i can post the code to add a number in a doubly linked list sorted)
Jan 1 '08
10 1983
Raghunandan24
31 New Member
Thanks but i must use the struct as it is .I can't change the struct(as i say in another post it is an exercise)
There must be some use of the two arrays in the structure. What are you trying to do with the arrays?

Tell me if you encounter any problems.

Raghu
Jan 4 '08 #11

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

Similar topics

19
7829
by: Dongsheng Ruan | last post by:
with a cell class like this: #!/usr/bin/python import sys class Cell: def __init__( self, data, next=None ): self.data = data
7
14259
by: Zeba | last post by:
Hi, I have to write program in C# to merge sort a linked list (doubly linked). Is it true that the best way to do it is copy it into an array, sort it and then convert back ? I'm new to C#, but I tried to develop a merge sort program myself, but have got stuck with a Null reference exception for the pos variable in merge function. Also I wrote a function to get the actual nodes from teh index values before calling merge function. Is...
2
2294
by: LTDEV | last post by:
Hi, Im looking for a linked-list like structure in C#. Im a C++ programmer that needs to make little module (TCP sockets communication) in C#. I need to attach a buffer for incoming data because i have to decipher incoming data and extract them into datapackets, and the forward them onto the application. In C++ i normally create a linked list, where i then push() the packets of
5
1465
by: Daniel Nogradi | last post by:
The etree.Element (or ElementTree.Element) supports a number of list-like methods: append, insert, remove. Any special reason why it doesn't support pop and extend (and maybe count)?
10
1789
by: =?utf-8?B?5Lq66KiA6JC95pel5piv5aSp5rav77yM5pyb5p6B | last post by:
Is there a simple function to generate a list like ? The range() just can generate the numeric list.
3
1004
by: noagbodjivictor | last post by:
>>s = This is what I want so that I can put it in a module then import that module to work with my variable.
9
3234
mbmccormick
by: mbmccormick | last post by:
In Visual Studio when developing on VB.NET, we would get an instant error list- before compiling or building the solution. Why doesn't C# have this same functionality? Whenever I want to see my errors, I have to compile first...
1
1104
by: =?Utf-8?B?S3VuIE5pdQ==?= | last post by:
Dear all, I'm trying to write a program with a control like the left flist of outlook. A header or button above with a list under it. But it's a bit difficult to emulate the animation effect when the button rises up or sets down. I wonder if there's such a sample. Thanks for any hints in advance.
0
9703
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, 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...
0
9564
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10316
jinu1996
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...
1
10295
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,...
0
9125
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7604
isladogs
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...
0
5500
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...
2
3798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2970
bsmnconsultancy
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...

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.